MOR API autodialer upload numbers

From Kolmisoft Wiki
Revision as of 06:24, 3 June 2020 by Gilbertas (talk | contribs)
Jump to navigationJump to search

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 for which belongs campgain. 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


Example:

<?xml version="1.0" encoding="UTF-8"?>
<page>
  <error>Error message</error>
</page>



See also