Required parameters for the request:
API-request address: https://api.ringostat.net/calls/list;
The format of the requests — json or csv;
Method of the data export — GET;
Auth-key.
Example for Node.js:
const https = require('https');
const config = {
host: 'api.ringostat.net',
path: '/calls/list?export_type=json&from=2019-06-01%2000:00:00&to=2019-06-18%2023:59:59­&fields=calldate,caller,dst,disposition,billsec,utm_source,utm_medium,recording',
method: 'GET',
headers: {
'Content-Type': 'application/json',
'Auth-key': 'unique_auth_key_value'
}
};
const callback = response => {
let result = Buffer.alloc(0);
response.on('data', chunk => {
result = Buffer.concat([ result, chunk ]);
});
response.on('end', () => {
//handle response
})
};
const request = https.request(config, callback);
request.end();
Example for Axios.js:
const axios = require('axios');
axios({
url: 'https://api.ringostat.net/calls/list',
method: 'GET',
headers: {
'Content-Type': 'application/json; charset=utf-8',
'Auth-key': 'unique_auth_key_value'
},
params: JSON.stringify({
'export_type': 'json',
'from': '2019-06-01 00:00:00',
'to': '2019-06-18 23:59:59',
'fields': 'calldate,caller,dst,disposition,billsec,utm_source,utm_medium,recording'
})
}).then(response => {
//handle response
}).catch(error => {
//handle error
})
Example for cURL:
curl "https://api.ringostat.net/calls/list?export_type=json&from=2019-06-01 00:00:00&to=2019-06-18 23:59:59&fields=calldate,caller,dst,disposition,billsec,utm_source,utm_medium,recording" \
-H "Content-Type: application/json" \
-H "Auth-key: unique_auth_key_value"
Result:
Testing
You can see what the request looks like in different programming languages on the page https://ringostat.readme.io/reference/get_calls-list
You can also specify the necessary parameters (1) and Auth-key (2) there and send a test request (3):