174 lines
3.9 KiB
Markdown
174 lines
3.9 KiB
Markdown
This service is used to obtain the user information
|
|
|
|
GET: {' '}
|
|
`URL_BASE + /ws/users.py/info_usuario`
|
|
|
|
## 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:
|
|
|
|
```javascript
|
|
{
|
|
"status"
|
|
: <boolean>
|
|
,
|
|
"user_id"
|
|
: <integer>
|
|
,
|
|
"number_of_transactions"
|
|
: <integer>
|
|
,
|
|
"amount_of_transactions"
|
|
: <integer>
|
|
,
|
|
"point_program"
|
|
:{' '}
|
|
[
|
|
{
|
|
'name': <string>
|
|
, 'amount'
|
|
: <decimal>
|
|
, 'id'
|
|
: <integer>
|
|
}
|
|
]
|
|
,
|
|
"elapsed"
|
|
: <float>
|
|
}
|
|
```
|
|
|
|
## Where:
|
|
|
|
* `status:` Shows if the call has been successful (true) or not (false).
|
|
* `user_id:` Identifier of the user from whom we have obtained the information.
|
|
* `number_of_transactions:` Number of transactions of the indicated type in the last 30 days.
|
|
* `amount_of_transactions:` Total amount of transactions of the indicated type of the last 30 days.
|
|
* `point_program:` List with the point programs in which the user is.
|
|
* `name:` Points program name.
|
|
* `amount:` User points in the points program.
|
|
* `id:` Points program identifier.
|
|
* `elapsed:` Operation execution time.
|
|
|
|
### Answer JSON KO:
|
|
|
|
```javascript
|
|
{
|
|
"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:
|
|
|
|
```javascript
|
|
import requests
|
|
url ={' '}
|
|
|
|
"URL_BASE/ws/users.py/info_usuario?country_code=MX&user_id=4532&session_id=415-MFQPMQrBP98hxkttN2VYuA==&user=7229063245&point_of_entry=solicituddinero"
|
|
|
|
payload ={' '}
|
|
{
|
|
}
|
|
files ={' '}
|
|
{
|
|
}
|
|
headers={' '}
|
|
{
|
|
}
|
|
response = requests
|
|
.request
|
|
(
|
|
"GET"
|
|
, url
|
|
, headers
|
|
=headers
|
|
, data{' '}
|
|
= payload
|
|
, files{' '}
|
|
= files
|
|
)
|
|
print
|
|
(response
|
|
.text
|
|
.encode
|
|
(
|
|
'utf8'
|
|
)
|
|
)
|
|
```
|
|
|
|
### NodeJs - Request:
|
|
|
|
```javascript
|
|
var request = require('request');
|
|
var options = {
|
|
'method': 'GET',
|
|
'url':
|
|
'URL_BASE/ws/users.py/info_usuario?country_code=MX&user_id=4532&session_id=415-MFQPMQrBP98hxkttN2VYuA==&user=7229063245&point_of_entry=solicituddinero',
|
|
'headers': {},
|
|
formData: {}
|
|
};
|
|
request(options, function (error, response) {{' '}
|
|
if (error) throw new Error(error);
|
|
console.log(response.body);
|
|
});
|
|
```
|
|
|
|
### JavaScript - Fetch:
|
|
|
|
```javascript
|
|
var formdata = new FormData();
|
|
var requestOptions = {
|
|
method: 'GET',
|
|
body: formdata,
|
|
redirect: 'follow'
|
|
};
|
|
{' '}
|
|
fetch("URL_BASE/ws/users.py/info_usuario?country_code=MX&user_id=4532&session_id=415-MFQPMQrBP98hxkttN2VYuA==&user=7229063245&point_of_entry=solicituddinero",
|
|
requestOptions)
|
|
.then(response => response.text())
|
|
.then(result => console.log(result))
|
|
.catch(error => console.log('error', error));
|
|
```
|
|
|
|
### CURL:
|
|
|
|
```javascript
|
|
curl --location --request GET{' '}
|
|
|
|
'URL_BASE/ws/users.py/info_usuario?country_code=MX&user_id=4532&session_id=415-MFQPMQrBP98hxkttN2VYuA%3D%3D&user=7229063245&point_of_entry=solicituddinero'
|
|
```
|
|
|
|
## Business logic:
|
|
|
|
By means of this service the data of the user indicated with the indicated
|
|
parameter is obtained.
|