i
API DEVELOPER'S GUIDE
Integration Language:   PHP
The ZINSAI SDK includes methods for all requests required to create/modify contact lists, create/update contacts, and add/remove contacts from specific lists. All requests require an API "public_key", and "private_key" which can be generated from within your ZINSAI account. Sending methods additionally require an AuthToken which is generated at the time of the request on your server.

This guide will walk you through the steps required to configure the SDK on your server, and to begin using it's methods inside your PHP scripts.

Download Our SDK To Get Started
PHP SDK v.1.4

API Endpoint:
https://www.zinsai.com/rEnd/gateway.php
After downloading the SDK, upload the file zinSDK.php to a directory on your server. The location is not important, as long as you can access it from your PHP script.
require_once('zinSDK.php');


Begin a new session by calling the zin class from the SDK.
$zin = new zin();


RETURNS
STATUS MESSAGE
FAIL DETAIL
SUCCESS DETAIL
$result = $zin->setCredentials('public_key','private_key');
RETURNS
STATUS MESSAGE LISTID
FAIL DETAIL 0
SUCCESS DETAIL ID


Email & SMS can both co-exist on same list space, either tied to the same contact or separate entries.
$result = $zin->createList('Public List Name');
RETURNS
STATUS MESSAGE CONTACTID
FAIL DETAIL 0
SUCCESS DETAIL ID


Will return FAIL on duplicate email or mobile number.
$result = $zin->createContact(array(
"first_name" => 'First Name',
"last_name" => 'Last Name',
"address_1" => 'Address 1',
"address_2" => 'Address 2',
"city" => 'City',
"state" => 'State',
"zipcode" => 'Zipcode',
"country" => 'Country',
"email" => 'Email',
"mobile" => 'Mobile'
));
RETURNS
STATUS MESSAGE CONTACTS
FAIL DETAIL 0
SUCCESS DETAIL array(id1,id2,id3,...)
$result = $zin->searchContacts('Method','Query String');
RETURNS
STATUS MESSAGE CONTACT
FAIL DETAIL 0
SUCCESS DETAIL array(
"first_name" => 'First Name',
"last_name" => 'Last Name',
"address_1" => 'Address 1',
"address_2" => 'Address 2',
"city" => 'City',
"state" => 'State',
"zipcode" => 'Zipcode',
"country" => 'Country',
"email" => 'Email',
"mobile" =>'Mobile'
"lists" =>array(ListID,ListID,...)
)
$result = $zin->fetchContact('ContactID');
RETURNS
STATUS MESSAGE CONTACT
FAIL DETAIL 0
SUCCESS DETAIL array(
"first_name" => 'First Name',
"last_name" => 'Last Name',
"address_1" => 'Address 1',
"address_2" => 'Address 2',
"city" => 'City',
"state" => 'State',
"zipcode" => 'Zipcode',
"country" => 'Country',
"email" => 'Email',
"mobile" =>'Mobile'
)
$result = $zin->updateContact('Contact ID', array(
"first_name" => 'First Name',
"last_name" => 'Last Name',
"address_1" => 'Address 1',
"address_2" => 'Address 2',
"city" => 'City',
"state" => 'State',
"zipcode" => 'Zipcode',
"country" => 'Country',
"email" => 'Email',
"mobile" => 'Mobile'
));
RETURNS
STATUS MESSAGE
FAIL DETAIL
SUCCESS DETAIL


Will return SUCCESS on existing associations.
$result = $zin->addContactToList('ContactID','ListID');
RETURNS
STATUS MESSAGE
FAIL DETAIL
SUCCESS DETAIL


Will return FAIL on no entry found.
$result = $zin->removeContactFromList('ContactID','ListID');
RETURNS
STATUS MESSAGE MESSAGEID
FAIL DETAIL 0
SUCCESS DETAIL ID
$timecode = time();
$authInfo = $timecode . ':' . md5($timecode . 'private_key');
$result = $zin->sendSMS('ListID', $authInfo, array(
"senderid" => 'SenderId',
"message" => 'Message Contents'
));
RETURNS
STATUS MESSAGE MESSAGEID
FAIL DETAIL 0
SUCCESS DETAIL ID
$result = $zin->sendEmailToContact('ContactID', array(
"senderid" => 'SenderId',
"subject" => 'Subject',
"preview" => 'Preview',
"textVersion" => 'Text Version Of Message',
"htmlVersion" => 'HTML Version Of Message'
));
RETURNS
STATUS MESSAGE MESSAGEID
FAIL DETAIL 0
SUCCESS DETAIL ID
$timecode = time();
$authInfo = $timecode . ':' . md5($timecode . 'private_key');
$result = $zin->sendEmailToList('ListID', $authInfo, array(
"senderid" => 'SenderId',
"subject" => 'Subject',
"preview" => 'Preview',
"textVersion" => 'Text Version Of Message',
"htmlVersion" => 'HTML Version Of Message'
));