Sensorpro API - Working with Contacts

 Working with Contacts

Last updated: July 27th 2018

Overview

This section covers how to add and update contacts in Sensorpro. Note that all of these operations require a token - see the authentication section for more information.

UpdateAdd

A combined add/update operation. Firstly, an attempt is made to update the contact. If this fails because the contact does not exist, then it is added as a new contact to the database. This is the most efficient way to add contacts.

UpdateAdd Endpoint
Method: POST
https://apinie.sensorpro.net/api/Contact/UpdateAdd/[Token]

Copy to Clipboard

  • [Token] - replace with the access token returned by the login.
Header Values
Header Example Description
Content-Type application/json  

Request Body

{
   "AddToList": [
      "ListA",
      "ListB"],
   "Contact": [
      {
         "FirstName": "Test First Name",
         "LastName": "Test Last Name",
         "PersonalEMail": "sampleaddress1@gmail.com"
      },
      {
         "FirstName": "Test First Name",
         "LastName": "Test Last Name",
         "PersonalEMail": "sampleaddress2@gmail.com"
      }
   ],
   "Options":{"Parameters":{},"Action":""},
   "ReturnFailedRequests": false,
   "UpdateByKey": "email",
   "SendWelcomeEmail": false,
   "SignupFormId":"00000000-0000-0000-0000-000000000000"
}

Input Parameters

    • AddToList (array): array of tags.
      • AddToList - Array of tags which will be applied to the contact when it is created. "AddToList": ["ListA","ListB"]
    • Contact (array): array of contact records to add update.
      • Required values
      • Personalemail - email address
      • Optional Fields
      • Title - Contact title
      • FirstName - First name
      • LastName - Last name
      • Gender - Gender
      • DateofBirth - Date of birth
      • DateOfLastPurchase - Date of last purchase
      • PersonalEmail1 - Personal email address 1
      • BusinessEmail - Business email address
      • BusinessEmail1 - Business email address 1
      • PhoneHome - Home phone number
      • PhoneBusiness - Business phone number
      • PhoneMobile - Mobile phone (this is the number used for SMS)
      • Pager - Pager id
      • BusinessFax - Business fax number
      • HomeFax - Home Fax
      • PhoneOther - Phone Other
      • PerStreet - Home Address
      • PerStreet1 - Home Address
      • PerCity - Home Address
      • PerState - Home Address
      • PerZip - Home Address
      • PerCountry - Home Address
      • BusName - Business Name
      • BusStreet - Business Address
      • BusStreet1 - Business Address
      • BusCity - Business Address
      • BusState - Business Address
      • BusZip - Business Address
      • BusCountry - Business Address
      • BusWebSite - Business Address
      • GroupByIndustry - Group by industry type
      • GroupBy1 - Alternative group by
      • GroupBy2 - Alternative group by
      • GroupBy3 - Alternative group by
      • MessagePreference - Message preference HTML / TEXT
      • JobTitle - Job title
      • Categories - Array of newsletter categories which the contact will be assigned when created
      • CategoriesUnselected - Array of categories to be removed from contact if updating contact
      • OptOut - Email optout status; -10 unsubscribed, 0 subscribed
      • SMSOptOut - SMS optout status; -10 unsubscribed, 0 subscribed, -5 Pending Opt-in
      • Status - 0 Active, 20 Inactive, -10 Bounced Rejected
      • SMSStatus - 0 Active, -10 Bounced Rejected
      • ImportName - Source of contact
      • InFix - Middle prefix
      • YearlyPurchase - Total of yearly purchase
      • UserChar2 - User character field maxlength(100)
      • UserChar3 - User character field maxlength(100)
      • UserChar4 - User character field maxlength(100)
      • UserChar5 - User character field maxlength(100)
      • UserChar6 - User character field maxlength(100)
      • UserChar7 - User character field maxlength(100)
      • UserChar8 - User character field maxlength(100)
      • UserChar9 - User character field maxlength(100)
      • UserChar10 - User character field maxlength(100)
      • UserChar11 - User character field maxlength(100)
      • UserChar12 - User character field maxlength(100)
      • UserChar13 - User character field maxlength(100)
      • UserChar14 - User character field maxlength(100)
      • UserChar15 - User character field maxlength(100)
      • Date1 - User date format yyyy-mm-dd hh:mm:ss
      • Date2 - User date format yyyy-mm-dd hh:mm:ss
      • Date3 - User date format yyyy-mm-dd hh:mm:ss
      • Date4 - User date format yyyy-mm-dd hh:mm:ss
      • Date5 - User date format yyyy-mm-dd hh:mm:ss
      • Num1 - User number integer
      • Num2 - User number integer
      • Num3 - User number integer
      • Num4 - User number integer
      • Num5 - User number integer
    • Options (object) special options
      • Action (String) set to blank
    • ReturnFailedRequests (bool) - if true, failed requests are returned in the failed requests array. Only use this if required as it will reduce throughput and bloat the response object.
    • UpdateByKey (string) what key should be used to perform the update. Blank means native key. If updating using
      • Foreign / external key: “extlinkid”
      • Email address: “email”
      • Blank native key: contactid
    • SendWelcomeEmail This should be set to “true” if this is a new registration as it triggers the following processes:
      • Welcome email if setup
      • New signup audit record is created
    • SignupFormId This is the signup form ID which contains the welcome email design and settings. This must be setup through the web interface. This should be set to false, if using the API to mass import contacts form another system.
Response

    {
    "UpdateCount": 0,
    "NoChangeCount": 2,
    "AddCount": 0,
    "FailedRequests": [],
    "Result": {
        "RequestId": "0027b926-bcc3-4139-a4a8-e9f94e76ab30",
        "ErrorMessages": [],
        "StatusMesssages": [],
        "TotalStatusMessages": 0,
        "TotalErrors": 0
        }
    }
Response Values:
  • UpdateCount - Number of contacts updated.
  • AddCount - Number of contacts added.
  • NoChangeCount - Number of contacts not changed because there was no change in the data.
Sample Code:
                                                
