3.7 KiB
3.7 KiB
This service is used to obtain the affiliate.
GET: {' '}
URL_BASE + /ws/util.py/affiliates
Receives:
All parameters are sent in the querystring of the call, so a percentage encoding for URI must be applied (aka URL encoding).
Returns:
Depending on the result of the operation, this service can return two different JSON:
Answer JSON OK:
{
"status"
: <boolean>
,
"codtran"
: <string>
"affiliates"
:{' '}
[
{
"phone"
: <string>
,
"affiliate_id"
: <integer>
,
"country"
: <string>
,
"name"
: <string>
,
"other_data"
: <string>
,
"allow_prefunding"
: <boolean>
}
]
,
"elapsed"
: <float>
}
Where:
status:Shows if the call has been successful (true) or not (false).codtran:Transaction code that identifies the executed operation.affiliates:List of affiliates of the system.phone:Affiliate phone number.affiliate_id:Affiliate identifier.country:Affiliate Country Code.name:Affiliate name.other_data:Other affiliate data.allow_prefunding:Boolean that indicates if prefunding is allowed in the affiliate.elapsed:Operation execution time.
Answer JSON KO:
{
"status"
:{' '}
false
,
"level"
: <string>
,
"message"
: <string>
,
"error"
: <string>
}
Where:
status:Shows if the call has been successful (true) or not (false).level:Error importance level.message:Error message.error:Sole error code.
Example requests:
Python - Requests:
import requests
url ={' '}
"URL_BASE/ws/util.py/affiliates?country_code=MX&id_usuario=4532&id_sesion=413-JRdxDQvO-zPMcwLeptmOyA=="
payload ={' '}
{
}
files ={' '}
{
}
headers={' '}
{
}
response = requests
.request
(
"GET"
, url
, headers
=headers
, data{' '}
= payload
, files{' '}
= files
)
print
(response
.text
.encode
(
'utf8'
)
)
NodeJs - Request:
var request = require('request');
var options = {
'method': 'GET',
'url':
'URL_BASE/ws/util.py/affiliates?country_code=MX&id_usuario=4532&id_sesion=413-JRdxDQvO-zPMcwLeptmOyA==',
'headers': {},
formData: {}
};
request(options, function (error, response) {{' '}
if (error) throw new Error(error);
console.log(response.body);
});
JavaScript - Fetch:
var formdata = new FormData();
var requestOptions = {
method: 'GET',
body: formdata,
redirect: 'follow'
};
{' '}
fetch("URL_BASE/ws/util.py/affiliates?country_code=MX&id_usuario=4532&id_sesion=413-JRdxDQvO-zPMcwLeptmOyA==",
requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
CURL:
curl --location --request GET{' '}
'URL_BASE/ws/util.py/affiliates?country_code=MX&id_usuario=4532&id_sesion=413-JRdxDQvO-zPMcwLeptmOyA%3D%3D'
Business logic:
By means of this service all the affiliates of the system are obtained.