====== API - Import Contacts ====== This API method allows you to send an XML-formatted list of Contacts to Sentori, which will then be imported into your database. It is intended for the bulk import of contacts; if you wish to integrate a signup process you should use the [[api-contact-signup|API Contact Signup]] method. [[api|Other Sentori API methods]] ===== Request ===== |Post|https://api.sentoriapp.com/v1/contacts.asmx/Import| |Required Headers|Content-Type: application/xml, Content-Length: , ApiKey: | |Optional Headers|Accept-Encoding: Gzip (indicates to the API that it can compress the Response), Audience-Name: (Name of the Audience created by importing the contacts), Audience-Description: (Description of the Audience created by importing the contacts), Content-Encoding: Gzip (set this if your application has compressed the XML in your Request body; makes transfer of the data faster)| |XML Structure| user@domain.com Mr Joe Bloggs | ===== Response ===== |Body|Empty| |Headers|201 Created, Total-Rows: , Emailable-Rows-Created: , Emailable-Rows-Updated: , Suppressed-Rows-Updated: , Bad-Email-Address-Rows-Updated: , Excluded-Duplicates: , Excluded-Invalid-Emails: , Excluded-Role-Based: | |Errors|400 Failed To Match Email Address Field, 400 Failed To Match All Fields, 403 Invalid API Key, 409 A Contact Import Is Already In Progress| ===== Example HTTP Transaction ===== POST https://api.sentoriapp.com/v1/contacts.asmx/Import HTTP/1.1 content-type: application/xml apikey: e9614e92-1999-441a-89b7-707b1542c642 Content-Length: 161 audience-name: Test API Audience audience-description: This is a test upload via the API with an audience name and description user@domain.com Mr Joe Bloggs HTTP/1.1 201 Created Total-Rows: 1 Emailable-Rows-Created: 1 Emailable-Rows-Updated: 0 Suppressed-Rows-Updated: 0 Bad-Email-Address-Rows-Updated: 0 Excluded-Duplicates: 0 Excluded-Invalid-Emails: 0 Excluded-Role-Based: 0 ===== PHP Example ===== Note that this PHP example is downloadable. user@domain.com Mr Joe Bloggs user2@domain.com Mr Kis Ja '; $c = curl_init(); curl_setopt($c, CURLOPT_URL, $url); curl_setopt($c, CURLOPT_RETURNTRANSFER, true); curl_setopt($c, CURLOPT_HEADER, true); curl_setopt($c, CURLOPT_HTTPHEADER, array('Content-Type: application/xml','apikey:'.$apikey, 'Content-length: '.strlen($xml))); curl_setopt($c, CURLOPT_POST, true); curl_setopt($c, CURLOPT_POSTFIELDS, $xml); curl_setopt($c, CURLOPT_TIMEOUT, (int)30); $xmlResponse = curl_exec($c); curl_close ($c); echo '
Output ::
'.$xmlResponse; ?>
===== Important Notes ===== - The "widest" Contact will dictate the Properties that exist for all Contacts in an Import. If a Contact is missing a Property, a blank value will be used for them. - Imported blank values will replace existing non-blank values on a Contact.