3.4 KiB
3.4 KiB
ws/orders.py/close
Receives
All the parameters that the service receives must be indicated in the body of the request.
Returns:
Depending on the result of the operation, this service can return two different JSON:
{
"status"
:{' '}
true
,
"codtran"
:{' '}
"850c29598f8ceae89e7083d1547faa29"
,
"result"
:{' '}
"120d29398f8ceae89e707ad1547fa12c"
"elapsed"
:{' '}
0.12410902976989746
}
Where:
status:Shows if the call has been successful (true) or not (false).codtran:Operation result.result:Code of the transaction that cancels the order.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 ={' '}
"http://34.121.95.179:80/ws/orders.py/close?country_code=ES&user_id=133&session_id=1689-oocyMaFovWi1jljrF-eaSw=="
payload=
{
}
headers ={' '}
{
'101ObexApiKey'
:{' '}
'MS1phGJRa3WyLilN9dlZ7vurJDIpe0nM'
}
response = requests
.request
(
"GET"
, url
, headers
=headers
, data
=payload
)
print
(response
.text
)
NodeJs - Request:
var request = require('request');
var options = {
'method': 'GET',
'url':
'http://34.121.95.179:80/ws/orders.py/close?country_code=ES&user_id=133&session_id=1689-oocyMaFovWi1jljrF-eaSw==',
'headers': {
'101ObexApiKey': 'MS1phGJRa3WyLilN9dlZ7vurJDIpe0nM'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
JavaScript - Fetch:
var myHeaders = new Headers();
myHeaders.append("101ObexApiKey",
"MS1phGJRa3WyLilN9dlZ7vurJDIpe0nM");
var requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("http://34.121.95.179:80/ws/orders.py/close?country_code=ES&user_id=133&session_id=1689-oocyMaFovWi1jljrF-eaSw==",
requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
CURL:
curl --location --request GET{' '}
'http://34.121.95.179:80/ws/orders.py/close?country_code=ES&user_id=133&session_id=1689-oocyMaFovWi1jljrF-eaSw=='
{' '}
\
--header{' '}
'101ObexApiKey: MS1phGJRa3WyLilN9dlZ7vurJDIpe0nM'
Business logic:
The objective of this service is to permit an administrator close an order.