var client = new RestClient("https://apinie.sensorpro.net/api/Contact/UpdateAdd/[Token]");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("undefined", "{
                                     \"AddToList\": [\"ListA\",\"ListB\"], 
                                     \"Contact\": [ { \"FirstName\": \"Test First Name\",\"LastName\": \"Test Last Name\",\"PersonalEMail\": \"sampleaddress@acme.com\"}],
                                     \"Options\":{\"Parameters\":{},\"Action\":\"\"},   \"ReturnFailedRequests\": false,   \"UpdateByKey\": \"email\",   \"SendWelcomeEmail\": false,   \"SignupFormId\":\"00000000-0000-0000-0000-000000000000\"}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
                                                
                                                
                                                
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => "https://apinie.sensorpro.net/api/Contact/UpdateAdd/[Token]",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_POSTFIELDS => "{\"AddToList\": [   \"ListA\",   \"ListB\"],
    \"Contact\": [   {      \"FirstName\": \"Test First Name\",      \"LastName\": \"Test Last Name\",      \"PersonalEMail\": \"sampleaddress@acme.com\"   }],
    \"Options\":{\"Parameters\":{},\"Action\":\"\"},\"ReturnFailedRequests\": false,\"UpdateByKey\": \"email\",\"SendWelcomeEmail\": false,\"SignupFormId\":\"00000000-0000-0000-0000-000000000000\"}",
    CURLOPT_HTTPHEADER => array(
    "Content-Type: application/json"
    ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
                                                
                                                
                                                
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"AddToList\": [   \"ListA\",   \"ListB\"],\"Contact\": [   {      \"FirstName\": \"Test First Name\",      \"LastName\": \"Test Last Name\",      \"PersonalEMail\": \"sampleaddress@acme.com\"   }],\"Options\":{\"Parameters\":{},\"Action\":\"\"},\"ReturnFailedRequests\": false,\"UpdateByKey\": \"email\",\"SendWelcomeEmail\": false,\"SignupFormId\":\"00000000-0000-0000-0000-000000000000\"}");
Request request = new Request.Builder()
.url("https://apinie.sensorpro.net/api/Contact/UpdateAdd/[Token]")
.post(body)
.addHeader("Content-Type", "application/json")
.build();

Response response = client.newCall(request).execute();
                                                
                                                

UpdateAddAsync

A combined add/update operation. This differs in that it queues the data on the server to be processed. The API call returns immediately and the contacts are processed on the server at a later point. This should be used in conjunction with “AddUpdateAsyncStatus” - this checks the status of the batch.

UpdateAddAsync Endpoint
Method: POST
https://apinie.sensorpro.net/api/Contact/UpdateAddAsync/[Token]

Copy to Clipboard

  • [Token] - replace with the access token returned by the login.
Header Values
Header Example Description
Content-Type application/json  

Request Body

{
   "AddToList": [
      "ListA",
      "ListB"],
   "Contact": [
      {
         "FirstName": "Test First Name",
         "LastName": "Test Last Name",
         "PersonalEMail": "sampleaddress1@gmail.com"
      },
      {
         "FirstName": "Test First Name",
         "LastName": "Test Last Name",
         "PersonalEMail": "sampleaddress2@gmail.com"
      }
   ],
   "Options":{"Parameters":{},"Action":""},
   "ReturnFailedRequests": false,
   "UpdateByKey": "email",
   "SendWelcomeEmail": false,
   "SignupFormId":"00000000-0000-0000-0000-000000000000"
}

Input Parameters

    • AddToList (array): array of tags.
      • AddToList - Array of tags which will be applied to the contact when it is created. "AddToList": ["ListA","ListB"]
    • Contact (array): array of contact records to add update.
      • Required values
      • Personalemail - email address
      • Optional Fields
      • Title - Contact title
      • FirstName - First name
      • LastName - Last name
      • Gender - Gender
      • DateofBirth - Date of birth
      • DateOfLastPurchase - Date of last purchase
      • PersonalEmail1 - Personal email address 1
      • BusinessEmail - Business email address
      • BusinessEmail1 - Business email address 1
      • PhoneHome - Home phone number
      • PhoneBusiness - Business phone number
      • PhoneMobile - Mobile phone (this is the number used for SMS)
      • Pager - Pager id
      • BusinessFax - Business fax number
      • HomeFax - Home Fax
      • PhoneOther - Phone Other
      • PerStreet - Home Address
      • PerStreet1 - Home Address
      • PerCity - Home Address
      • PerState - Home Address
      • PerZip - Home Address
      • PerCountry - Home Address
      • BusName - Business Name
      • BusStreet - Business Address
      • BusStreet1 - Business Address
      • BusCity - Business Address
      • BusState - Business Address
      • BusZip - Business Address
      • BusCountry - Business Address
      • BusWebSite - Business Address
      • GroupByIndustry - Group by industry type
      • GroupBy1 - Alternative group by
      • GroupBy2 - Alternative group by
      • GroupBy3 - Alternative group by
      • MessagePreference - Message preference HTML / TEXT
      • JobTitle - Job title
      • Categories - Array of newsletter categories which the contact will be assigned when created
      • CategoriesUnselected - Array of categories to be removed from contact if updating contact
      • OptOut - Email optout status; -10 unsubscribed, 0 subscribed
      • SMSOptOut - SMS optout status; -10 unsubscribed, 0 subscribed, -5 Pending Optin
      • Status - 0 Active, 20 Inactive, -10 Bounced Rejected
      • SMSStatus - 0 Active, -10 Bounced Rejected
      • ImportName - Source of contact
      • InFix - Middle prefix
      • YearlyPurchase - Total of yearly purchase
      • UserChar2 - User character field maxlength(100)
      • UserChar3 - User character field maxlength(100)
      • UserChar4 - User character field maxlength(100)
      • UserChar5 - User character field maxlength(100)
      • UserChar6 - User character field maxlength(100)
      • UserChar7 - User character field maxlength(100)
      • UserChar8 - User character field maxlength(100)
      • UserChar9 - User character field maxlength(100)
      • UserChar10 - User character field maxlength(100)
      • UserChar11 - User character field maxlength(100)
      • UserChar12 - User character field maxlength(100)
      • UserChar13 - User character field maxlength(100)
      • UserChar14 - User character field maxlength(100)
      • UserChar15 - User character field maxlength(100)
      • Date1 - User date format yyyy-mm-dd hh:mm:ss
      • Date2 - User date format yyyy-mm-dd hh:mm:ss
      • Date3 - User date format yyyy-mm-dd hh:mm:ss
      • Date4 - User date format yyyy-mm-dd hh:mm:ss
      • Date5 - User date format yyyy-mm-dd hh:mm:ss
      • Num1 - User number integer
      • Num2 - User number integer
      • Num3 - User number integer
      • Num4 - User number integer
      • Num5 - User number integer
    • Options (object) special options
      • Action (String) set to blank
    • ReturnFailedRequests (bool) - if true, failed requests are returned in the failed requests array. Only use this if required as it will reduce through put and bloat response object.
    • UpdateByKey (string) what key should be used to perform the update. Blank means native key. If updating using
      • Foreign / external key: “extlinkid”
      • Email address: “email”
      • Blank native key: contactid
    • SendWelcomeEmail This should be set to “true” if this is a new registration as it triggers the following processes:
      • Welcome email if setup
      • New signup audit record is created
    • SignupFormId This is the signup form id which contains the welcome email design and settings. This must be setup through the web interface. This should be set to false, if using the API to mass import contacts form another system.
Response

    {
    "UpdateCount": 0,
    "NoChangeCount": 0,
    "AddCount": 0,
    "FailedRequests": [],
    "Result": {
    "RequestId": "e577737c-0544-4732-ae24-0e0d9a4a8037",
    "ErrorMessages": [],
    "StatusMesssages": [
            {
            "Code": "rest-0",
            "Description": "Contact data will be imported asynchronously use GetUpdateAddAsyncStatus to check status of batch ",
            "Sequence": 0
            }
    ],
    "TotalStatusMessages": 1,
    "TotalErrors": 0
    }
    }
Response Values:
  • UpdateCount - Will always show 0 as this task is asynchronous.
  • AddCount - Will always show 0 as this task is asynchronous.
  • NoChangeCount - Will always show 0 as this task is asynchronous.
  • RequestId - Use the requestid in association with the GetUpdateAddAsyncStatus to check the status of the task. This can also be checked through the UI menu Admin > Setup > API Async Import Queue.
Sample Code:
                                                
var client = new RestClient("https://apinie.sensorpro.net/api/Contact/UpdateAddAsync/[Token]");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("undefined", "{
\"AddToList\": [\"ListA\",\"ListB\"],
\"Contact\": [ { \"FirstName\": \"Test First Name\",\"LastName\": \"Test Last Name\",\"PersonalEMail\": \"sampleaddress@acme.com\"}],
\"Options\":{\"Parameters\":{},\"Action\":\"\"},   \"ReturnFailedRequests\": false,   \"UpdateByKey\": \"email\",   \"SendWelcomeEmail\": false,   \"SignupFormId\":\"00000000-0000-0000-0000-000000000000\"}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
                                                
                                                
                                                
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
CURLOPT_URL => "https://apinie.sensorpro.net/api/Contact/UpdateAddAsync/[Token]",
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_ENCODING => "",
        CURLOPT_MAXREDIRS => 10,
        CURLOPT_TIMEOUT => 30,
        CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
        CURLOPT_CUSTOMREQUEST => "POST",
        CURLOPT_POSTFIELDS => "{\"AddToList\": [   \"ListA\",   \"ListB\"],
        \"Contact\": [   {      \"FirstName\": \"Test First Name\",      \"LastName\": \"Test Last Name\",      \"PersonalEMail\": \"sampleaddress@acme.com\"   }],
        \"Options\":{\"Parameters\":{},\"Action\":\"\"},\"ReturnFailedRequests\": false,\"UpdateByKey\": \"email\",\"SendWelcomeEmail\": false,\"SignupFormId\":\"00000000-0000-0000-0000-000000000000\"}",
        CURLOPT_HTTPHEADER => array(
        "Content-Type: application/json"
    ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
                                                
                                                

    OkHttpClient client = new OkHttpClient();

    MediaType mediaType = MediaType.parse("application/json");
    RequestBody body = RequestBody.create(mediaType, "{\"AddToList\": [   \"ListA\",   \"ListB\"],\"Contact\": [   {      \"FirstName\": \"Test First Name\",      \"LastName\": \"Test Last Name\",      \"PersonalEMail\": \"sampleaddress@acme.com\"   }],\"Options\":{\"Parameters\":{},\"Action\":\"\"},\"ReturnFailedRequests\": false,\"UpdateByKey\": \"email\",\"SendWelcomeEmail\": false,\"SignupFormId\":\"00000000-0000-0000-0000-000000000000\"}");
    Request request = new Request.Builder()
    .url("https://apinie.sensorpro.net/api/Contact/UpdateAddAsync/[Token]")
    .post(body)
    .addHeader("Content-Type", "application/json")
    .build();

    Response response = client.newCall(request).execute();

                                                

GetUpdateAddAsyncStatus

This is used to get the status of a submitted addupdateasync request. As addupdateasync API calls run asynchronously, the status of the request can be checked using this API call.

GetUpdateAddAsyncStatus Endpoint
Method: Post
https://apinie.sensorpro.net/api/Contact/GetUpdateAddAsyncStatus/[Token]

Copy to Clipboard

  • [Token] - replace with the access token returned by the login.
Header Values
Header Example Description
Content-Type application/json  

Request Body

                                        
{
  "Id":"e577737c-0544-4732-ae24-0e0d9a4a8037"
}
                                            
		

Input Parameters

  • ID (ID of Import)

Response


    {
        "UpdateCount": 0,
        "NoChangeCount": 0,
        "AddCount": 2,
        "FailedRequests": [],
        "Result": {
        "RequestId": "00000000-0000-0000-0000-000000000000",
        "ErrorMessages": [],
        "StatusMesssages": [
            {
            "Code": "StatusIs",
            "Description": "Status is Completed",
            "Sequence": 0
            }
        ],
        "TotalStatusMessages": 1,
        "TotalErrors": 0
        }
    }

Response Values:
  • UpdateCount - Number of contacts updated.
  • AddCount - Number of contacts added.
  • NoChangeCount - Number of contacts not changed because there was no change in the data.
Sample Code:
                                                
var client = new RestClient("https://apinie.sensorpro.net/api/Contact/GetUpdateAddAsyncStatus/[Token]");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("undefined", "{ \"Id\":\"e577737c-0544-4732-ae24-0e0d9a4a8037\",}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
                                                
		
                                                
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
CURLOPT_URL => "https://apinie.sensorpro.net/api/Contact/GetUpdateAddAsyncStatus/[Token]",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{     \"Id\":\"e577737c-0544-4732-ae24-0e0d9a4a8037\",}",
CURLOPT_HTTPHEADER => array(
        "Content-Type: application/json"
    ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
                                                
		
                                                
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "{     \"Id\":\"e577737c-0544-4732-ae24-0e0d9a4a8037\",}");
Request request = new Request.Builder()
.url("https://apinie.sensorpro.net/api/Contact/GetUpdateAddAsyncStatus/[Token]")
.post(body)
.addHeader("Content-Type", "application/json")
.build();

Response response = client.newCall(request).execute();
                                                
		

Update

Update a contact record. If this fails because the record cannot be found, an error is returned.

Update Endpoint
Method: PUT
https://apinie.sensorpro.net/api/Contact/Update/[Token]

Copy to Clipboard

  • [Token] - replace with the access token returned by the login.
Header Values
Header Example Description
Content-Type application/json  

Request Body


{
    "AddToList": [
    "ListA",
    "ListB"],
    "Contact": [
    {
    "FirstName": "Test First Name",
    "LastName": "Test Last Name",
    "PersonalEMail": "sampleaddress1@gmail.com"
    },
    {
    "FirstName": "Test First Name",
    "LastName": "Test Last Name",
    "PersonalEMail": "sampleaddress2@gmail.com"
    }
    ],
    "Options":{"Parameters":{},"Action":""},
    "ReturnFailedRequests": false,
    "UpdateByKey": "email",
    "SendWelcomeEmail": false,
    "SignupFormId":"00000000-0000-0000-0000-000000000000"
}
                                

Input Parameters

    • AddToList (array): array of tags.
      • AddToList - Array of tags which will be applied to the contact when it is created. "AddToList": ["ListA","ListB"]
    • Contact (array): array of contact records to add update.
      • Required values
      • Personalemail - email address
      • Optional Fields
      • Title - Contact title
      • FirstName - First name
      • LastName - Last name
      • Gender - Gender
      • DateofBirth - Date of birth
      • DateOfLastPurchase - Date of last purchase
      • PersonalEmail1 - Personal email address 1
      • BusinessEmail - Business email address
      • BusinessEmail1 - Business email address 1
      • PhoneHome - Home phone number
      • PhoneBusiness - Business phone number
      • PhoneMobile - Mobile phone (this is the number used for SMS)
      • Pager - Pager id
      • BusinessFax - Business fax number
      • HomeFax - Home Fax
      • PhoneOther - Phone Other
      • PerStreet - Home Address
      • PerStreet1 - Home Address
      • PerCity - Home Address
      • PerState - Home Address
      • PerZip - Home Address
      • PerCountry - Home Address
      • BusName - Business Name
      • BusStreet - Business Address
      • BusStreet1 - Business Address
      • BusCity - Business Address
      • BusState - Business Address
      • BusZip - Business Address
      • BusCountry - Business Address
      • BusWebSite - Business Address
      • GroupByIndustry - Group by industry type
      • GroupBy1 - Alternative group by
      • GroupBy2 - Alternative group by
      • GroupBy3 - Alternative group by
      • MessagePreference - Message preference HTML / TEXT
      • JobTitle - Job title
      • Categories - Array of newsletter categories which the contact will be assigned when created
      • CategoriesUnselected - Array of categories to be removed from contact if updating contact
      • OptOut - Email optout status -10 unsubscribed, 0 subscribed
      • SMSOptOut - SMS optout status -10 unsubscribed, 0 subscribed -5 Pending Optin
      • Status - 0 Active 20 Inactive -10 Bounced Rejected
      • SMSStatus - 0 Active -10 Bounced Rejected
      • ImportName - Src of contact
      • InFix - Middle prefix
      • YearlyPurchase - Total of yearly purchase
      • UserChar2 - User character field maxlength(100)
      • UserChar3 - User character field maxlength(100)
      • UserChar4 - User character field maxlength(100)
      • UserChar5 - User character field maxlength(100)
      • UserChar6 - User character field maxlength(100)
      • UserChar7 - User character field maxlength(100)
      • UserChar8 - User character field maxlength(100)
      • UserChar9 - User character field maxlength(100)
      • UserChar10 - User character field maxlength(100)
      • UserChar11 - User character field maxlength(100)
      • UserChar12 - User character field maxlength(100)
      • UserChar13 - User character field maxlength(100)
      • UserChar14 - User character field maxlength(100)
      • UserChar15 - User character field maxlength(100)
      • Date1 - User date format yyyy-mm-dd hh:mm:ss
      • Date2 - User date format yyyy-mm-dd hh:mm:ss
      • Date3 - User date format yyyy-mm-dd hh:mm:ss
      • Date4 - User date format yyyy-mm-dd hh:mm:ss
      • Date5 - User date format yyyy-mm-dd hh:mm:ss
      • Num1 - User number integer
      • Num2 - User number integer
      • Num3 - User number integer
      • Num4 - User number integer
      • Num5 - User number integer
    • Options (object) special options
      • Action (String) set to blank
    • ReturnFailedRequests (bool) - if true, failed requests are returned in the failed requests array. Only use this if required as it will reduce through put and bloat response object.
    • UpdateByKey (string) what key should be used to perform the update. Blank means native key. If updating using
      • Foreign / external key: “extlinkid”
      • Email address: “email”
      • Blank native key: contactid
    • SendWelcomeEmail This should be set to “true” if this is a new registration as it triggers the following processes:
      • Welcome email if setup
      • New signup audit record is created
    • SignupFormId This is the signup form ID which contains the welcome email design and settings. This must be setup through the web interface. This should be set to false, if using the API to mass import contacts form another system.
Response

    {
    "UpdateCount": 0,
    "NoChangeCount": 2,
    "AddCount": 0,
    "FailedRequests": [],
    "Result": {
        "RequestId": "0027b926-bcc3-4139-a4a8-e9f94e76ab30",
        "ErrorMessages": [],
        "StatusMesssages": [],
        "TotalStatusMessages": 0,
        "TotalErrors": 0
        }
    }
Response Values:
  • UpdateCount - Number of contacts updated.
  • AddCount - Will always be 0 for update.
  • NoChangeCount - Number of contacts not changed because there was no change in the data.
Sample Code:
                                                
var client = new RestClient("https://apinie.sensorpro.net/api/Contact/Update/[Token]");
var request = new RestRequest(Method.PUT);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("undefined", "{\"AddToList\": [\"ListA\",\"ListB\"],\"Contact\": [{\"FirstName\": \"Test First Name1\",\"LastName\": \"Test Last Name\",\"PersonalEMail\": \"sampleaddress1@gmail.com\"},{\"FirstName\": \"Test First Name\",\"LastName\": \"Test Last Name\",\"PersonalEMail\": \"sampleaddress2@gmail.com\"}],\"Options\":{\"Parameters\":{},\"Action\":\"\"},\"ReturnFailedRequests\": false,\"UpdateByKey\": \"email\",\"SendWelcomeEmail\": false,\"SignupFormId\":\"00000000-0000-0000-0000-000000000000\"}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
                                                
                                                
                                                
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
        CURLOPT_URL => "https://apinie.sensorpro.net/api/Contact/Update/[Token]",
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_ENCODING => "",
        CURLOPT_MAXREDIRS => 10,
        CURLOPT_TIMEOUT => 30,
        CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
        CURLOPT_CUSTOMREQUEST => "PUT",
        CURLOPT_POSTFIELDS => "{\"AddToList\": [\"ListA\",\"ListB\"],\"Contact\": [{\"FirstName\": \"Test First Name1\",\"LastName\": \"Test Last Name\",\"PersonalEMail\": \"sampleaddress1@gmail.com\"},{\"FirstName\": \"Test First Name\",\"LastName\": \"Test Last Name\",\"PersonalEMail\": \"sampleaddress2@gmail.com\"}],\"Options\":{\"Parameters\":{},\"Action\":\"\"},\"ReturnFailedRequests\": false,\"UpdateByKey\": \"email\",\"SendWelcomeEmail\": false,\"SignupFormId\":\"00000000-0000-0000-0000-000000000000\"}",
        CURLOPT_HTTPHEADER => array(
        "Content-Type: application/json"
    ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
                                                
                                                
                                                
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"AddToList\": [\"ListA\",\"ListB\"],\"Contact\": [{\"FirstName\": \"Test First Name1\",\"LastName\": \"Test Last Name\",\"PersonalEMail\": \"sampleaddress1@gmail.com\"},{\"FirstName\": \"Test First Name\",\"LastName\": \"Test Last Name\",\"PersonalEMail\": \"sampleaddress2@gmail.com\"}],\"Options\":{\"Parameters\":{},\"Action\":\"\"},\"ReturnFailedRequests\": false,\"UpdateByKey\": \"email\",\"SendWelcomeEmail\": false,\"SignupFormId\":\"00000000-0000-0000-0000-000000000000\"}");
Request request = new Request.Builder()
.url("https://apinie.sensorpro.net/api/Contact/Update/[Token]")
.put(body)
.addHeader("Content-Type", "application/json")
.build();

Response response = client.newCall(request).execute();
                                                
                                                

Add

Straight add - if add fails, an error is returned.

Add Endpoint
Method: Post
https://apinie.sensorpro.net/api/Contact/Add/[Token]

Copy to Clipboard

  • [Token] - replace with the access token returned by the login.
Header Values
Header Example Description
Content-Type application/json  

Request Body

{
                                "AddToList": [
                                "ListA",
                                "ListB"],
                                "Contact": [
                                {
                                "FirstName": "Test First Name",
                                "LastName": "Test Last Name",
                                "PersonalEMail": "sampleaddress1@gmail.com"
                                },
                                {
                                "FirstName": "Test First Name",
                                "LastName": "Test Last Name",
                                "PersonalEMail": "sampleaddress2@gmail.com"
                                }
                                ],
                                "Options":{"Parameters":{},"Action":""},
                                "ReturnFailedRequests": false,
                                "UpdateByKey": "email",
                                "SendWelcomeEmail": false,
                                "SignupFormId":"00000000-0000-0000-0000-000000000000"
                                }
                                

Input Parameters

    • AddToList (array): array of tags.
      • AddToList - Array of tags which will be applied to the contact when it is created. "AddToList": ["ListA","ListB"]
    • Contact (array): array of contact records to add update.
      • Required values
      • Personalemail - email address
      • Optional Fields
      • Title - Contact title
      • FirstName - First name
      • LastName - Last name
      • Gender - Gender
      • DateofBirth - Date of birth
      • DateOfLastPurchase - Date of last purchase
      • PersonalEmail1 - Personal email address 1
      • BusinessEmail - Business email address
      • BusinessEmail1 - Business email address 1
      • PhoneHome - Home phone number
      • PhoneBusiness - Business phone number
      • PhoneMobile - Mobile phone (this is the number used for sms)
      • Pager - Pager id
      • BusinessFax - Business fax number
      • HomeFax - Home Fax
      • PhoneOther - Phone Other
      • PerStreet - Home Address
      • PerStreet1 - Home Address
      • PerCity - Home Address
      • PerState - Home Address
      • PerZip - Home Address
      • PerCountry - Home Address
      • BusName - Business Name
      • BusStreet - Business Address
      • BusStreet1 - Business Address
      • BusCity - Business Address
      • BusState - Business Address
      • BusZip - Business Address
      • BusCountry - Business Address
      • BusWebSite - Business Address
      • GroupByIndustry - Group by industry type
      • GroupBy1 - Alternative group by
      • GroupBy2 - Alternative group by
      • GroupBy3 - Alternative group by
      • MessagePreference - Message preference HTML / TEXT
      • JobTitle - Job title
      • Categories - Array of newsletter categories which the contact will be assigned when created
      • CategoriesUnselected - Array of categories to be removed from contact if updating contact
      • OptOut - Email optout status; -10 unsubscribed, 0 subscribed
      • SMSOptOut - SMS optout status; -10 unsubscribed, 0 subscribed, -5 Pending Optin
      • Status - 0 Active 20 Inactive -10 Bounced Rejected
      • SMSStatus - 0 Active -10 Bounced Rejected
      • ImportName - Src of contact
      • InFix - Middle prefix
      • YearlyPurchase - Total of yearly purchase
      • UserChar2 - User character field maxlength(100)
      • UserChar3 - User character field maxlength(100)
      • UserChar4 - User character field maxlength(100)
      • UserChar5 - User character field maxlength(100)
      • UserChar6 - User character field maxlength(100)
      • UserChar7 - User character field maxlength(100)
      • UserChar8 - User character field maxlength(100)
      • UserChar9 - User character field maxlength(100)
      • UserChar10 - User character field maxlength(100)
      • UserChar11 - User character field maxlength(100)
      • UserChar12 - User character field maxlength(100)
      • UserChar13 - User character field maxlength(100)
      • UserChar14 - User character field maxlength(100)
      • UserChar15 - User character field maxlength(100)
      • Date1 - User date format yyyy-mm-dd hh:mm:ss
      • Date2 - User date format yyyy-mm-dd hh:mm:ss
      • Date3 - User date format yyyy-mm-dd hh:mm:ss
      • Date4 - User date format yyyy-mm-dd hh:mm:ss
      • Date5 - User date format yyyy-mm-dd hh:mm:ss
      • Num1 - User number integer
      • Num2 - User number integer
      • Num3 - User number integer
      • Num4 - User number integer
      • Num5 - User number integer
    • Options (object) special options
      • Action (String) set to blank
    • ReturnFailedRequests (bool) - if true, failed requests are returned in the failed requests array. Only use this if required as it will reduce through put and bloat response object.
    • UpdateByKey (string) what key should be used to perform the update. Blank means native key. If updating using
      • Foreign / external key: “extlinkid”
      • Email address: “email”
      • Blank native key: contactid
    • SendWelcomeEmail This should be set to “true” if this is a new registration as it triggers the following processes:
      • Welcome email if setup
      • New signup audit record is created
    • SignupFormId This is the signup form id which contains the welcome email design and settings. This must be setup through the web interface. This should be set to false, if using the API to mass import contacts form another system.
Response

    {
    "UpdateCount": 0,
    "NoChangeCount": 2,
    "AddCount": 0,
    "FailedRequests": [],
    "Result": {
        "RequestId": "0027b926-bcc3-4139-a4a8-e9f94e76ab30",
        "ErrorMessages": [],
        "StatusMesssages": [],
        "TotalStatusMessages": 0,
        "TotalErrors": 0
        }
    }
Response Values:
  • UpdateCount - Will always be 0 for Add.
  • AddCount - Number of contacts added.
  • NoChangeCount - Number of contacts not changed because there was no change in the data.
Sample Code:
                                                
var client = new RestClient("https://apinie.sensorpro.net/api/Contact/Add/[Token]");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("undefined", "{\ \"AddToList\": [\ \"ListA\",\ \"ListB\"],\ \"Contact\": [\ {\ \"FirstName\": \"Test First Name\",\ \"LastName\": \"Test Last Name\",\ \"PersonalEMail\": \"sampleaddress1@gmail.com\"\ },\ {\ \"FirstName\": \"Test First Name\",\ \"LastName\": \"Test Last Name\",\ \"PersonalEMail\": \"sampleaddress2@gmail.com\"\ }\ ],\ \"Options\":{\"Parameters\":{},\"Action\":\"\"},\ \"ReturnFailedRequests\": false,\ \"UpdateByKey\": \"email\",\ \"SendWelcomeEmail\": false,\ \"SignupFormId\":\"00000000-0000-0000-0000-000000000000\"\ }", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
                                                
                                                
                                                
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
CURLOPT_URL => "https://apinie.sensorpro.net/api/Contact/Add/[Token]",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{\ \"AddToList\": [\ \"ListA\",\ \"ListB\"],\ \"Contact\": [\ {\ \"FirstName\": \"Test First Name\",\ \"LastName\": \"Test Last Name\",\ \"PersonalEMail\": \"sampleaddress1@gmail.com\"\ },\ {\ \"FirstName\": \"Test First Name\",\ \"LastName\": \"Test Last Name\",\ \"PersonalEMail\": \"sampleaddress2@gmail.com\"\ }\ ],\ \"Options\":{\"Parameters\":{},\"Action\":\"\"},\ \"ReturnFailedRequests\": false,\ \"UpdateByKey\": \"email\",\ \"SendWelcomeEmail\": false,\ \"SignupFormId\":\"00000000-0000-0000-0000-000000000000\"\ }",
CURLOPT_HTTPHEADER => array(
"Content-Type: application/json"
),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
                                                
                                                
                                                
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\ \"AddToList\": [\ \"ListA\",\ \"ListB\"],\ \"Contact\": [\ {\ \"FirstName\": \"Test First Name\",\ \"LastName\": \"Test Last Name\",\ \"PersonalEMail\": \"sampleaddress1@gmail.com\"\ },\ {\ \"FirstName\": \"Test First Name\",\ \"LastName\": \"Test Last Name\",\ \"PersonalEMail\": \"sampleaddress2@gmail.com\"\ }\ ],\ \"Options\":{\"Parameters\":{},\"Action\":\"\"},\ \"ReturnFailedRequests\": false,\ \"UpdateByKey\": \"email\",\ \"SendWelcomeEmail\": false,\ \"SignupFormId\":\"00000000-0000-0000-0000-000000000000\"\ }");
Request request = new Request.Builder()
.url("https://apinie.sensorpro.net/api/Contact/Add/[Token]")
.post(body)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
                                                
                                                

GetContacts

This service is used to retrieve a contact from the database. The contact can be retrieved by email address, by external key, by native contact ID. Depending on how you want to retrieve the contact records, add the key to the appropriate collection in the request object below.

GetContacts Endpoint
Method: POST
https://apinie.sensorpro.net/api/Contact/GetContacts/[Token]

Copy to Clipboard

  • [Token] - replace with the access token returned by the login.
Header Values
Header Example Description
Content-Type application/json  

Example Request


{
    "ExtLinkIds":null,
    "EmailAddress":[
        "johnsmith@API.net",
        "email2@gmail.com"
    ],
    "ContactIds":null
}
                                            

Input Parameters

  • GetRequest (Object)
    • ExtLinkIds (string array) get contacts by external/foreign keys.
    • EmailAddress (string array) get contacts by email address.
    • ContactIds (long array) get contacts by contactids

Response

{
                                "Contacts":[
                                {
                                "OrgId":1,
                                "ContactId":11,
                                "ContactType":0,
                                "Loyalty":0,
                                "YearlyPurchase":0.0000,
                                "Title":"",
                                "FirstName":"Jonny",
                                "LastName":"Smith",
                                "Name":"",
                                "Gender":"",
                                "DateofBirth":"1900-01-01T00:01:00",
                                "DateOfLastPurchase":"1900-01-01T00:01:00",
                                "PersonalEMail":"johnsmith@API.net",
                                "OrginalEMail":"",
                                "PersonalEmail1":"",
                                "BusinessEmail":"",
                                "BusinessEmail1":"",
                                "PhoneHome":"",
                                "PhoneBusiness":"",
                                "PhoneMobile":"",
                                "Pager":"",
                                "BusinessFax":"",
                                "HomeFax":"",
                                "PhoneOther":"",
                                "PerStreet":"",
                                "PerStreet1":"",
                                "PerCity":"",
                                "PerState":"",
                                "PerZip":"",
                                "PerCountry":"",
                                "BusName":"",
                                "BusStreet":"",
                                "BusStreet1":"",
                                "BusCity":"",
                                "BusState":"",
                                "BusZip":"",
                                "BusCountry":"",
                                "BusWebSite":"",
                                "GroupByIndustry":"",
                                "GroupBy1":"",
                                "OtherPhone":"",
                                "GroupBy2":"",
                                "GroupBy3":"",
                                "LastUpdatedById":0,
                                "LastUpdatedByUser":"",
                                "ContactRating":-1,
                                "Password":"bTVXWVV",
                                "MessagePreference":"HTML",
                                "SyncDate":"2016-03-15T16:35:48.5515017+00:00",
                                "ExtLinkId":"",
                                "JobTitle":"",
                                "Categories":[

                                ],
                                "CategoriesUnselected":[

                                ],
                                "OptOut":0,
                                "SMSOptOut":0,
                                "OrginalOptOut":0,
                                "MapId":-1,
                                "ImportId":"a342eec1-2924-43e9-9589-fd3e7ebb5feb",
                                "ImportName":"",
                                "ExtLinkIdNum":-1,
                                "ExtLinkIdGuid":"00000000-0000-0000-0000-000000000000",
                                "ExtLinkIdNumField":"",
                                "ExtLinkIdField":"",
                                "ExtLinkIdGuidField":"",
                                "Status":0,
                                "SMSStatus":0,
                                "ReferedById":0,
                                "InFix":"",
                                "LastBroadCastDate":"1900-01-01T00:01:00",
                                "LastReponseDate":"1900-01-01T00:01:00",
                                "TotalBroadCasts":0,
                                "TotalResponses":0,
                                "UserChar2":"",
                                "UserChar3":"",
                                "UserChar4":"",
                                "UserChar5":"",
                                "UserChar6":"",
                                "UserChar7":"",
                                "UserChar8":"",
                                "UserChar9":"",
                                "UserChar10":"",
                                "UserChar11":"",
                                "UserChar12":"",
                                "UserChar13":"",
                                "UserChar14":"",
                                "UserChar15":"",
                                "Date1":"1900-01-01T00:01:00",
                                "Date2":"1900-01-01T00:01:00",
                                "Date3":"1900-01-01T00:01:00",
                                "Date4":"1900-01-01T00:01:00",
                                "Date5":"1900-01-01T00:01:00",
                                "Num1":0,
                                "Num2":0,
                                "Num3":0,
                                "Num4":0,
                                "Num5":0,
                                "LinkId":"00000000-0000-0000-0000-000000000000",
                                "Privacy":"",
                                "InfoObtainedFrom":"",
                                "RestrictEmails":"",
                                "GlobalId":"0806265d-b2f6-4eef-a76d-953d3c034fb1"
                                }
                                ],
                                "Result":{
                                "RequestId":"a3120207-98d3-4e0f-85bd-7180f0d11743",
                                "ErrorMessages":[
                                {
                                "Code":"GetFailed",
                                "Description":"email2@gmail.com Record could not be found. ",
                                "Sequence":0
                                }
                                ],
                                "StatusMesssages":[

                                ],
                                "TotalStatusMessages":0,
                                "TotalErrors":1
                                }
                                }
                                
Response Values:
    • Result (object: see "determine the success or failure of a service call")
    • Contacts (array of contacts) list of retrieved contacts.
Sample Code:
                                                
var client = new RestClient("https://apinie.sensorpro.net/api/Contact/GetContacts/[Token]");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("undefined", "{\"ExtLinkIds\":null,\"EmailAddress\":[\"johnsmith@API.net\",\"email2@gmail.com\"],\"ContactIds\":null}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
                                                
                                                
                                                
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
CURLOPT_URL => "https://apinie.sensorpro.net/api/Contact/GetContacts/[Token]",
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_ENCODING => "",
        CURLOPT_MAXREDIRS => 10,
        CURLOPT_TIMEOUT => 30,
        CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
        CURLOPT_CUSTOMREQUEST => "POST",
        CURLOPT_POSTFIELDS => "{\"ExtLinkIds\":null,\"EmailAddress\":[\"johnsmith@API.net\",\"email2@gmail.com\"],\"ContactIds\":null}",
        CURLOPT_HTTPHEADER => array(
        "Content-Type: application/json"
    ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
                                                
                                                
                                                
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"ExtLinkIds\":null,\"EmailAddress\":[\"johnsmith@API.net\",\"email2@gmail.com\"],\"ContactIds\":null}");
Request request = new Request.Builder()
.url("https://apinie.sensorpro.net/api/Contact/GetContacts/[Token]")
.post(body)
.addHeader("Content-Type", "application/json")
.build();

Response response = client.newCall(request).execute();
                                                
                                                

GetContactsPaged

This service is used to retrieve a contact from the database. The contact can be retrieved by email address, by external key, by native contact ID. Depending on how you want to retrieve the contact records add the key to the appropriate collection in the request object below. This API call returns the data a page at a time

GetContactsPaged Endpoint
Method: POST
https://apinie.sensorpro.net/api/Contact/GetContactsPaged/[Token]

Copy to Clipboard

  • [Token] - replace with the access token returned by the login.
Header Values
Header Example Description
Content-Type application/json  

Example Request


{
    "Page":1,
    "PageSize":10,
    "Options":{"Action":""},
    "Fields":["personalemail","status","optoutstatus"]
}
                                

Input Parameters

  • GetRequest (Object)
    • Page This API call returns the data a page at a time. This indicates which page to get. If paging through the complete data set increment the page count by one until no more data is returned.
    • PageSize This indicates how many contacts to return at a time.
    • Options If this is not set you will get back all contacts. Action options are as follows:
      • Bounce - get list of bounced emails
      • Optout - get list of opted out emails
      • Smsoptout - get list of sms optouts
      • Smsstatus - get list of sms failed numbers
      • Blank - get all contacts
    • Fields list of the fields to populate. Leave empty to return all fields

Response

  • GetResponse (Object)
    • Result (object see determine the success or failure of a service call)
    • Contacts (array of contacts) list of retrieved contacts.

{
    "Contacts":[9]
        {
            -0: { ... }
            -1: { ... }
            -2: { ... }
            -3: { ... }
            -4: { ... }
            -5: { ... }
            -6: { ... }
            -7: { ... }
            -8: { ... }
        }
    ],
    "Result":{
    "RequestId":"a3120207-98d3-4e0f-85bd-7180f0d11743",
    "ErrorMessages":[0]
    "StatusMesssages":[0]
    "TotalStatusMessages":0,
    "TotalErrors":0
    }
}
                                
Response Values:
  • Contacts - Array of contact records
Sample Code:
                                                
var client = new RestClient("https://apinie.sensorpro.net/api/Contact/GetContactsPaged/[Token]");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("undefined", "{\"Page\":1,\"PageSize\":10,\"Options\":{\"Action\":\"\"},\"Fields\":[\"personalemail\",\"status\"]}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
                                                
                                                
                                                
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => "https://apinie.sensorpro.net/api/Contact/GetContactsPaged/[Token]",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_POSTFIELDS => "{\"Page\":1,\"PageSize\":10,\"Options\":{\"Action\":\"\"},\"Fields\":[\"personalemail\",\"status\"]}",
    CURLOPT_HTTPHEADER => array(
    "Content-Type: application/json"
    ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
                                                
                                                
                                                
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"Page\":1,\"PageSize\":10,\"Options\":{\"Action\":\"\"},\"Fields\":[\"personalemail\",\"status\"]}");
Request request = new Request.Builder()
.url("https://apinie.sensorpro.net/api/Contact/GetContactsPaged/[Token]")
.post(body)
.addHeader("Content-Type", "application/json")
.build();

Response response = client.newCall(request).execute();
                                                
                                                

DeleteContacts

This service is used to delete a contact from the database. It is possible to delete contacts by email address, by external key and by native ContactID. Note once a contact has been broadcast to, they cannot be deleted (to preserve their opt-out status).

DeleteContacts Endpoint
Method: DELETE
https://apinie.sensorpro.net/api/Contact/DeleteContacts/[Token]

Copy to Clipboard

  • [Token] - replace with the access token returned by the login.
Header Values
Header Example Description
Content-Type application/json  

Request Body


{
    "SetToInactiveIfCannotDelete":true,
    "ReturnFailedRequests":false,
    "ExtLinkIds":[],
    "EmailAddress":[
        "johnsmith@api.net"
    ],
    "ContactIds":[]
}
                                

Input Parameters

  • INPUT PARAMETERS
      • ReturnFailedRequests - (bool) return requests which have failed. If set to true, this will cause the message response to increase in size.
      • ExtLinkIds - (string array) get contacts by external/foreign keys
      • EmailAddress - (string array) get contacts by email address
      • ContactIds - (long array) get contacts by contactids

Response


{
    "FailedRequests": [],
    "Result": {
       "RequestId": "850e874c-bc70-4d63-9906-96021a9420e1",
        "ErrorMessages": [],
        "StatusMesssages": [],
        "TotalStatusMessages": 0,
        "TotalErrors": 0
    }
}
Response Values:
  • Result - If no errors returned contacts were deleted
Sample Code:
                                                
var client = new RestClient("https://apinie.sensorpro.net/api/Contact/DeleteContacts/[Token]");
var request = new RestRequest(Method.DELETE);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("undefined", "{\"SetToInactiveIfCannotDelete\":true,\"ReturnFailedRequests\":false,\"ExtLinkIds\":[],\"EmailAddress\":[\"sampleaddress@acme.com\"],\"ContactIds\":[]}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
                                                
                                                
                                                
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
CURLOPT_URL => "https://apinie.sensorpro.net/api/Contact/DeleteContacts/[Token]",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_POSTFIELDS => "{\"SetToInactiveIfCannotDelete\":true,\"ReturnFailedRequests\":false,\"ExtLinkIds\":[],\"EmailAddress\":[\"sampleaddress@acme.com\"],\"ContactIds\":[]}",
CURLOPT_HTTPHEADER => array(
"Content-Type: application/json"
),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
                                                
                                                
                                                
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"SetToInactiveIfCannotDelete\":true,\"ReturnFailedRequests\":false,\"ExtLinkIds\":[],\"EmailAddress\":[\"sampleaddress@acme.com\"],\"ContactIds\":[]}");
Request request = new Request.Builder()
.url("https://apinie.sensorpro.net/api/Contact/DeleteContacts/[Token]")
.delete(body)
.addHeader("Content-Type", "application/json")
.build();

Response response = client.newCall(request).execute();
                                                
                                                

ForgetMe

This service is used to delete a contact from the database. It is possible to delete contacts by email address, by external key and by native ContactID. This will delete contacts and all associated data - note this should only be used when the contact information has been removed from source system. Once the contact is deleted it would be possible to re-import and possibly email them again, as they will also be deleted from suppression lists.

This is an asynchronous operation, and results can be viewed on line by choosing menu Admin | Setup | API | Forget Me Async Queue. It is also possible to get an email confirmation when task has completed.

ForgetMe Endpoint
Method: DELETE
https://apinie.sensorpro.net/api/Contact/ForgetMe/[Token]

Copy to Clipboard

  • [Token] - replace with the access token returned by the login.
Header Values
Header Example Description
Content-Type application/json  

Request Body


{
    "SetToInactiveIfCannotDelete":true,
    "ExtLinkIds":[

    ],
    "EmailAddress":[
        "johnsmith@api.net"
    ],
    "ContactIds":[

    ]
}
                                

Input Parameters

  • INPUT PARAMETERS
    • DeleteRequest (Object)
      • NotifyOnCompletionEmail EMail address for notification email. This email is sent once the task has completed.
      • ExtLinkIds (string array) get contacts by external/foreign keys
      • EmailAddress (string array) get contacts by email address
      • ContactIds - (long array) get contacts by contactids

Response


{
        "Result": {
        "RequestId": "ec86b266-d059-412f-be68-fc5305b9c29e",
        "ErrorMessages": [],
        "StatusMesssages": [
            {
            "Code": "RequestQueued",
            "Description": "Request queued with request ID ec86b266-d059-412f-be68-fc5305b9c29e",
            "Sequence": 0
            }
        ],
        "TotalStatusMessages": 1,
        "TotalErrors": 0
        }
}

                                
Response Values:
  • RequestId - This process runs asynchrounsly and this is the requestid for the api call. This can be tracked through the UI. Menu Admin > Setup > API > Forget Me Async Queue
Sample Code:
                                            
var client = new RestClient("https://apinie.sensorpro.net/api/Contact/DeleteContacts/[Token]");
var request = new RestRequest(Method.DELETE);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("undefined", "{\"SetToInactiveIfCannotDelete\":true,\"ReturnFailedRequests\":false,\"ExtLinkIds\":[],\"EmailAddress\":[\"sampleaddress@acme.com\"],\"ContactIds\":[]}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
                                                
                                                
                                            
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
CURLOPT_URL => "https://apinie.sensorpro.net/api/Contact/DeleteContacts/[Token]",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_POSTFIELDS => "{\"SetToInactiveIfCannotDelete\":true,\"ReturnFailedRequests\":false,\"ExtLinkIds\":[],\"EmailAddress\":[\"sampleaddress@acme.com\"],\"ContactIds\":[]}",
CURLOPT_HTTPHEADER => array(
"Content-Type: application/json"
),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
                                                
                                                
                                            
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"SetToInactiveIfCannotDelete\":true,\"ReturnFailedRequests\":false,\"ExtLinkIds\":[],\"EmailAddress\":[\"sampleaddress@acme.com\"],\"ContactIds\":[]}");
Request request = new Request.Builder()
.url("https://apinie.sensorpro.net/api/Contact/DeleteContacts/[Token]")
.delete(body)
.addHeader("Content-Type", "application/json")
.build();

Response response = client.newCall(request).execute();
                                                
                                                

ChangeOptoutStatus

This service is used to change the opt out status for a contact. If they have opted out, they will not be emailed.

ChangeOptoutStatus Endpoint
Method: PUT
https://apinie.sensorpro.net/api/Contact/ChangeOptOutStatus/[Token]

Copy to Clipboard

  • [Token] - replace with the access token returned by the login.
Header Values
Header Example Description
Content-Type application/json  

Example Request


{
    "Status":-10,
    "ReturnFailedRequests":false,
    "ExtLinkIds":[],
    "EmailAddress":[
        "johnsmith@API.net"
    ],
    "ContactIds":[]
}
                                

Input Parameters

  • INPUT PARAMETERS
    • StatusChangeRequest (Object)
      • o ReturnFailedRequests (bool) return requests which have failed. If set to true this will cause the message response to increase in size.
      • o ExtLinkIds (string array) update contacts by external/foreign keys
      • o EmailAddress (string array) update contacts by email address
      • o ContactIds (long array) update contacts by contactid
        • -10: Opted Out
        • -5 :Pending Opt In
        • 0 :Opted In

Response Values


{
    "FailedRequests":[],
    "Result":{
        "RequestId":"fb212298-5a1b-4fcb-8315-b61b65abfd1f",
        "ErrorMessages":[],
        "StatusMesssages":[],
        "TotalStatusMessages":0,
        "TotalErrors":0
    }
}
                                
Response Values:
    • Result If no errors returned status has been changed
    • FailedRequests (array of objects) this will contain the key (either string or long) which failed to delete the contact.
Sample Code:
                                                
var client = new RestClient("https://apinie.sensorpro.net/api/Contact/ChangeOptOutStatus/[Token]");
var request = new RestRequest(Method.PUT);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("undefined", "{\"Status\":-10,\"ReturnFailedRequests\":false,\"ExtLinkIds\":[],\"EmailAddress\":[    \"johnsmith@API.net\"],\"ContactIds\":[]}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
                                                
                                                
                                                
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://apinie.sensorpro.net/api/Contact/ChangeOptOutStatus/[Token]",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => "{\"Status\":-10,\"ReturnFailedRequests\":false,\"ExtLinkIds\":[],\"EmailAddress\":[    \"johnsmith@API.net\"],\"ContactIds\":[]}",
CURLOPT_HTTPHEADER => array(
"Content-Type: application/json"
),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
                                                
                                                
                                                
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"Status\":-10,\"ReturnFailedRequests\":false,\"ExtLinkIds\":[],\"EmailAddress\":[    \"johnsmith@API.net\"],\"ContactIds\":[]}");
Request request = new Request.Builder()
.url("https://apinie.sensorpro.net/api/Contact/ChangeOptOutStatus/[Token]")
.put(body)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
                                                
                                                

ChangeStatus

This service is used to change the general status for a contact.

ChangeStatus Endpoint
Method: PUT
https://apinie.sensorpro.net/api/Contact/ChangeStatus/[Token]

Copy to Clipboard

  • [Token] - replace with the access token returned by the login.
Header Values
Header Example Description
Content-Type application/json  

Request Body


{
    "Status":-10,
    "ReturnFailedRequests":false,
    "ExtLinkIds":[],
    "EmailAddress":[
        "johnsmith@API.net"
    ],
    "ContactIds":[]
}
                                

Input Parameters

  • INPUT PARAMETERS
    • StatusChangeRequest (Object)
      • ReturnFailedRequests (bool) return requests which have failed. If set to true this will cause the message response to increase in size.
      • ExtLinkIds (string array) update contacts by external/foreign keys
      • EmailAddress (string array) update contacts by email address
      • ContactIds (long array) update contacts by contactid
        • 0: Active
        • 10: Referred (Created by "Tell a Friend" option in an email)
        • 20: Inactive
        • -10: Bounced/rejected

Response


{
    "FailedRequests":[],
    "Result":{
        "RequestId":"81468d39-d225-44d7-af35-500807bf83d7",
        "ErrorMessages":[],
        "StatusMesssages":[],
        "TotalStatusMessages":0,
        "TotalErrors":0
    }
}
                                
Response Values:
    • Result (object - determine the success or failure of a service call)
    • FailedRequests (array of objects) this will contain the key (either string or long) which failed to delete the contact.
Sample Code:
                                                
var client = new RestClient("https://apinie.sensorpro.net/api/Contact/ChangeStatus/[Token]");
var request = new RestRequest(Method.PUT);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("undefined", "{\"Status\":-10,\"ReturnFailedRequests\":false,\"ExtLinkIds\":[],\"EmailAddress\":[    \"johnsmith@API.net\"],\"ContactIds\":[]}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
                                                
                                                
                                                
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
        CURLOPT_URL => "https://apinie.sensorpro.net/api/Contact/ChangeStatus/[Token]",
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_ENCODING => "",
        CURLOPT_MAXREDIRS => 10,
        CURLOPT_TIMEOUT => 30,
        CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
        CURLOPT_CUSTOMREQUEST => "PUT",
        CURLOPT_POSTFIELDS => "{    \"Status\":-10,    \"ReturnFailedRequests\":false,    \"ExtLinkIds\":[],    \"EmailAddress\":[        \"johnsmith@API.net\"    ],    \"ContactIds\":[]}",
        CURLOPT_HTTPHEADER => array(
        "Cache-Control: no-cache",
        "Content-Type: application/json",
        "Postman-Token: 846d9bbc-3b3a-417a-bd34-9e4b1ddb54a6"
    ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
                                                
                                                
                                                
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{    \"Status\":-10,    \"ReturnFailedRequests\":false,    \"ExtLinkIds\":[],    \"EmailAddress\":[        \"johnsmith@API.net\"    ],    \"ContactIds\":[]}");
Request request = new Request.Builder()
.url("https://apinie.sensorpro.net/api/Contact/ChangeStatus/[Token]")
.put(body)
.addHeader("Content-Type", "application/json")
.build();

Response response = client.newCall(request).execute();
                                                
                                                

Full Field List (Contact)

For simplicity, the contact record in the samples above only passed firstname, lastname and email address. What follows is the full list of fields which can be passed to the contact record.

"Contact":[
                                {
                                "Title":"",
                                "FirstName":"Jonny",
                                "LastName":"Smith",
                                "Gender":"",
                                "DateofBirth":"0001-01-01T00:00:00",
                                "DateOfLastPurchase":"0001-01-01T00:00:00",
                                "PersonalEMail":"johnsmith@API.net",
                                "OrginalEMail":"",
                                "PersonalEmail1":"",
                                "BusinessEmail":"",
                                "BusinessEmail1":"",
                                "PhoneHome":"",
                                "PhoneBusiness":"",
                                "PhoneMobile":"",
                                "Pager":"",
                                "BusinessFax":"",
                                "HomeFax":"",
                                "PhoneOther":"",
                                "PerStreet":"",
                                "PerStreet1":"",
                                "PerCity":"",
                                "PerState":"",
                                "PerZip":"",
                                "PerCountry":"",
                                "BusName":"",
                                "BusStreet":"",
                                "BusStreet1":"",
                                "BusCity":"",
                                "BusState":"",
                                "BusZip":"",
                                "BusCountry":"",
                                "BusWebSite":"",
                                "GroupByIndustry":"",
                                "GroupBy1":"",
                                "OtherPhone":"",
                                "GroupBy2":"",
                                "GroupBy3":"",
                                "LastUpdatedById":0,
                                "LastUpdatedByUser":"",
                                "ContactRating":0,
                                "Password":"",
                                "MessagePreference":"HTML",
                                "SyncDate":"2016-02-12T17:44:17.0964784+00:00",
                                "ExtLinkId":"",
                                "JobTitle":"",
                                "Categories":[

                                ],
                                "CategoriesUnselected":[

                                ],
                                "OptOut":0,
                                "SMSOptOut":0,
                                "OrginalOptOut":0,
                                "MapId":-1,
                                "ImportId":"be84463d-30e2-40f1-a20c-e7f2d56d9548",
                                "ImportName":"",
                                "ExtLinkIdNum":-1,
                                "ExtLinkIdGuid":"00000000-0000-0000-0000-000000000000",
                                "ExtLinkIdNumField":"",
                                "ExtLinkIdField":"",
                                "ExtLinkIdGuidField":"",
                                "Status":0,
                                "SMSStatus":0,
                                "ReferedById":0,
                                "InFix":"",
                                "UserChar2":"",
                                "UserChar3":"",
                                "UserChar4":"",
                                "UserChar5":"",
                                "UserChar6":"",
                                "UserChar7":"",
                                "UserChar8":"",
                                "UserChar9":"",
                                "UserChar10":"",
                                "UserChar11":"",
                                "UserChar12":"",
                                "UserChar13":"",
                                "UserChar14":"",
                                "UserChar15":"",
                                "Date1":"0001-01-01T00:00:00",
                                "Date2":"0001-01-01T00:00:00",
                                "Date3":"0001-01-01T00:00:00",
                                "Date4":"0001-01-01T00:00:00",
                                "Date5":"0001-01-01T00:00:00",
                                "Num1":0,
                                "Num2":0,
                                "Num3":0,
                                "Num4":0,
                                "Num5":0}
                                ],

                                

Developers Love Us - Create Your Account Now!