Upload a list of contacts to Burst SMS


Parameter

Description

Required

nameName of the listYES
file_urlURL location of the contact list (NB: The list you are uploading requires a column labelled mobile)YES
field_nAdds custom fields to the list. NO
countrycodeSpecifies which country the numbers are to be formatted in (e.g AU). If uploading numbers for multiple countries, do not define this, you will need to ensure that all the numbers are in correct international format before upload.NO


Example


curl https://api.transmitsms.com/add-contacts-bulk.json \
  -u 2e24c1cbdd987221e165d543f34b84bf:secret \
  -d 'name=1012' \
  -d 'field_1=email' \
  -d 'field_2=address' \
  -d 'countrycode=AU' \
  -d 'file_url=http://yoururl.com/list.csv'


JSON Response

XML Response



{
    list_id: 123,
    error: {
        code: "SUCCESS",
        description: "OK"
    }
}


<?xml version="1.0"encoding="UTF-8"?>
<response>
  <list_id>123</list_id>
  <error>
    <code>SUCCESS</code>
    <description>OK</description>
  </error>
</response>


PHP Example


<?php
 include'../../APIClient2.php';
 $api=new transmitsmsAPI("API_KEY",'API_SECRET');
 
 $listName='contact LIST 1';
 $fileUrl='http://yoururl.com/list.csv';
 $customFields=array("email","address");
 $countryCode='AU';
 
 // Add contacts bulk
 $result=$api->addContactsBulk($listName, $fileUrl, $customFields, $countryCode);
 if($result->error->code=='SUCCESS')
 {
     echo 'List Created with ID ' . $result->list_id . ". Please check your upload progress.";
 }
 else
 {
     echo 'Error: ' .$result->error->description;
 }
 ?>


 


Check upload progress


Example


curl https://api.transmitsms.com/add-contacts-bulk-progress.json?list_id=23 \
  -u 2e24c1cbdd987221e165d543f34b84bf:secret 

JSON Response



XML Response



{
    list_id: 23,
    status: "completed",
    importlength: 2,
    completed: 2,
    duplicates: 0,
    skipped: 1,
    optout: 0,
    imported: 1,
    error:{
        code: "SUCCESS",
        description: "OK"
    }
}


<?xml version="1.0"encoding="UTF-8"?>
<response>
  <list_id>123</list_id>
  <status>completed</status>
  <importlength>2</importlength>
  <completed>2</completed>
  <duplicates>0</duplicates>
  <skipped>1</skipped>
  <optout>0</optout>
  <imported>1</imported>
  <error>
    <code>SUCCESS</code>
    <description>OK</description>
  </error>
</response>


PHP Example


<?php
 include'../../APIClient2.php';
 $api=new transmitsmsAPI("API_KEY",'API_SECRET');
 
 $listID=123;
 $result=$api->addContactsBulkProgress($listID);
 if($result->error->code=='SUCCESS')
 {
     echo var_export($result,true);
 }
 else
 {
     echo 'Error: ' .$result->error->description;
 }
 ?>