Difference between revisions of "MOR API autodialer upload numbers"
From Kolmisoft Wiki
Jump to navigationJump to search
(Created page with '=Description= MOR API Autodialer upload numbers <br><br> =Usage= * Call: /api/autodialer_upload_numbers * Methods: POST <br><br> ===Parameters=== Parameters which are '''…') |
|||
(3 intermediate revisions by the same user not shown) | |||
Line 2: | Line 2: | ||
[[MOR API]] Autodialer upload numbers | [[MOR API]] Autodialer upload numbers | ||
<br><br> | <br><br> | ||
Upload numbers from CSV file to existing Autodialer Campaign. | |||
=Usage= | =Usage= | ||
* Call: /api/autodialer_upload_numbers | * Call: '''/api/autodialer_upload_numbers''' | ||
* Methods: POST | * Methods: POST | ||
<br><br> | <br><br> | ||
Line 12: | Line 13: | ||
Parameters which are '''included''' into hash: | Parameters which are '''included''' into hash: | ||
* id - campgain id.'''Required'''. | * id - campgain id. '''Required'''. | ||
<br><br> | <br><br> | ||
Parameters which are '''not included''' into hash: | Parameters which are '''not included''' into hash: | ||
* '''[[MOR API hash construction | hash]]''' - SHA1 hash constructed using '''parameters''' which are listed above. Note that parameters are shown in the same order as they have to be when generating the hash. Last parameter in a row is '''API_Secret_Key''' ([[MOR API hash construction | More described in Constructing hash]]). '''Required'''.<br> | * '''[[MOR API hash construction | hash]]''' - SHA1 hash constructed using '''parameters''' which are listed above. Note that parameters are shown in the same order as they have to be when generating the hash. Last parameter in a row is '''API_Secret_Key''' ([[MOR API hash construction | More described in Constructing hash]]). '''Required'''.<br> | ||
* '''u''' - simple user | * '''u''' - simple user under which campgain is created. '''Required'''. | ||
* '''file''' - filename for CSV file to upload. Must be sent as POST message using Content-Type multipart/form-data | * '''file''' - filename for CSV file to upload. Must be sent as POST message using Content-Type multipart/form-data | ||
<br><br> | <br><br> | ||
Line 73: | Line 74: | ||
*Please provide a file - file parameter is missing | *Please provide a file - file parameter is missing | ||
*Please provide CSV file - file extension does not end in .csv | *Please provide CSV file - file extension does not end in .csv | ||
*Campaign was not found | |||
*Incorrect hash | |||
*Access Denied | |||
*You are not authorized to use this functionality | |||
Latest revision as of 07:38, 3 June 2020
Description
MOR API Autodialer upload numbers
Upload numbers from CSV file to existing Autodialer Campaign.
Usage
- Call: /api/autodialer_upload_numbers
- Methods: POST
Parameters
Parameters which are included into hash:
- id - campgain id. Required.
Parameters which are not included into hash:
- hash - SHA1 hash constructed using parameters which are listed above. Note that parameters are shown in the same order as they have to be when generating the hash. Last parameter in a row is API_Secret_Key ( More described in Constructing hash). Required.
- u - simple user under which campgain is created. Required.
- file - filename for CSV file to upload. Must be sent as POST message using Content-Type multipart/form-data
Request
We have user = campgain_user, id = 1, API Secret Key = secret, and file = number.csv with content like this:
123456789 222222222 333333333 444444444 555555555 666666666 777777777
Example using curl:
curl -F "file=@numbers.csv" "http://192.168.99.100/billing/api/autodialer_upload_numbers?u=campgain_user&id=1&hash=bc2f114099d16656d37e45fd9e8744cb9386d462"
Example using Node.js
var fs = require('fs'); var request = require('request'); request.post({ url: 'http://192.168.99.100/billing/api/autodialer_upload_numbers', formData: { file: fs.createReadStream('numbers.csv'), u: 'campgain_user', id: 1, hash: 'bc2f114099d16656d37e45fd9e8744cb9386d462' }, }, function(error, response, body) { console.log(body); });
Returns
Success <?xml version="1.0" encoding="UTF-8"?> <page>
<status> <success>7 out of 7 numbers were imported</success> </status>
</page>
Errors
- File is empty - uploaded file is empty (file size is 0);
- Please provide a file - file parameter is missing
- Please provide CSV file - file extension does not end in .csv
- Campaign was not found
- Incorrect hash
- Access Denied
- You are not authorized to use this functionality
Example:
<?xml version="1.0" encoding="UTF-8"?> <page> <error>Error message</error> </page>