updateContactList()

This method can be used to update and add new records within existing list.

Input ParameterData TypeDescription
tokenStringToken generated in the platform.
listnameStringSpecify the Contact List name which needs to be updated.
intoperationtypeIntegerSpecify the operation that needs to be performed. Use 1 to insert, 2 to update or 3 to upsert.
isallowduplicateBooleanTrue if you would like to add duplicate value, otherwise False.
listattributesJSONSpecify email address and other field details in JSON format.

Output ParameterData TypeDescription
A string with operation statusStringA success status is displayed based on the chosen operation type.

Copied!
Click to copy

                              
using System.Collections.Generic;
using System.Text;
using Newtonsoft.Json;
using System.Net.Http;
using System.Web.Script.Serialization;

namespace APICallsUsingCSharp
{
    public class JsonValue
    {
        [JsonProperty("Email address")]
        public string EmailAddress { get; set; }

        [JsonProperty("Salutation")]
        public string Salutation { get; set; }

        [JsonProperty("First Name")]
        public string FirstName { get; set; }

        [JsonProperty("Last Name")]
        public string LastName { get; set; }
    }

    public class RootObject
    {
        public string token { get; set; }
        public string listname { get; set; }
        public int intoperationtype { get; set; }
        public bool isallowduplicate { get; set; }
        public List<JsonValue> strjsonvalue { get; set; }
    }

    public class Result
    {
        public string Data { get; set; }
        public string Status { get; set; }
        public string Description { get; set; }
    }

    public class Program
    {
        public void updateContactList()
        {
            List<JsonValue> lstJsonValues = new List<JsonValue>();

            JsonValue objJsonValue1 = new JsonValue();
            objJsonValue1.EmailAddress = "johnsmith@example.com";
            objJsonValue1.Salutation = "Mr";
            objJsonValue1.FirstName = "John";
            objJsonValue1.LastName = "Smith";
            lstJsonValues.Add(objJsonValue1);

            JsonValue objJsonValue2 = new JsonValue();
            objJsonValue2.EmailAddress = "lizabrown@example.com";
            objJsonValue2.Salutation = "Mrs";
            objJsonValue2.FirstName = "Liza";
            objJsonValue2.LastName = "Brown";
            lstJsonValues.Add(objJsonValue2);

            RootObject objRootObject = new RootObject();
            objRootObject.token = "41e5b9b6-5aae-40a1-9bbb-bd0176e93bf7";
            objRootObject.listname = "no duplicates";
            objRootObject.intoperationtype = 1;
            objRootObject.isallowduplicate = false;
            objRootObject.strjsonvalue = lstJsonValues;
            
            string apiUrl = "https://template.sogolytics.com/serviceAPI/service";
            string inputJson = (new JavaScriptSerializer()).Serialize(objRootObject);
            HttpClient client = new HttpClient();
            HttpContent inputContent = new StringContent(inputJson, Encoding.UTF8, "application/json");
            HttpResponseMessage response = client.PostAsync(apiUrl + "/updateContactList", inputContent).Result;
            if (response.IsSuccessStatusCode)
            {
                List<Result> results = (new JavaScriptSerializer()).Deserialize<List<Result>>(response.Content.ReadAsStringAsync().Result);
            }
        }
    }
}
Copied!
Click to copy

                              
<?php
$url = 'https://template.sogolytics.com/serviceAPI/service/updateContactList';
$data = ['token'=> '41e5b9b6-5aae-40a1-9bbb-bd0176e93bf7', 'listname'=> 'no duplicates', 'intoperationtype' => 1, 'isallowduplicate'=> false, 'strjsonvalue'=> [array(['Email address'=> 'johnsmith@example.com', 'Salutation'=> 'Mr', 'First Name'=> 'John', 'Last Name'=> 'Smith'], ['Email address'=> 'lizabrown@example.com', 'Salutation'=> 'Mrs', 'First Name'=> 'Liza', 'Last Name'=> 'Brown'])]];
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS,  json_encode($data));
curl_setopt($curl, CURLOPT_HTTPHEADER, [
  'Content-Type: application/json'
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response . PHP_EOL;
Copied!
Click to copy
                           

curl https://template.sogolytics.com/serviceAPI/service/updateContactList -H "Content-type: application/json" -X POST -d "{\"token\": \"f24d88f4-f1e6-4331-9e94-4067e8ce2d50\", \"listname\": \"no duplicates\", \"intoperationtype\": 1, \"isallowduplicate\": false, \"strjsonvalue\": [{\"Email address\": \"johnsmith@example.com\", \"Salutation\": \"Mr\", \"First Name\": \"John\", \"Last Name\": \"Smith\"}]}"

Copied!
Click to copy

                                 

import requests
import json
url = 'https://template.sogolytics.com/serviceAPI/service/updateContactList'
payload = {'token': 'f24d88f4-f1e6-4331-9e94-4067e8ce2d50', 'listname': 'no duplicates', 'intoperationtype': 1, 'isallowduplicate': false, 'strjsonvalue': [{'Email address': 'johnsmith@example.com', 'Salutation': 'Mr', 'First Name': 'John', 'Last Name': 'Smith'}]}
resp = requests.post(url,
data = json.dumps(payload), headers = {'Content-Type': 'application/json'})
resp.json()

Copied!
Click to copy

                              
Imports System.Text
Imports Newtonsoft.Json
Imports System.Net.Http
Imports System.Web.Script.Serialization

Public Class JsonValue
    <JsonProperty("Email address")>
    Public Property EmailAddress As String
    <JsonProperty("Salutation")>
    Public Property Salutation As String
    <JsonProperty("First Name")>
    Public Property FirstName As String
    <JsonProperty("Last Name")>
    Public Property LastName As String
End Class

Public Class RootObject
    Public Property token As String
    Public Property listname As String
    Public Property intoperationtype As Integer
    Public Property isallowduplicate As Boolean
    Public Property strjsonvalue As List(Of JsonValue)
End Class

Public Class Result
    Public Property Data As String
    Public Property Status As String
    Public Property Description As String
End Class

Public Class Program
    Public Sub updateContactList()
        Dim lstJsonValues As List(Of JsonValue) = New List(Of JsonValue)()

        Dim objJsonValue1 As JsonValue = New JsonValue()
        objJsonValue1.EmailAddress = "johnsmith@example.com"
        objJsonValue1.Salutation = "Mr"
        objJsonValue1.FirstName = "John"
        objJsonValue1.LastName = "Smith"
        lstJsonValues.Add(objJsonValue1)

        Dim objJsonValue2 As JsonValue = New JsonValue()
        objJsonValue2.EmailAddress = "lizabrown@example.com"
        objJsonValue2.Salutation = "Mrs"
        objJsonValue2.FirstName = "Liza"
        objJsonValue2.LastName = "Brown"
        lstJsonValues.Add(objJsonValue2)

        Dim objRootObject As RootObject = New RootObject()
        objRootObject.token = "41e5b9b6-5aae-40a1-9bbb-bd0176e93bf7"
        objRootObject.listname = "no duplicates"
        objRootObject.intoperationtype = 1
        objRootObject.isallowduplicate = False
        objRootObject.strjsonvalue = lstJsonValues

        Dim apiUrl As String = "https://template.sogolytics.com/serviceAPI/service"
        Dim inputJson As String = (New JavaScriptSerializer()).Serialize(objRootObject)
        Dim client As HttpClient = New HttpClient()
        Dim inputContent As HttpContent = New StringContent(inputJson, Encoding.UTF8, "application/json")
        Dim response As HttpResponseMessage = client.PostAsync(apiUrl & "/updateContactList", inputContent).Result

        If response.IsSuccessStatusCode Then
            Dim results As List(Of Result) = (New JavaScriptSerializer()).Deserialize(Of List(Of Result))(response.Content.ReadAsStringAsync().Result)
        End If
    End Sub
End Class
Output
{
    "Data": null,
    "Status": "Success",
    "Description": "Record(s) inserted"
}
{
    "Data": null,
    "Status": "Success",
    "Description": "Record(s) inserted"
}
{
    "Data": null,
    "Status": "Success",
    "Description": "Record(s) inserted"
}
{
    "Data": null,
    "Status": "Success",
    "Description": "Record(s) inserted"
}
{
    "Data": null,
    "Status": "Success",
    "Description": "Record(s) inserted"
}

getSurveyURL()

This method can be used to obtain the multi-use link of a survey.

Input ParameterData TypeDescription
tokenStringToken generated in the platform.
intsurveynoIntegerThis is the unique identifier for the survey

Output ParameterData TypeDescription
strSurveyURLStringMulti-use link of a survey

Copied!
Click to copy

                              
using System.Collections.Generic;
using System.Text;
using System.Net.Http;
using System.Web.Script.Serialization;

namespace APICallsUsingCSharp
{
    public class Result
    {
        public string Data { get; set; }
        public string Status { get; set; }
        public string Description { get; set; }
    }

    public class Program
    {
        private void getSurveyURL()
        {
            string apiUrl = "https://template.sogolytics.com/serviceAPI/service";
            var input = new
            {
                token = "41e5b9b6-5aae-40a1-9bbb-bd0176e93bf7",
                intsurveyno = "181"
            };
            string inputJson = (new JavaScriptSerializer()).Serialize(input);
            HttpClient client = new HttpClient();
            HttpContent inputContent = new StringContent(inputJson, Encoding.UTF8, "application/json");
            HttpResponseMessage response = client.PostAsync(apiUrl + "/getSurveyURL", inputContent).Result;
            if (response.IsSuccessStatusCode)
            {
                List<Result> results = (new JavaScriptSerializer()).Deserialize<List<Result>>(response.Content.ReadAsStringAsync().Result);
            }
        }
    }
}

Copied!
Click to copy

                              
<?php
$url = 'https://template.sogolytics.com/serviceAPI/service/getSurveyURL';
$data = [
  'token' => '41e5b9b6-5aae-40a1-9bbb-bd0176e93bf7',
  'intsurveyno' => '181'
];
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS,  json_encode($data));
curl_setopt($curl, CURLOPT_HTTPHEADER, [
  'Content-Type: application/json'
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response . PHP_EOL;
Copied!
Click to copy
                           

curl https://template.sogolytics.com/serviceAPI/service/getSurveyURL -H "Content-type: application/json" -X POST -d "{\"token\": \"41e5b9b6-5aae-40a1-9bbb-bd0176e93bf7\", \"intsurveyno\": \"181\"}"

Copied!
Click to copy

                                 

import requests
import json
url = 'https://template.sogolytics.com/serviceAPI/service/getSurveyURL'
payload = {'token': '41e5b9b6-5aae-40a1-9bbb-bd0176e93bf7', 'intsurveyno': '181'}
resp = requests.post(url,
data = json.dumps(payload), headers = {'Content-Type': 'application/json'})
resp.json()

Copied!
Click to copy

                              
Imports System.Text
Imports Newtonsoft.Json
Imports System.Net.Http
Imports System.Web.Script.Serialization

Public Class Result
    Public Property Data As String
    Public Property Status As String
    Public Property Description As String
End Class

Public Class Program
    Private Sub getSurveyURL()
        Dim apiUrl As String = "https://template.sogolytics.com/serviceAPI/service"
        Dim input = New With {Key .token = "41e5b9b6-5aae-40a1-9bbb-bd0176e93bf7", Key .intsurveyno = "181"}
        Dim inputJson As String = (New JavaScriptSerializer()).Serialize(input)
        Dim client As HttpClient = New HttpClient()
        Dim inputContent As HttpContent = New StringContent(inputJson, Encoding.UTF8, "application/json")
        Dim response As HttpResponseMessage = client.PostAsync(apiUrl & "/getSurveyURL", inputContent).Result

        If response.IsSuccessStatusCode Then
            Dim results As List(Of Result) = (New JavaScriptSerializer()).Deserialize(Of List(Of Result))(response.Content.ReadAsStringAsync().Result)
        End If
    End Sub
End Class
Output
{
    "Data": "https://survey.sogolytics.com/r/BtjhqB",
    "Status": "Success",
    "Description": null
}
{
    "Data": "https://survey.sogolytics.com/r/BtjhqB",
    "Status": "Success",
    "Description": null
}
{
    "Data": "https://survey.sogolytics.com/r/BtjhqB",
    "Status": "Success",
    "Description": null
}
{
    "Data": "https://survey.sogolytics.com/r/BtjhqB",
    "Status": "Success",
    "Description": null
}
{
    "Data": "https://survey.sogolytics.com/r/BtjhqB",
    "Status": "Success",
    "Description": null
}

sendSurveyInvite()

This method can be used to send email invitations to a list of email addresses.

Input ParameterData TypeDescription
tokenStringToken generated in the platform.
intsurveynoIntegerThis is the unique identifier for the survey
additionalinfoJSONSpecify email address, pre-population, mail merge and email template values in JSON format

Output ParameterData TypeDescription
A string indicating success or failureString1 if successful, otherwise error is displayed

Note: If invitations are sent to more than 100 email addresses, all the invites will be queued for delivery and will be sent via an exe process. Once invitations are delivered a confirmation email will be sent to the client account’s email address.

Copied!
Click to copy

                              
using System.Collections.Generic;  

using System.Text;  

using Newtonsoft.Json;  

using System.Net.Http;  

using System.Web.Script.Serialization;  

  

namespace APICallsUsingCSharp  

{  

public class Attribute  

{  

public string Email { get; set; }  

public string Attribute1 { get; set; }  

public string Attribute2 { get; set; }  

public string Attribute3 { get; set; }  

}  

  

public class Mapping  

{  

public string isPrepop { get; set; }  

public string Map_Attribute3_to { get; set; }  

}  

  

public class MailMergeMapping  

{  

public string isMailMerge { get; set; }  

public string Map_MailMerge_Attribute1_to { get; set; }  

public string Map_MailMerge_Attribute2_to { get; set; }  

}  

  

public class EmailTemplate  

{  

public string TemplateName { get; set; }  

}  

  

public class InvitationExpiry  

{  

public string Days { get; set; }  

}  

  

  

public class Additionalinfo  

{  

public List<Attribute> Attributes { get; set; }  

public Mapping Mapping { get; set; }  

public MailMergeMapping MailMergeMapping { get; set; }  

public EmailTemplate EmailTemplate { get; set; }  

public InvitationExpiry InvitationExpiry { get; set; }  

}  

  

public class RootObject  

{  

public string token { get; set; }  

public string intsurveyno { get; set; }  

public Additionalinfo additionalinfo { get; set; }  

}  

  

public class Result  

{  

public string Data { get; set; }  

public string Status { get; set; }  

public string Description { get; set; }  

}  

  

public class Program  

{  

public void sendSurveyInvite()  

{  

Additionalinfo objAdditionalinfo = new Additionalinfo();  

  

List<Attribute> lstAttributes = new List<Attribute>();  

  

Attribute objAttribute1 = new Attribute();  

objAttribute1.Email = "johnsmith@example.com";  

objAttribute1.Attribute1 = "John";  

objAttribute1.Attribute2 = "Smith";  

objAttribute1.Attribute3 = "Male";  

lstAttributes.Add(objAttribute1);  

  

Attribute objAttribute2 = new Attribute();  

objAttribute2.Email = "lizabrown@example.com";  

objAttribute2.Attribute1 = "Liza";  

objAttribute2.Attribute2 = "Brown";  

objAttribute2.Attribute3 = "Female";  

lstAttributes.Add(objAttribute2);  

objAdditionalinfo.Attributes = lstAttributes;  

  

Mapping objMapping = new Mapping();  

objMapping.isPrepop = "true";  

objMapping.Map_Attribute3_to = "1";  

objAdditionalinfo.Mapping = objMapping;  

  

MailMergeMapping objMailMergeMapping = new MailMergeMapping();  

objMailMergeMapping.isMailMerge = "true";  

objMailMergeMapping.Map_MailMerge_Attribute1_to = "1";  

objMailMergeMapping.Map_MailMerge_Attribute2_to = "2";  

objAdditionalinfo.MailMergeMapping = objMailMergeMapping;  

  

EmailTemplate objEmailTemplate = new EmailTemplate();  

objEmailTemplate.TemplateName = "Welcome";  

objAdditionalinfo.EmailTemplate = objEmailTemplate;  

  

InvitationExpiry objInvitationExpiry = new InvitationExpiry();  

objInvitationExpiry.Days = "2";  

objAdditionalinfo. InvitationExpiry = objInvitationExpiry;  

  

RootObject objRootObject = new RootObject();  

objRootObject.token = "41e5b9b6-5aae-40a1-9bbb-bd0176e93bf7";  

objRootObject.intsurveyno = "181";  

objRootObject.additionalinfo = objAdditionalinfo;  

  

string apiUrl = "https://template.sogolytics.com/serviceAPI/service";  

string inputJson = (new JavaScriptSerializer()).Serialize(objRootObject);  

HttpClient client = new HttpClient();  

HttpContent inputContent = new StringContent(inputJson, Encoding.UTF8, "application/json");  

HttpResponseMessage response = client.PostAsync(apiUrl + "/sendSurveyInvite", inputContent).Result;  

if (response.IsSuccessStatusCode)  

{  

List<Result> results = (new JavaScriptSerializer()).Deserialize<List<Result>>(response.Content.ReadAsStringAsync().Result);  

}  

}  

}  

}  
Copied!
Click to copy

                              
<?php  

$url = 'https://template.sogolytics.com/serviceAPI/service/sendSurveyInvite';  

$data = ['token'=> '41e5b9b6-5aae-40a1-9bbb-bd0176e93bf7', 'intsurveyno'=> '181', 'additionalinfo'=> ['Attributes'=> array(['Email'=> 'johnsmith@example.com', 'Attribute1'=> 'John', 'Attribute2'=> 'Smith', 'Attribute3'=> 'Male']), array(['Email'=> 'lizabrown@example.com', 'Attribute1'=> 'Liza', 'Attribute2'=> 'Brown', 'Attribute3'=> 'Female' ]), 'Mapping'=> ['isPrepop'=> 'true', 'Map_Attribute3_to'=> '1'], 'MailMergeMapping'=> ['isMailMerge'=> 'true', 'Map_MailMerge_Attribute1_to'=> '1', 'Map_MailMerge_Attribute2_to'=> '2'], 'EmailTemplate'=> ['TemplateName'=> 'Welcome'] , 'InvitationExpiry'=> ['Days'=> '2']  

]];  

$curl = curl_init($url);  

curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);  

curl_setopt($curl, CURLOPT_POST, true);  

curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data));  

curl_setopt($curl, CURLOPT_HTTPHEADER, [  

'Content-Type: application/json'  

]);  

$response = curl_exec($curl);  

curl_close($curl);  

echo $response . PHP_EOL;  
Copied!
Click to copy
                           

curl https://template.sogolytics.com/serviceAPI/service/sendSurveyInvite -H "Content-type: application/json" -X POST -d "{\"token\": \"41e5b9b6-5aae-40a1-9bbb-bd0176e93bf7\", \"intsurveyno\": \"181\", \"additionalinfo\": {\"Attributes\": [{\"Email\": \"johnsmith@example.com\", \"Attribute1\": \"John\", \"Attribute2\": \"Smith\", \"Attribute3\": \"Male\"}, {\"Email\": \"lizabrown@example.com\", \"Attribute1\": \"Liza\", \"Attribute2\": \"Brown\", \"Attribute3\": \"Female\" }], \"Mapping\": {\"isPrepop\": \"true\", \"Map_Attribute3_to\": \"1\"}, \"MailMergeMapping\": {\"isMailMerge\": \"true\", \"Map_MailMerge_Attribute1_to\": \"1\", \"Map_MailMerge_Attribute2_to\": \"2\"}, \"EmailTemplate\": {\"TemplateName\": \"Welcome\"}\"}, \"InvitationExpiry\": {\"Days\": \"2\"}}}"

Copied!
Click to copy

                                 

import requests

import json

url = 'https://template.sogolytics.com/serviceAPI/service/sendSurveyInvite'

payload = {'token': '41e5b9b6-5aae-40a1-9bbb-bd0176e93bf7', 'intsurveyno': '181', 'additionalinfo': {'Attributes': [{'Email': 'johnsmith@example.com', 'Attribute1': 'John', 'Attribute2': 'Smith', 'Attribute3': 'Male'}, {'Email': 'lizabrown@example.com', 'Attribute1': 'Liza', 'Attribute2': 'Brown', 'Attribute3': 'Female' }], 'Mapping': {'isPrepop': 'true', 'Map_Attribute3_to': '1'}, 'MailMergeMapping': {'isMailMerge': 'true', 'Map_MailMerge_Attribute1_to': '1', 'Map_MailMerge_Attribute2_to': '2'}, 'EmailTemplate': {'TemplateName': 'Welcome'}}, 'InvitationExpiry': {'Days': '2'}}}

resp = requests.post(url,

data = json.dumps(payload), headers = {'Content-Type': 'application/json'})

resp.json()

Copied!
Click to copy

                              
Imports System.Text  

Imports Newtonsoft.Json  

Imports System.Net.Http  

Imports System.Web.Script.Serialization  

  

Public Class Attribute  

Public Property Email As String  

Public Property Attribute1 As String  

Public Property Attribute2 As String  

Public Property Attribute3 As String  

End Class  

  

Public Class Mapping  

Public Property isPrepop As String  

Public Property Map_Attribute3_to As String  

End Class  

  

Public Class MailMergeMapping  

Public Property isMailMerge As String  

Public Property Map_MailMerge_Attribute1_to As String  

Public Property Map_MailMerge_Attribute2_to As String  

End Class  

  

Public Class EmailTemplate  

Public Property TemplateName As String  

End Class  

  

Public Class InvitationExpiry  

Public Property Days As String  

End Class  

  

Public Class Additionalinfo  

Public Property Attributes As List(Of Attribute)  

Public Property Mapping As Mapping  

Public Property MailMergeMapping As MailMergeMapping  

Public Property EmailTemplate As EmailTemplate  

Public Property InvitationExpiry As InvitationExpiry  

End Class  

  

Public Class RootObject  

Public Property token As String  

Public Property intsurveyno As String  

Public Property additionalinfo As Additionalinfo  

End Class  

  

Public Class Result  

Public Property Data As String  

Public Property Status As String  

Public Property Description As String  

End Class  

  

Public Class Program  

Public Sub sendSurveyInvite()  

Dim objAdditionalinfo As Additionalinfo = New Additionalinfo()  

  

Dim lstAttributes As List(Of Attribute) = New List(Of Attribute)()  

  

Dim objAttribute1 As Attribute = New Attribute()  

objAttribute1.Email = "johnsmith@example.com"  

objAttribute1.Attribute1 = "John"  

objAttribute1.Attribute2 = "Smith"  

objAttribute1.Attribute3 = "Male"  

lstAttributes.Add(objAttribute1)  

  

Dim objAttribute2 As Attribute = New Attribute()  

objAttribute2.Email = "lizabrown@example.com"  

objAttribute2.Attribute1 = "Liza"  

objAttribute2.Attribute2 = "Brown"  

objAttribute2.Attribute3 = "Female"  

lstAttributes.Add(objAttribute2)  

objAdditionalinfo.Attributes = lstAttributes  

  

Dim objMapping As Mapping = New Mapping()  

objMapping.isPrepop = "true"  

objMapping.Map_Attribute3_to = "1"  

objAdditionalinfo.Mapping = objMapping  

  

Dim objMailMergeMapping As MailMergeMapping = New MailMergeMapping()  

objMailMergeMapping.isMailMerge = "true"  

objMailMergeMapping.Map_MailMerge_Attribute1_to = "1"  

objMailMergeMapping.Map_MailMerge_Attribute2_to = "2"  

objAdditionalinfo.MailMergeMapping = objMailMergeMapping  

  

Dim objEmailTemplate As EmailTemplate = New EmailTemplate()  

objEmailTemplate.TemplateName = "Welcome"  

objAdditionalinfo.EmailTemplate = objEmailTemplate  

  

Dim objInvitationExpiry As InvitationExpiry = New InvitationExpiry()  

objInvitationExpiry.Days = "2"  

objAdditionalinfo.InvitationExpiry = objInvitationExpiry  

  

Dim objRootObject As RootObject = New RootObject()  

objRootObject.token = "41e5b9b6-5aae-40a1-9bbb-bd0176e93bf7"  

objRootObject.intsurveyno = "181"  

objRootObject.additionalinfo = objAdditionalinfo  

  

Dim apiUrl As String = "https://template.sogolytics.com/serviceAPI/service"  

Dim inputJson As String = (New JavaScriptSerializer()).Serialize(objRootObject)  

Dim client As HttpClient = New HttpClient()  

Dim inputContent As HttpContent = New StringContent(inputJson, Encoding.UTF8, "application/json")  

Dim response As HttpResponseMessage = client.PostAsync(apiUrl & "/sendSurveyInvite", inputContent).Result  

  

If response.IsSuccessStatusCode Then  

Dim results As List(Of Result) = (New JavaScriptSerializer()).Deserialize(Of List(Of Result))(response.Content.ReadAsStringAsync().Result)  

End If  

End Sub  

End Class  
Output
{
    "Data": null,
    "Status": "Success",
    "Description": "1"
}
{
    "Data": null,
    "Status": "Success",
    "Description": "1"
}
{
    "Data": null,
    "Status": "Success",
    "Description": "1"
}
{
    "Data": null,
    "Status": "Success",
    "Description": "1"
}
{
    "Data": null,
    "Status": "Success",
    "Description": "1"
}

sendSurveyReminder()

This method can be used to send email Reminders to non-participants.

Input ParameterData TypeDescription
tokenStringToken generated in the platform.
intsurveynoInteger This is the unique identifier for the survey.
additionalinfoJSONSpecify email adresses and email template in JSON format.

Output ParameterData TypeDescription
A string indicating success or failureString1 if successful, otherwise error is displayed

Copied!
Click to copy

                              
using System.Collections.Generic;
using System.Text;
using Newtonsoft.Json;
using System.Net.Http;
using System.Web.Script.Serialization;

namespace APICallsUsingCSharp
{
    public class Attribute
    {
        public string Email { get; set; }
    }

    public class EmailTemplate
    {
        public string TemplateName { get; set; }
    }

    public class Additionalinfo
    {
        public List<Attribute> Attributes { get; set; }
        public EmailTemplate EmailTemplate { get; set; }
    }

    public class RootObject
    {
        public string token { get; set; }
        public string intsurveyno { get; set; }
        public Additionalinfo additionalinfo { get; set; }
    }

    public class Result
    {
        public string Data { get; set; }
        public string Status { get; set; }
        public string Description { get; set; }
    }

    public class Program
    {
        public void sendSurveyReminder()
        {
            Additionalinfo objAdditionalinfo = new Additionalinfo();

            List<Attribute> lstAttributes = new List<Attribute>();

            Attribute objAttribute1 = new Attribute();
            objAttribute1.Email = "johnsmith@example.com";
            lstAttributes.Add(objAttribute1);

            Attribute objAttribute2 = new Attribute();
            objAttribute2.Email = "lizabrown@example.com";
            lstAttributes.Add(objAttribute2);
            objAdditionalinfo.Attributes = lstAttributes;

            EmailTemplate objEmailTemplate = new EmailTemplate();
            objEmailTemplate.TemplateName = "Welcome";
            objAdditionalinfo.EmailTemplate = objEmailTemplate;

            RootObject objRootObject = new RootObject();
            objRootObject.token = "41e5b9b6-5aae-40a1-9bbb-bd0176e93bf7";
            objRootObject.intsurveyno = "181";
            objRootObject.additionalinfo = objAdditionalinfo;

            string apiUrl = "https://template.sogolytics.com/serviceAPI/service";
            string inputJson = (new JavaScriptSerializer()).Serialize(objRootObject);
            HttpClient client = new HttpClient();
            HttpContent inputContent = new StringContent(inputJson, Encoding.UTF8, "application/json");
            HttpResponseMessage response = client.PostAsync(apiUrl + "/sendSurveyReminder", inputContent).Result;
            if (response.IsSuccessStatusCode)
            {
                List<Result> results = (new JavaScriptSerializer()).Deserialize<List<Result>>(response.Content.ReadAsStringAsync().Result);
            }
        }
    }
}
Copied!
Click to copy

                              
<?php
$url = 'https://template.sogolytics.com/serviceAPI/service/sendSurveyReminder';
$data = ['token'=> '41e5b9b6-5aae-40a1-9bbb-bd0176e93bf7', 'intsurveyno'=> '181', 'additionalinfo'=> ['Attributes'=> array(['Email'=> ' johnsmith@example.com ']), array(['Email'=> ' lizabrown@example.com ']), 'EmailTemplate'=> ['TemplateName'=> ' Welcome ']]];
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS,  json_encode($data));
curl_setopt($curl, CURLOPT_HTTPHEADER, [
  'Content-Type: application/json'
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response . PHP_EOL;
Copied!
Click to copy
                           

curl https://template.sogolytics.com/serviceAPI/service/sendSurveyReminder -H "Content-type: application/json" -X POST -d "{\"token\": \"41e5b9b6-5aae-40a1-9bbb-bd0176e93bf7\", \"intsurveyno\": \"181\", \"additionalinfo\": {\"Attributes\": [{\"Email\": \"johnsmith@example.com\"}, {\"Email\": \"lizabrown@example.com\"}], \"EmailTemplate\": {\"TemplateName\": \"Welcome\"}}}"

Copied!
Click to copy

                                 

import requests
import json
url = 'https://template.sogolytics.com/serviceAPI/service/sendSurveyReminder'
payload = {'token': '41e5b9b6-5aae-40a1-9bbb-bd0176e93bf7', 'intsurveyno': '181', 'additionalinfo': {'Attributes': [{'Email': 'johnsmith@example.com'}, {'Email': 'lizabrown@example.com'}], 'EmailTemplate': {'TemplateName': 'Welcome'}}}
resp = requests.post(url, data = json.dumps(payload), headers = {'Content-Type': 'application/json'})
resp.json()

Copied!
Click to copy

                              
Imports System.Text
Imports Newtonsoft.Json
Imports System.Net.Http
Imports System.Web.Script.Serialization

Public Class Attribute
    Public Property Email As String
End Class

Public Class EmailTemplate
    Public Property TemplateName As String
End Class

Public Class Additionalinfo
    Public Property Attributes As List(Of Attribute)
    Public Property EmailTemplate As EmailTemplate
End Class

Public Class RootObject
    Public Property token As String
    Public Property intsurveyno As String
    Public Property additionalinfo As Additionalinfo
End Class

Public Class Result
    Public Property Data As String
    Public Property Status As String
    Public Property Description As String
End Class

Public Class Program
    Public Sub sendSurveyReminder()
        Dim objAdditionalinfo As Additionalinfo = New Additionalinfo()

        Dim lstAttributes As List(Of Attribute) = New List(Of Attribute)()

        Dim objAttribute1 As Attribute = New Attribute()
        objAttribute1.Email = "johnsmith@example.com"
        lstAttributes.Add(objAttribute1)

        Dim objAttribute2 As Attribute = New Attribute()
        objAttribute2.Email = "lizabrown@example.com"
        lstAttributes.Add(objAttribute2)
        objAdditionalinfo.Attributes = lstAttributes

        Dim objEmailTemplate As EmailTemplate = New EmailTemplate()
        objEmailTemplate.TemplateName = "Welcome"
        objAdditionalinfo.EmailTemplate = objEmailTemplate

        Dim objRootObject As RootObject = New RootObject()
        objRootObject.token = "41e5b9b6-5aae-40a1-9bbb-bd0176e93bf7"
        objRootObject.intsurveyno = "181"
        objRootObject.additionalinfo = objAdditionalinfo

        Dim apiUrl As String = "https://template.sogolytics.com/serviceAPI/service"
        Dim inputJson As String = (New JavaScriptSerializer()).Serialize(objRootObject)
        Dim client As HttpClient = New HttpClient()
        Dim inputContent As HttpContent = New StringContent(inputJson, Encoding.UTF8, "application/json")
        Dim response As HttpResponseMessage = client.PostAsync(apiUrl & "/sendSurveyReminder", inputContent).Result

        If response.IsSuccessStatusCode Then
            Dim results As List(Of Result) = (New JavaScriptSerializer()).Deserialize(Of List(Of Result))(response.Content.ReadAsStringAsync().Result)
        End If
    End Sub
End Class
Output
{
    "Data": null,
    "Status": "Success",
    "Description": "1"
}
{
    "Data": null,
    "Status": "Success",
    "Description": "1"
}
{
    "Data": null,
    "Status": "Success",
    "Description": "1"
}
{
    "Data": null,
    "Status": "Success",
    "Description": "1"
}
{
    "Data": null,
    "Status": "Success",
    "Description": "1"
}

generateSurveyKey()

This method can be used to generate survey passwords required for accessing survey participation.

Input ParameterData TypeDescription
tokenStringToken generated in the platform.
baseurlStringThis is the URL used for survey participation.
passwordtypeStringType of password to be generated, single or multi-use.
additionalinfoJSONSpecify passwords and pre-population values in JSON format.
expirydaysIntegerExpire passwords after specified days.

Output ParameterData TypeDescription
A string indicating success or failureStringString indicating number of passwords succesfully generated.

Copied!
Click to copy

                              
using System.Collections.Generic;
using System.Text;
using Newtonsoft.Json;
using System.Net.Http;
using System.Web.Script.Serialization;

namespace APICallsUsingCSharp
{
    public class Attribute
    {
        public string Password { get; set; }
        public string Attribute1 { get; set; }
        public string Attribute2 { get; set; }
    }

    public class Mapping
    {
        public string isPrepop { get; set; }
        public string Map_Attribute1_to { get; set; }
        public string Map_Attribute2_to { get; set; }
    }

    public class Additionalinfo
    {
        public List<Attribute> Attributes { get; set; }
        public Mapping Mapping { get; set; }
    }

    public class RootObject
    {
        public string token { get; set; }
        public string baseurl { get; set; }
        public Additionalinfo additionalinfo { get; set; }
        public string expirydays { get; set; }
    }

    public class Result
    {
        public string Data { get; set; }
        public string Status { get; set; }
        public string Description { get; set; }
    }

    public class Program
    {
        public void generateSurveyKey()
        {
            Additionalinfo objAdditionalinfo = new Additionalinfo();

            List<Attribute> lstAttributes = new List<Attribute>();

            Attribute objAttribute1 = new Attribute();
            objAttribute1.Password = "98007";
            objAttribute1.Attribute1 = "Male";
            objAttribute1.Attribute2 = "John";
            lstAttributes.Add(objAttribute1);

            Attribute objAttribute2 = new Attribute();
            objAttribute2.Password = "98008";
            objAttribute2.Attribute1 = "Female";
            objAttribute2.Attribute2 = "Liza";
            lstAttributes.Add(objAttribute2);
            objAdditionalinfo.Attributes = lstAttributes;

            Mapping objMapping = new Mapping();
            objMapping.isPrepop = "true";
            objMapping.Map_Attribute1_to = "2";
            objMapping.Map_Attribute2_to = "4";
            objAdditionalinfo.Mapping = objMapping;

            RootObject objRootObject = new RootObject();
            objRootObject.token = "41e5b9b6-5aae-40a1-9bbb-bd0176e93bf7";
            objRootObject.baseurl = "EmployeeFeeback";
            objRootObject.additionalinfo = objAdditionalinfo;
            objRootObject.expirydays = "0";

            string apiUrl = "https://template.sogolytics.com/serviceAPI/service";
            string inputJson = (new JavaScriptSerializer()).Serialize(objRootObject);
            HttpClient client = new HttpClient();
            HttpContent inputContent = new StringContent(inputJson, Encoding.UTF8, "application/json");
            HttpResponseMessage response = client.PostAsync(apiUrl + "/generateSurveyKey", inputContent).Result;
            if (response.IsSuccessStatusCode)
            {
                List<Result> results = (new JavaScriptSerializer()).Deserialize<List<Result>>(response.Content.ReadAsStringAsync().Result);
            }
        }
    }
}

Copied!
Click to copy

                              
<?php
$url = 'https://template.sogolytics.com/serviceAPI/service/generateSurveyKey';
$data = ['token'=> '41e5b9b6-5aae-40a1-9bbb-bd0176e93bf7', 'baseurl'=> 'EmployeeFeeback', 'passwordtype' => 'single', 'additionalinfo'=> ['Attributes'=> array(['Password'=> '98007', 'Attribute1'=> 'Male', 'Attribute2'=> 'John']), array(['Email'=> '98008', 'Attribute1'=> 'Female', 'Attribute2'=> 'Liza']), 'Mapping'=> ['isPrepop'=> 'true', 'Map_Attribute1_to'=> '2', 'Map_Attribute2_to'=> '4']], 'expirydays'=> '0'];
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS,  json_encode($data));
curl_setopt($curl, CURLOPT_HTTPHEADER, [
  'Content-Type: application/json'
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response . PHP_EOL;
Copied!
Click to copy
                           

curl https://template.sogolytics.com/serviceAPI/service/generateSurveyKey -H "Content-type: application/json" -X POST -d "{\"token\": \"41e5b9b6-5aae-40a1-9bbb-bd0176e93bf7\", \"baseurl\": \"EmployeeFeeback\", \"passwordtype\": \"single\", \"additionalinfo\": {\"Attributes\": [{\"Password\": \"98007\", \"Attribute1\": \"Male\", \"Attribute2\": \"John\"}, {\"Password\": \"98008\", \"Attribute1\": \"Female\", \"Attribute2\": \"Liza\"}], \"Mapping\": {\"isPrepop\": \"true\", \"Map_Attribute1_to\": \"2\", \"Map_Attribute2_to\": \"4\"}}, \"expirydays\": \"0\"}"

Copied!
Click to copy

                                 

import requests
import json
url = 'https://template.sogolytics.com/serviceAPI/service/generateSurveyKey'
payload = {'token': '41e5b9b6-5aae-40a1-9bbb-bd0176e93bf7', 'baseurl': 'EmployeeFeeback', 'passwordtype': 'single', 'additionalinfo': {'Attributes': [{'Password': '98007', 'Attribute1': 'Male', 'Attribute2': 'John'}, {'Password': '98008', 'Attribute1': 'Female', 'Attribute2': 'Liza'}], 'Mapping': {'isPrepop': 'true', 'Map_Attribute1_to': '2', 'Map_Attribute2_to': '4'}}, 'expirydays': '0'}
resp = requests.post(url,
data = json.dumps(payload), headers = {'Content-Type': 'application/json'})
resp.json()

Copied!
Click to copy

                              
Imports System.Text
Imports Newtonsoft.Json
Imports System.Net.Http
Imports System.Web.Script.Serialization

Public Class Attribute
    Public Property Password As String
    Public Property Attribute1 As String
    Public Property Attribute2 As String
End Class

Public Class Mapping
    Public Property isPrepop As String
    Public Property Map_Attribute1_to As String
    Public Property Map_Attribute2_to As String
End Class

Public Class Additionalinfo
    Public Property Attributes As List(Of Attribute)
    Public Property Mapping As Mapping
End Class

Public Class RootObject
    Public Property token As String
    Public Property baseurl As String
    Public Property additionalinfo As Additionalinfo
    Public Property expirydays As String
End Class

Public Class Result
    Public Property Data As String
    Public Property Status As String
    Public Property Description As String
End Class

Public Class Program
    Public Sub generateSurveyKey()
        Dim objAdditionalinfo As Additionalinfo = New Additionalinfo()

        Dim lstAttributes As List(Of Attribute) = New List(Of Attribute)()

        Dim objAttribute1 As Attribute = New Attribute()
        objAttribute1.Password = "98007"
        objAttribute1.Attribute1 = "Male"
        objAttribute1.Attribute2 = "John"
        lstAttributes.Add(objAttribute1)

        Dim objAttribute2 As Attribute = New Attribute()
        objAttribute2.Password = "98008"
        objAttribute2.Attribute1 = "Female"
        objAttribute2.Attribute2 = "Liza"
        lstAttributes.Add(objAttribute2)
        objAdditionalinfo.Attributes = lstAttributes

        Dim objMapping As Mapping = New Mapping()
        objMapping.isPrepop = "true"
        objMapping.Map_Attribute1_to = "2"
        objMapping.Map_Attribute2_to = "4"
        objAdditionalinfo.Mapping = objMapping

        Dim objRootObject As RootObject = New RootObject()
        objRootObject.token = "41e5b9b6-5aae-40a1-9bbb-bd0176e93bf7"
        objRootObject.baseurl = "EmployeeFeeback"
        objRootObject.additionalinfo = objAdditionalinfo
        objRootObject.expirydays = "0"

        Dim apiUrl As String = "https://template.sogolytics.com/serviceAPI/service"
        Dim inputJson As String = (New JavaScriptSerializer()).Serialize(objRootObject)
        Dim client As HttpClient = New HttpClient()
        Dim inputContent As HttpContent = New StringContent(inputJson, Encoding.UTF8, "application/json")
        Dim response As HttpResponseMessage = client.PostAsync(apiUrl & "/generateSurveyKey", inputContent).Result

        If response.IsSuccessStatusCode Then
            Dim results As List(Of Result) = (New JavaScriptSerializer()).Deserialize(Of List(Of Result))(response.Content.ReadAsStringAsync().Result)
        End If
    End Sub
End Class
Output
{
    "Data": null,
    "Status": "Success",
    "Description": "You have successfully generated 4 Survey Password(s)."
}
{
    "Data": null,
    "Status": "Success",
    "Description": "You have successfully generated 4 Survey Password(s)."
}
{
    "Data": null,
    "Status": "Success",
    "Description": "You have successfully generated 4 Survey Password(s)."
}
{
    "Data": null,
    "Status": "Success",
    "Description": "You have successfully generated 4 Survey Password(s)."
}
{
    "Data": null,
    "Status": "Success",
    "Description": "You have successfully generated 4 Survey Password(s)."
}

sendSurveyInviteWithReminder()

This method can be used to send email invitation along with reminders to a list of email addresses.

Input ParameterData TypeDescription
tokenStringToken generated in the platform.
intsurveynoIntegerThis is the unique identifier for the survey
additionalinfoJSONSpecify email adresses and email template in JSON format.
inthourIntegerNumber of hours after the invitation sent you would like the reminder to be sent

Output ParameterData TypeDescription
A string indicating success or failureString1 if successful, otherwise error is displayed

Note: If invitations and reminders are sent to more than 100 email addresses, all the emails will be queued for delivery and will be sent via a exe process. Once invitations are delivered and reminders are scheduled a confirmation email will be sent to the client account’s email address.

Copied!
Click to copy

                              
using System.Collections.Generic;  

using System.Text;  

using Newtonsoft.Json;  

using System.Net.Http;  

using System.Web.Script.Serialization;  

  

namespace APICallsUsingCSharp  

{  

public class Attribute  

{  

public string Email { get; set; }  

public string Attribute1 { get; set; }  

public string Attribute2 { get; set; }  

public string Attribute3 { get; set; }  

}  

  

public class Mapping  

{  

public string isPrepop { get; set; }  

public string Map_Attribute3_to { get; set; }  

}  

  

public class MailMergeMapping  

{  

public string isMailMerge { get; set; }  

public string Map_MailMerge_Attribute1_to { get; set; }  

public string Map_MailMerge_Attribute2_to { get; set; }  

}  

  

public class EmailTemplate  

{  

public string TemplateName { get; set; }  

}  

  

public class InvitationExpiry  

{  

public string Days { get; set; }  

}  

  

  

public class Additionalinfo  

{  

public List<Attribute> Attributes { get; set; }  

public Mapping Mapping { get; set; }  

public MailMergeMapping MailMergeMapping { get; set; }  

public EmailTemplate EmailTemplate { get; set; }  

public InvitationExpiry InvitationExpiry { get; set; }  

}  

  

public class RootObject  

{  

public string token { get; set; }  

public string intsurveyno { get; set; }  

public Additionalinfo additionalinfo { get; set; }  

public string inthour { get; set; }  

}  

  

public class Result  

{  

public string Data { get; set; }  

public string Status { get; set; }  

public string Description { get; set; }  

}  

  

public class Program  

{  

public void sendSurveyInviteWithReminder()  

{  

Additionalinfo objAdditionalinfo = new Additionalinfo();  

  

List<Attribute> lstAttributes = new List<Attribute>();  

  

Attribute objAttribute1 = new Attribute();  

objAttribute1.Email = "johnsmith@example.com";  

objAttribute1.Attribute1 = "John";  

objAttribute1.Attribute2 = "Smith";  

objAttribute1.Attribute3 = "Male";  

lstAttributes.Add(objAttribute1);  

  

Attribute objAttribute2 = new Attribute();  

objAttribute2.Email = "lizabrown@example.com";  

objAttribute2.Attribute1 = "Liza";  

objAttribute2.Attribute2 = "Brown";  

objAttribute2.Attribute3 = "Female";  

lstAttributes.Add(objAttribute2);  

objAdditionalinfo.Attributes = lstAttributes;  

  

Mapping objMapping = new Mapping();  

objMapping.isPrepop = "true";  

objMapping.Map_Attribute3_to = "1";  

objAdditionalinfo.Mapping = objMapping;  

  

MailMergeMapping objMailMergeMapping = new MailMergeMapping();  

objMailMergeMapping.isMailMerge = "true";  

objMailMergeMapping.Map_MailMerge_Attribute1_to = "1";  

objMailMergeMapping.Map_MailMerge_Attribute2_to = "2";  

objAdditionalinfo.MailMergeMapping = objMailMergeMapping;  

  

EmailTemplate objEmailTemplate = new EmailTemplate();  

objEmailTemplate.TemplateName = "Welcome";  

objAdditionalinfo.EmailTemplate = objEmailTemplate;  

  

InvitationExpiry objInvitationExpiry = new InvitationExpiry();  

objInvitationExpiry.Days = "15";  

objAdditionalinfo. InvitationExpiry = objInvitationExpiry;  

  

RootObject objRootObject = new RootObject();  

objRootObject.token = "41e5b9b6-5aae-40a1-9bbb-bd0176e93bf7";  

objRootObject.intsurveyno = "181";  

objRootObject.additionalinfo = objAdditionalinfo;  

objRootObject.inthour = "168";  

  

string apiUrl = "https://template.sogolytics.com/serviceAPI/service";  

string inputJson = (new JavaScriptSerializer()).Serialize(objRootObject);  

HttpClient client = new HttpClient();  

HttpContent inputContent = new StringContent(inputJson, Encoding.UTF8, "application/json");  

HttpResponseMessage response = client.PostAsync(apiUrl + "/sendSurveyInviteWithReminder", inputContent).Result;  

if (response.IsSuccessStatusCode)  

{  

List<Result> results = (new JavaScriptSerializer()).Deserialize<List<Result>>(response.Content.ReadAsStringAsync().Result);  

}  

}  

}  

}  
Copied!
Click to copy

                              
<?php  

$url = 'https://template.sogolytics.com/serviceAPI/service/sendSurveyInviteWithReminder';  

$data = ['token'=> '41e5b9b6-5aae-40a1-9bbb-bd0176e93bf7', 'intsurveyno'=> '181', 'additionalinfo'=> ['Attributes'=> array(['Email'=> 'johnsmith@example.com', 'Attribute1'=> 'John', 'Attribute2'=> 'Smith', 'Attribute3'=> 'Male']), array(['Email'=> 'lizabrown@example.com', 'Attribute1'=> 'Liza', 'Attribute2'=> 'Brown', 'Attribute3'=> 'Female' ]), 'Mapping'=> ['isPrepop'=> 'true', 'Map_Attribute3_to'=> '1'], 'MailMergeMapping'=> ['isMailMerge'=> 'true', 'Map_MailMerge_Attribute1_to'=> '1', 'Map_MailMerge_Attribute2_to'=> '2'], 'EmailTemplate'=> ['TemplateName'=> 'Welcome'] , 'InvitationExpiry'=> ['Days'=> '15']], 'inthour'=> '168'];  

$curl = curl_init($url);  

curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);  

curl_setopt($curl, CURLOPT_POST, true);  

curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data));  

curl_setopt($curl, CURLOPT_HTTPHEADER, [  

'Content-Type: application/json'  

]);  

$response = curl_exec($curl);  

curl_close($curl);  

echo $response . PHP_EOL;  
Copied!
Click to copy
                           

curl https://template.sogolytics.com/serviceAPI/service/sendSurveyInviteWithReminder -H "Content-type: application/json" -X POST -d "{\"token\": \"41e5b9b6-5aae-40a1-9bbb-bd0176e93bf7\", \"intsurveyno\": \"181\", \"additionalinfo\": {\"Attributes\": [{\"Email\": \"johnsmith@example.com\", \"Attribute1\": \"John\", \"Attribute2\": \"Smith\", \"Attribute3\": \"Male\"}, {\"Email\": \"lizabrown@example.com\", \"Attribute1\": \"Liza\", \"Attribute2\": \"Brown\", \"Attribute3\": \"Female\" }], \"Mapping\": {\"isPrepop\": \"true\", \"Map_Attribute3_to\": \"1\"}, \"MailMergeMapping\": {\"isMailMerge\": \"true\", \"Map_MailMerge_Attribute1_to\": \"1\", \"Map_MailMerge_Attribute2_to\": \"2\"}, \"EmailTemplate\": {\"TemplateName\": \"Welcome\"}\"}, \"InvitationExpiry\": {\"Days\": \"15\"}}, \"inthour\": \"168\"}"

Copied!
Click to copy

                                 

import requests

import json

url = 'https://template.sogolytics.com/serviceAPI/service/sendSurveyInviteWithReminder'

payload = {'token': '41e5b9b6-5aae-40a1-9bbb-bd0176e93bf7', 'intsurveyno': '181', 'additionalinfo': {'Attributes': [{'Email': 'johnsmith@example.com', 'Attribute1': 'John', 'Attribute2': 'Smith', 'Attribute3': 'Male'}, {'Email': 'lizabrown@example.com', 'Attribute1': 'Liza', 'Attribute2': 'Brown', 'Attribute3': 'Female' }], 'Mapping': {'isPrepop': 'true', 'Map_Attribute3_to': '1'}, 'MailMergeMapping': {'isMailMerge': 'true', 'Map_MailMerge_Attribute1_to': '1', 'Map_MailMerge_Attribute2_to': '2'}, 'EmailTemplate': {'TemplateName': 'Welcome'}}, 'InvitationExpiry': {'Days': '15'}}, 'inthour': '168' }

resp = requests.post(url,

data = json.dumps(payload), headers = {'Content-Type': 'application/json'})

resp.json()

Copied!
Click to copy

                              
Imports System.Text  

Imports Newtonsoft.Json  

Imports System.Net.Http  

Imports System.Web.Script.Serialization  

  

Public Class Attribute  

Public Property Email As String  

Public Property Attribute1 As String  

Public Property Attribute2 As String  

Public Property Attribute3 As String  

End Class  

  

Public Class Mapping  

Public Property isPrepop As String  

Public Property Map_Attribute3_to As String  

End Class  

  

Public Class MailMergeMapping  

Public Property isMailMerge As String  

Public Property Map_MailMerge_Attribute1_to As String  

Public Property Map_MailMerge_Attribute2_to As String  

End Class  

  

Public Class EmailTemplate  

Public Property TemplateName As String  

End Class  

  

Public Class InvitationExpiry  

Public Property Days As String  

End Class  

  

Public Class Additionalinfo  

Public Property Attributes As List(Of Attribute)  

Public Property Mapping As Mapping  

Public Property MailMergeMapping As MailMergeMapping  

Public Property EmailTemplate As EmailTemplate  

Public Property InvitationExpiry As InvitationExpiry  

End Class  

  

Public Class RootObject  

Public Property token As String  

Public Property intsurveyno As String  

Public Property additionalinfo As Additionalinfo  

Public Property inthour As String  

End Class  

  

Public Class Result  

Public Property Data As String  

Public Property Status As String  

Public Property Description As String  

End Class  

  

Public Class Program  

Public Sub sendSurveyInviteWithReminder()  

Dim objAdditionalinfo As Additionalinfo = New Additionalinfo()  

  

Dim lstAttributes As List(Of Attribute) = New List(Of Attribute)()  

  

Dim objAttribute1 As Attribute = New Attribute()  

objAttribute1.Email = "johnsmith@example.com"  

objAttribute1.Attribute1 = "John"  

objAttribute1.Attribute2 = "Smith"  

objAttribute1.Attribute3 = "Male"  

lstAttributes.Add(objAttribute1)  

  

Dim objAttribute2 As Attribute = New Attribute()  

objAttribute2.Email = "lizabrown@example.com"  

objAttribute2.Attribute1 = "Liza"  

objAttribute2.Attribute2 = "Brown"  

objAttribute2.Attribute3 = "Female"  

lstAttributes.Add(objAttribute2)  

objAdditionalinfo.Attributes = lstAttributes  

  

Dim objMapping As Mapping = New Mapping()  

objMapping.isPrepop = "true"  

objMapping.Map_Attribute3_to = "1"  

objAdditionalinfo.Mapping = objMapping  

  

Dim objMailMergeMapping As MailMergeMapping = New MailMergeMapping()  

objMailMergeMapping.isMailMerge = "true"  

objMailMergeMapping.Map_MailMerge_Attribute1_to = "1"  

objMailMergeMapping.Map_MailMerge_Attribute2_to = "2"  

objAdditionalinfo.MailMergeMapping = objMailMergeMapping  

  

Dim objEmailTemplate As EmailTemplate = New EmailTemplate()  

objEmailTemplate.TemplateName = "Welcome"  

objAdditionalinfo.EmailTemplate = objEmailTemplate  

  

Dim objInvitationExpiry As InvitationExpiry = New InvitationExpiry()  

objInvitationExpiry.Days = "15"  

objAdditionalinfo.InvitationExpiry = objInvitationExpiry  

  

Dim objRootObject As RootObject = New RootObject()  

objRootObject.token = "41e5b9b6-5aae-40a1-9bbb-bd0176e93bf7"  

objRootObject.intsurveyno = "181"  

objRootObject.additionalinfo = objAdditionalinfo  

objRootObject.inthour = "168"  

  

Dim apiUrl As String = "https://template.sogolytics.com/serviceAPI/service"  

Dim inputJson As String = (New JavaScriptSerializer()).Serialize(objRootObject)  

Dim client As HttpClient = New HttpClient()  

Dim inputContent As HttpContent = New StringContent(inputJson, Encoding.UTF8, "application/json")  

Dim response As HttpResponseMessage = client.PostAsync(apiUrl & "/sendSurveyInviteWithReminder", inputContent).Result  

  

If response.IsSuccessStatusCode Then  

Dim results As List(Of Result) = (New JavaScriptSerializer()).Deserialize(Of List(Of Result))(response.Content.ReadAsStringAsync().Result)  

End If  

End Sub  

End Class  

  
Output
{
    "Data": null,
    "Status": "Success",
    "Description": "1"
}
{
    "Data": null,
    "Status": "Success",
    "Description": "1"
}
{
    "Data": null,
    "Status": "Success",
    "Description": "1"
}
{
    "Data": null,
    "Status": "Success",
    "Description": "1"
}
{
    "Data": null,
    "Status": "Success",
    "Description": "1"
}

sendSMS()​

This method enables sending SMS invitations.​

Input ParameterData TypeDescription
tokenStringToken generated in the platform.​
intsurveynoIntegerThis is the unique identifier for the survey
additionalinfo​JSONSpecify mobile numbers, pre-population and touch rules values in JSON format (Sample US Mobile Number: +1-1234567890)​
message​StringSMS invitation, including text and URL. Copy and paste the code << SMS URL >> without modification where the link should appear in the invitation.​

Output ParameterData TypeDescription
A string indicating success or failureString1 if successful, otherwise error is displayed

Copied!
Click to copy

                              
<p class="hey">using System;
using System.Collections.Generic;
using System.Text;
using System.Net.Http;
using System.Web.Script.Serialization;
 
namespace WebAPISampleCode
{
    public class Attribute
    {
        public string SMS { get; set; }
        public string Attribute1 { get; set; }
        public string Attribute2 { get; set; }
        public string Attribute3 { get; set; }
    }
    public class Mapping
    {
        public string isPrepop { get; set; }
        public string Map_Attribute3_to { get; set; }
    }
    public class Additionalinfo
    {
        public List<Attribute> Attributes { get; set; }
        public Mapping Mapping { get; set; }
    }
    public class RootObject
    {
        public string token { get; set; }
        public string intsurveyno { get; set; }
        public string message { get; set; }
        public Additionalinfo additionalinfo { get; set; }
    }
    public class Result
    {
        public string Status { get; set; }
        public string Description { get; set; }
    }
 
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World");
            sendSMS();
            Console.ReadKey();
        }
 
        public static void sendSMS()
        {
 
            Additionalinfo objAdditionalinfo = new Additionalinfo();
            List<Attribute> lstAttributes = new List<Attribute>();
            Attribute objAttribute1 = new Attribute();
 
            objAttribute1.SMS = "+1-XXXXXXXXXX";
 
            objAttribute1.Attribute1 = "ABC";
            objAttribute1.Attribute2 = "XYZ";
            objAttribute1.Attribute3 = "Male";
 
            lstAttributes.Add(objAttribute1);
 
            Attribute objAttribute2 = new Attribute();
 
            objAttribute2.SMS = "+91-XXXXXXXXXX";
 
            objAttribute2.Attribute1 = "ABC1";
            objAttribute2.Attribute2 = "XYZ1";
            objAttribute2.Attribute3 = "Female";
 
            lstAttributes.Add(objAttribute2);
 
            objAdditionalinfo.Attributes = lstAttributes;
 
            Mapping objMapping = new Mapping();
            objMapping.isPrepop = "true";
            objMapping.Map_Attribute3_to = "1";
            objAdditionalinfo.Mapping = objMapping;
 
            RootObject objRootObject = new RootObject();
 
            objRootObject.token = "2769058b-324e-4949-8367-2fa52ecdddfe";
            objRootObject.intsurveyno = "5420";
            objRootObject.message = "Please click this link to participate in an important survey: <<SMS URL>>. Thank you for your time.";
            objRootObject.additionalinfo = objAdditionalinfo;
 
            string apiUrl = " https://template.sogolytics.com/serviceAPI/service/sendSMS";
 
            string inputJson = (new JavaScriptSerializer()).Serialize(objRootObject);
 
            HttpClient client = new HttpClient();
 
            HttpContent inputContent = new StringContent(inputJson, Encoding.UTF8, "application/json");
 
            HttpResponseMessage response = client.PostAsync(apiUrl + "/sendSMS", inputContent).Result;
 
            if (response.IsSuccessStatusCode)
            {
                List<Result> results = (new JavaScriptSerializer()).Deserialize<List<Result>>(response.Content.ReadAsStringAsync().Result);
            }
        }
 
    }
}
</p>
Copied!
Click to copy

                              
<p class="hey"><?php
$url = 'https://template.sogolytics.com/serviceAPI/service/sendSMS ';
                                                                                                                                  
$data = ['token'=> '2769058b-324e-4949-8367-2fa52ecdddfe', 'intsurveyno'=> '5420', 'message'=> 'Please click this link to participate in an important survey: <<SMS URL>>. Thank you for your time.' ,'additionalinfo'=> ['Attributes'=> array(['SMS'=> '+1-XXXXXXXXXX', 'Attribute1'=> 'John', 'Attribute2'=> 'Smith', 'Attribute3'=> 'Male']), array(['SMS'=> '+1-XXXXXXXXXX, 'Attribute1'=> 'Liza', 'Attribute2'=> 'Brown', 'Attribute3'=> 'Female' ]), 'Mapping'=> ['isPrepop'=> 'true', 'Map_Attribute3_to'=> '1'] ]];
 
$curl = curl_init($url);
 curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
 curl_setopt($curl, CURLOPT_POST, true);
 curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data));
 curl_setopt($curl, CURLOPT_HTTPHEADER, [
 'Content-Type: application/json'
 ]);
 $response = curl_exec($curl);
 curl_close($curl);
 echo $response . PHP_EOL;
</p>
Copied!
Click to copy
                           

<p class="hey">curl https://template.sogolytics.com/serviceAPI/service/sendSMS -H "Content-type: application/json" -X POST -d "{\"token\": \"2769058b-324e-4949-8367-2fa52ecdddfe\", \"intsurveyno\": \"5420\",\"message\": \"Please click this link to participate in an important survey: ^<^<SMS URL^>^>. Thank you for your time.\", \"additionalinfo\": {\"Attributes\": [{\"SMS\": \"+91-XXXXXXXXXX\", \"Attribute1\": \"John\", \"Attribute2\": \"Smith\", \"Attribute3\": \"Male\"}, {\"SMS\": \"+91-XXXXXXXXXX\", \"Attribute1\": \"Liza\", \"Attribute2\": \"Brown\", \"Attribute3\": \"Female\" }], \"Mapping\": {\"isPrepop\": \"true\", \"Map_Attribute3_to\": \"1\"} }}"</p>

Copied!
Click to copy

                                 

<p class="hey">import requests
import json
url = 'https://template.sogolytics.com/serviceAPI/service/sendSMS'
payload = {'token': '2769058b-324e-4949-8367-2fa52ecdddfe', 'intsurveyno': '5420','message': 'Please click this link to participate in an important survey: <<SMS URL>>. Thank you for your time.' , 'additionalinfo': {'Attributes': [{'SMS': '+91-9920705229', 'Attribute1': 'John', 'Attribute2': 'Smith', 'Attribute3': 'Male'}, {'SMS': '+91-9167405845', 'Attribute1': 'Liza', 'Attribute2': 'Brown', 'Attribute3': 'Female' }], 'Mapping': {'isPrepop': 'true', 'Map_Attribute3_to': '1'} }}
resp = requests.post(url,
data = json.dumps(payload), headers = {'Content-Type': 'application/json'})
resp.json()
</p>

Copied!
Click to copy

                              
<p class="hey">Imports System.Text
Imports System.Net.Http
Imports System.Web.Script.Serialization
 
Namespace WebAPISampleCode
 
    Public Class Attribute
        Public Property SMS As String
        Public Property Attribute1 As String
        Public Property Attribute2 As String
        Public Property Attribute3 As String
    End Class
 
    Public Class Mapping
        Public Property isPrepop As String
        Public Property Map_Attribute3_to As String
    End Class
 
    Public Class Additionalinfo
        Public Property Attributes As List(Of Attribute)
        Public Property Mapping As Mapping
    End Class
 
    Public Class RootObject
        Public Property token As String
        Public Property intsurveyno As String
        Public Property message As String
        Public Property additionalinfo As Additionalinfo
    End Class
 
    Public Class Result
        Public Property Status As String
        Public Property Description As String
    End Class
 
    Public Class Program
        Shared Sub Main(ByVal args As String())
            sendSMS()
        End Sub
 
        Public Shared Sub sendSMS()
 
            Dim objAdditionalinfo As Additionalinfo = New Additionalinfo()
            Dim lstAttributes As List(Of Attribute) = New List(Of Attribute)()
            Dim objMapping As Mapping = New Mapping()
            Dim objAttribute1 As Attribute = New Attribute()
            Dim objAttribute2 As Attribute = New Attribute()
 
            objAttribute1.SMS = "+1-XXXXXXXXX"
            objAttribute1.Attribute1 = "ABC"
            objAttribute1.Attribute2 = "XYZ"
            objAttribute1.Attribute3 = "Male"
 
            lstAttributes.Add(objAttribute1)
 
            objAttribute2.SMS = "+1-XXXXXXXXX"
            objAttribute2.Attribute1 = "ABC1"
            objAttribute2.Attribute2 = "XYZ1"
            objAttribute2.Attribute3 = "Female"
 
            lstAttributes.Add(objAttribute2)
 
            objAdditionalinfo.Attributes = lstAttributes
 
            objMapping.isPrepop = "true"
            objMapping.Map_Attribute3_to = "1"
            objAdditionalinfo.Mapping = objMapping
 
            Dim objRootObject As RootObject = New RootObject()
 
            objRootObject.token = "2769058b-324e-4949-8367-2fa52ecdddfe"
            objRootObject.intsurveyno = "5420"
            objRootObject.message = "Please click this link to participate in an important survey: <<SMS URL>>. Thank you for your time."
 
            objRootObject.additionalinfo = objAdditionalinfo
            Dim apiUrl As String = "https://template.sogolytics.com/serviceAPI/service/sendSMS"
            Dim inputJson As String = (New JavaScriptSerializer()).Serialize(objRootObject)
            Dim client As HttpClient = New HttpClient()
            Dim inputContent As HttpContent = New StringContent(inputJson, Encoding.UTF8, "application/json")
            Dim response As HttpResponseMessage = client.PostAsync(apiUrl & "/sendSMS", inputContent).Result
 
            If response.IsSuccessStatusCode Then
                Dim results As List(Of Result) = (New JavaScriptSerializer()).Deserialize(Of List(Of Result))(response.Content.ReadAsStringAsync().Result)
            End If
 
        End Sub
    End Class
End Namespace
</p>
Output
<p class="hey">{
    "Status": "Success",
    "Description": "SMS Invitation(s) sent: 1"
}
</p>
<p class="hey">{
    "Status": "Success",
    "Description": "SMS Invitation(s) sent: 1"
}
</p>
<p class="hey">{
    "Status": "Success",
    "Description": "SMS Invitation(s) sent: 1"
}
</p>
<p class="hey">{
    "Status": "Success",
    "Description": "SMS Invitation(s) sent: 1"
}
</p>
<p class="hey">{
    "Status": "Success",
    "Description": "SMS Invitation(s) sent: 1"
}
</p>

reopenresponse()

This method can be used to reopen a completed response only for Single-Use Links. If your project is Anonymous/Semi-Anonymous responses cannot be reopened.

Input ParameterData TypeDescription
tokenStringToken generated in the platform.
intsurveynoIntegerThis is the unique identifier for the survey
stremailaddressStringThe email address of the participant.

Output ParameterData TypeDescription
A string indicating success or failureString1 if successful, otherwise error is displayed

Copied!
Click to copy

                              

using System.Collections.Generic;

using System.Text;

using Newtonsoft.Json;

using System.Net.Http;

using System.Web.Script.Serialization;

namespace APICallsUsingCSharp

{

public class Result

{

public string Status { get; set; }

public string ReopenStatus { get; set; }

}

class Program

{

private void reopenresponse()

{

string apiUrl = "https://template.sogolytics.com/serviceAPI/service";

var input = new

{

token = "41e5b9b6-5aae-40a1-9bbb-bd0176e93bf7",

intsurveyno = "181",

stremailaddress = "johnsmith@example.com,lizabrown@example.com"

};

string inputJson = (new JavaScriptSerializer()).Serialize(input);

HttpClient client = new HttpClient();

HttpContent inputContent = new StringContent(inputJson, Encoding.UTF8, "application/json");

HttpResponseMessage response = client.PostAsync(apiUrl + "/reopenresponse", inputContent).Result;

if (response.IsSuccessStatusCode)

{

List<Result> results = (new JavaScriptSerializer()).Deserialize<List<Result>>(response.Content.ReadAsStringAsync().Result);

}

}

}

}

Copied!
Click to copy

                              
<?php  

$url = 'https://template.sogolytics.com/serviceAPI/service/reopenresponse';  

$data = ['token'=> '41e5b9b6-5aae-40a1-9bbb-bd0176e93bf7', 'intsurveyno'=> '181', 'stremailaddress'=> 'johnsmith@example.com,lizabrown@example.com' ];  

$curl = curl_init($url);  

curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);  

curl_setopt($curl, CURLOPT_POST, true);  

curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data));  

curl_setopt($curl, CURLOPT_HTTPHEADER, [  

'Content-Type: application/json'  

]);  

$response = curl_exec($curl);  

curl_close($curl);  

echo $response . PHP_EOL;  
Copied!
Click to copy
                           

curl https://template.sogolytics.com/serviceAPI/service/reopenresponse -H "Content-type: application/json" -X POST -d "{\"token\": \"41e5b9b6-5aae-40a1-9bbb-bd0176e93bf7\", \"intsurveyno\": \"181\", \"stremailaddress\": \"johnsmith@example.com,lizabrown@example.com\"}"

Copied!
Click to copy

                                 

import requests

import json

url = 'https://template.sogolytics.com/serviceAPI/service/reopenresponse'

payload = {'token': '41e5b9b6-5aae-40a1-9bbb-bd0176e93bf7', 'intsurveyno': '181', 'stremailaddress ': 'johnsmith@example.com,lizabrown@example.com'}

resp = requests.post(url,

data = json.dumps(payload), headers = {'Content-Type': 'application/json'})

resp.json()

Copied!
Click to copy

                              
Imports System.Collections.Generic  

Imports System.Text  

Imports Newtonsoft.Json  

Imports System.Net.Http  

Imports System.Web.Script.Serialization  

   

Namespace APICallsUsingCSharp  

Public Class Result  

Public Property Status As String  

Public Property ReopenStatus As String  

End Class  

   

Class Program  

Private Sub reopenresponse()  

Dim apiUrl As String = "https://template.sogolytics.com/serviceAPI/service"  

Dim input = New With {  

Key .token = "41e5b9b6-5aae-40a1-9bbb-bd0176e93bf7",   

Key.intsurveyno = "181",   

Key.stremailaddress = "johnsmith@example.com,lizabrown@example.com"  

}  

Dim inputJson As String = (New JavaScriptSerializer()).Serialize(input)  

Dim client As HttpClient = New HttpClient()  

Dim inputContent As HttpContent = New StringContent(inputJson, Encoding.UTF8, "application/json")  

Dim response As HttpResponseMessage = client.PostAsync(apiUrl & "/reopenresponse", inputContent).Result  

   

If response.IsSuccessStatusCode Then  

Dim results As List(Of Result) = (New JavaScriptSerializer()).Deserialize(Of List(Of Result))(response.Content.ReadAsStringAsync().Result)  

End If  

End Sub  

End Class  

End Namespace  
Output
Output Parameter:-  

{  

    "Status": "Success",  

    "ReopenStatus": [  

        {  

            "EmailAddress": "johnsmith@example.com",  

            "Status": "Success",  

            "Message": null  

        },  

        {  

            "EmailAddress": " lizabrown@example.com",  

            "Status": "Fail",  

            "Message": "Only completed single-use links can be reopened."  

        }  

    ]  

} 
Output Parameter:-  

{  

    "Status": "Success",  

    "ReopenStatus": [  

        {  

            "EmailAddress": "johnsmith@example.com",  

            "Status": "Success",  

            "Message": null  

        },  

        {  

            "EmailAddress": " lizabrown@example.com",  

            "Status": "Fail",  

            "Message": "Only completed single-use links can be reopened."  

        }  

    ]  

} 
Output Parameter:-  

{  

    "Status": "Success",  

    "ReopenStatus": [  

        {  

            "EmailAddress": "johnsmith@example.com",  

            "Status": "Success",  

            "Message": null  

        },  

        {  

            "EmailAddress": " lizabrown@example.com",  

            "Status": "Fail",  

            "Message": "Only completed single-use links can be reopened."  

        }  

    ]  

} 
Output Parameter:-  

{  

    "Status": "Success",  

    "ReopenStatus": [  

        {  

            "EmailAddress": "johnsmith@example.com",  

            "Status": "Success",  

            "Message": null  

        },  

        {  

            "EmailAddress": " lizabrown@example.com",  

            "Status": "Fail",  

            "Message": "Only completed single-use links can be reopened."  

        }  

    ]  

} 
Output Parameter:-  

{  

    "Status": "Success",  

    "ReopenStatus": [  

        {  

            "EmailAddress": "johnsmith@example.com",  

            "Status": "Success",  

            "Message": null  

        },  

        {  

            "EmailAddress": " lizabrown@example.com",  

            "Status": "Fail",  

            "Message": "Only completed single-use links can be reopened."  

        }  

    ]  

} 

getProjectParticipationStatus()

This method can be used to obtain participation status using the participant’s email address.

Input ParameterData TypeDescription
tokenStringToken generated in the platform.
intsurveynoStringThis is the unique identifier for the survey
distributiontypeIntegerSpecify the distribution type. Input 1 for email invites, 2 for SMS, and 3 for Survey access passwords
includeparticipationlinkIntegerInput 1 to fetch participation links for each invitee, else input 0
 
Output ParameterData TypeDescription
OverAllStatusStringThe overall status of all the participants is displayed

Copied!
Click to copy

                              

using System.Text;

using System.Net.Http;

using System.Web.Script.Serialization;

namespace APICallsUsingCSharp

{

public class Result

{

public string Data { get; set; }

public string Status { get; set; }

public string Description { get; set; }

}

public class Program

{

private void Main()

{

string apiUrl = "https://template.sogolytics.com/serviceAPI/service";

var input = new

{

token = "41e5b9b6-5aae-40a1-9bbb-bd0176e93bf7",

intsurveyno = "181",

distributiontype = 1,

IncludeParticipationLink = 0

};

string inputJson = (new JavaScriptSerializer()).Serialize(input);

HttpClient client = new HttpClient();

HttpContent inputContent = new StringContent(inputJson, Encoding.UTF8, "application/json");

HttpResponseMessage response = client.PostAsync(apiUrl + "/getProjectParticipationStatus", inputContent).Result;

if (response.IsSuccessStatusCode)

{

List results = (new JavaScriptSerializer()).Deserialize>(response.Content.ReadAsStringAsync().Result);

}

}

}

}

Copied!
Click to copy

                              

'41e5b9b6-5aae-40a1-9bbb-bd0176e93bf7', 'intsurveyno'=> '181', 'distributiontype' => 1, 'IncludeParticipationLink'=> 0];

$curl = curl_init($url);

curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);

curl_setopt($curl, CURLOPT_POST, true);

curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data));

curl_setopt($curl, CURLOPT_HTTPHEADER, [

'Content-Type: application/json'

]);

$response = curl_exec($curl);

curl_close($curl);

echo $response . PHP_EOL;

?>

Copied!
Click to copy
                           

curl https://template.sogolytics.com/serviceAPI/service/getProjectParticipationStatus -H "Content-type: application/json" -X POST -d "{\"token\": \"ea4764fa-7c4b-4099-9a32-156a6b800083\", \"intsurveyno\": \"5415\", \"distributiontype\": 1, \"IncludeParticipationLink\": 0}"

Copied!
Click to copy

                                 

import requests

import json

url = 'https://template.sogolytics.com/serviceAPI/service/getProjectParticipationStatus'

payload = {'token': 'ea4764fa-7c4b-4099-9a32-156a6b800083', 'intsurveyno': '5415', 'distributiontype': 1, 'IncludeParticipationLink': 0}

resp = requests.post(url,

data = json.dumps(payload), headers = {'Content-Type': 'application/json'})

resp.json()

Copied!
Click to copy

                              

Imports System.Text

Imports System.Net.Http

Imports System.Web.Script.Serialization

Public Class Result

Public Property Data As String

Public Property Status As String

Public Property Description As String

End Class

Module Module1

Sub Main()

Dim apiUrl As String = "https://template.sogolytics.com/serviceAPI/service"

Dim input = New With {Key .token = "41e5b9b6-5aae-40a1-9bbb-bd0176e93bf7", Key .intsurveyno = "181", Key . distributiontype = 1, Key . IncludeParticipationLink = 0}

Dim inputJson As String = (New JavaScriptSerializer()).Serialize(input)

Dim client As HttpClient = New HttpClient()

Dim inputContent As HttpContent = New StringContent(inputJson, Encoding.UTF8, "application/json")

Dim response As HttpResponseMessage = client.PostAsync(apiUrl & "/getProjectParticipationStatus", inputContent).Result

If response.IsSuccessStatusCode Then

Dim results As List(Of Result) = (New JavaScriptSerializer()).Deserialize(Of List(Of Result))(response.Content.ReadAsStringAsync().Result)

End If

End Sub

End Class

Output

When IncludeParticipationLink = 1

{"Data":"[{\"Email address\":\"ssmith@example.com\",\"distributionid\":181542348,\"Overall Status\":\"Email Delivered / Not Read\",\"Link\":\"https://surveysogolyticsqauc.sevenpv.com/k/QsRPRRVsUWQSsQXQUTRSTXsP\"}]","Status":"Success"}

When IncludeParticipationLink = 0

{"Data":"[{\"Email address\":\"ssmith@example.com\",\"distributionid\":181542348,\"Overall Status\":\"Sent for Delivery\"}]","Status":"Success"}

When IncludeParticipationLink = 1

{"Data":"[{\"Email address\":\"ssmith@example.com\",\"distributionid\":181542348,\"Overall Status\":\"Email Delivered / Not Read\",\"Link\":\"https://surveysogolyticsqauc.sevenpv.com/k/QsRPRRVsUWQSsQXQUTRSTXsP\"}]","Status":"Success"}

When IncludeParticipationLink = 0

{"Data":"[{\"Email address\":\"ssmith@example.com\",\"distributionid\":181542348,\"Overall Status\":\"Sent for Delivery\"}]","Status":"Success"}

When IncludeParticipationLink = 1

{"Data":"[{\"Email address\":\"ssmith@example.com\",\"distributionid\":181542348,\"Overall Status\":\"Email Delivered / Not Read\",\"Link\":\"https://surveysogolyticsqauc.sevenpv.com/k/QsRPRRVsUWQSsQXQUTRSTXsP\"}]","Status":"Success"}

When IncludeParticipationLink = 0

{"Data":"[{\"Email address\":\"ssmith@example.com\",\"distributionid\":181542348,\"Overall Status\":\"Sent for Delivery\"}]","Status":"Success"}

When IncludeParticipationLink = 1

{"Data":"[{\"Email address\":\"ssmith@example.com\",\"distributionid\":181542348,\"Overall Status\":\"Email Delivered / Not Read\",\"Link\":\"https://surveysogolyticsqauc.sevenpv.com/k/QsRPRRVsUWQSsQXQUTRSTXsP\"}]","Status":"Success"}

When IncludeParticipationLink = 0

{"Data":"[{\"Email address\":\"ssmith@example.com\",\"distributionid\":181542348,\"Overall Status\":\"Sent for Delivery\"}]","Status":"Success"}

When IncludeParticipationLink = 1

{"Data":"[{\"Email address\":\"ssmith@example.com\",\"distributionid\":181542348,\"Overall Status\":\"Email Delivered / Not Read\",\"Link\":\"https://surveysogolyticsqauc.sevenpv.com/k/QsRPRRVsUWQSsQXQUTRSTXsP\"}]","Status":"Success"}

When IncludeParticipationLink = 0

{"Data":"[{\"Email address\":\"ssmith@example.com\",\"distributionid\":181542348,\"Overall Status\":\"Sent for Delivery\"}]","Status":"Success"}

getParticipationStatusInfo()

This method can be used to obtain participation status using the participant’s email address.

Input ParameterData TypeDescription
tokenStringToken generated in the platform.
intsurveynoIntegerThis is the unique identifier for the survey
stremailaddressStringThe email address of the participant
issurveyaccesscodesBooleanTrue if survey access code was used, otherwise False

Output ParameterData TypeDescription
OverAllStatusStringProvides the status of the survey participation

Copied!
Click to copy

                              
using System.Collections.Generic;
using System.Text;
using Newtonsoft.Json;
using System.Net.Http;
using System.Web.Script.Serialization;

namespace APICallsUsingCSharp
{
    public class Result
    {
        public string Data { get; set; }
        public string Status { get; set; }
        public string Description { get; set; }
    }

    public class Program
    {
        private void getParticipationStatusInfo()
        {
            string apiUrl = "https://template.sogolytics.com/serviceAPI/service";
            var input = new
            {
                token = "41e5b9b6-5aae-40a1-9bbb-bd0176e93bf7",
                intsurveyno = "181",
                stremailaddress = "johnsmith@example.com",
                issurveyaccesscodes = "0"
            };
            string inputJson = (new JavaScriptSerializer()).Serialize(input);
            HttpClient client = new HttpClient();
            HttpContent inputContent = new StringContent(inputJson, Encoding.UTF8, "application/json");
            HttpResponseMessage response = client.PostAsync(apiUrl + "/getParticipationStatusInfo", inputContent).Result;
            if (response.IsSuccessStatusCode)
            {
                List<Result> results = (new JavaScriptSerializer()).Deserialize<List<Result>>(response.Content.ReadAsStringAsync().Result);
            }
        }
    }
}

Copied!
Click to copy

                              
<?php
$url = 'https://template.sogolytics.com/serviceAPI/service/getParticipationStatusInfo';
$data = ['token'=> '41e5b9b6-5aae-40a1-9bbb-bd0176e93bf7', 'intsurveyno'=> '181', 'stremailaddress' => 'johnsmith@example.com', 'issurveyaccesscodes'=> '0'];
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS,  json_encode($data));
curl_setopt($curl, CURLOPT_HTTPHEADER, [
  'Content-Type: application/json'
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response . PHP_EOL;
Copied!
Click to copy
                           

curl https://template.sogolytics.com/serviceAPI/service/getParticipationStatusInfo -H "Content-type: application/json" -X POST -d "{\"token\": \"f24d88f4-f1e6-4331-9e94-4067e8ce2d50\", \"intsurveyno\": \"181\", \"stremailaddress\": \"johnsmith@example.com\", \"issurveyaccesscodes\": \"0\"}"

Copied!
Click to copy

                                 

import requests
import json
url = 'https://template.sogolytics.com/serviceAPI/service/getParticipationStatusInfo'
payload = {'token': 'f24d88f4-f1e6-4331-9e94-4067e8ce2d50', 'intsurveyno': '181', 'stremailaddress': 'johnsmith@example.com', 'issurveyaccesscodes': '0'}
resp = requests.post(url,
data = json.dumps(payload), headers = {'Content-Type': 'application/json'})
resp.json()

Copied!
Click to copy

                              
Imports System.Text
Imports Newtonsoft.Json
Imports System.Net.Http
Imports System.Web.Script.Serialization

Public Class Result
    Public Property Data As String
    Public Property Status As String
    Public Property Description As String
End Class

Public Class Program
    Private Sub getParticipationStatusInfo()
        Dim apiUrl As String = "https://template.sogolytics.com/serviceAPI/service"
        Dim input = New With {Key .token = "41e5b9b6-5aae-40a1-9bbb-bd0176e93bf7", Key .intsurveyno = "181", Key .stremailaddress = "johnsmith@example.com", Key .issurveyaccesscodes = "0"}
        Dim inputJson As String = (New JavaScriptSerializer()).Serialize(input)
        Dim client As HttpClient = New HttpClient()
        Dim inputContent As HttpContent = New StringContent(inputJson, Encoding.UTF8, "application/json")
        Dim response As HttpResponseMessage = client.PostAsync(apiUrl & "/getParticipationStatusInfo", inputContent).Result

        If response.IsSuccessStatusCode Then
            Dim results As List(Of Result) = (New JavaScriptSerializer()).Deserialize(Of List(Of Result))(response.Content.ReadAsStringAsync().Result)
        End If
    End Sub
End Class
Output
{
    "Data": "{\"Table\":[{\"OverAllStatus\":\"Completed\"}]}",
    "Status": "Success",
    "Description": null
}
{
    "Data": "{\"Table\":[{\"OverAllStatus\":\"Completed\"}]}",
    "Status": "Success",
    "Description": null
}
{
    "Data": "{\"Table\":[{\"OverAllStatus\":\"Completed\"}]}",
    "Status": "Success",
    "Description": null
}
{
    "Data": "{\"Table\":[{\"OverAllStatus\":\"Completed\"}]}",
    "Status": "Success",
    "Description": null
}
{
    "Data": "{\"Table\":[{\"OverAllStatus\":\"Completed\"}]}",
    "Status": "Success",
    "Description": null
}

getSurveyList()

This method returns a list of all surveys in the account, including the relevant information listed below.

Input ParameterData TypeDescription
tokenStringToken generated in the platform.

OutputData TypeDescription
corporate_noDecimalProvides the Corporate Number associated with the account
survey_noDecimalThis is the unique identifier for the survey
TitleStringThis is the title given to the survey
start_dateDateTimeStart date of the survey
ResponsesDecimalTotal number of responses received for the survey
ActivateBooleanTrue if active, otherwise False
ExpiredBooleanTrue if expired, otherwise False
distribution_dateDateTimeDate when the survey was first distributed
MultilingualBooleanTrue if multilingual, otherwise False
AnonymityBooleanTrue if survey is anonymous, otherwise False
last_Response_UpdateDateTimeDate when the last response came in
lastEditDateDateTimeDate when the survey was last edited
CreatedbyDecimalIdentifies the user who created the survey
UniqueResponsesDecimalNumber of responses received for the survey through single-use invites.
PublicResponsesDecimalNumber of responses received for the survey through multi-use invites.
UniquePartialResponsesDecimalNumber of partial responses received for the survey through single-use invites.
PublicPartialResponsesDecimalNumber of partial responses received for the survey through multi-use invites.

Copied!
Click to copy

                              
using System.Collections.Generic;
using System.Text;
using Newtonsoft.Json;
using System.Net.Http;
using System.Web.Script.Serialization;

namespace APICallsUsingCSharp
{
    public class Result
    {
        public string Data { get; set; }
        public string Status { get; set; }
        public string Description { get; set; }
    }

    public class Program
    {
        private void getSurveyList()
        {
            string apiUrl = "https://template.sogolytics.com/serviceAPI/service";
            var input = new
            {
                token = "41e5b9b6-5aae-40a1-9bbb-bd0176e93bf7"
            };
            string inputJson = (new JavaScriptSerializer()).Serialize(input);
            HttpClient client = new HttpClient();
            HttpContent inputContent = new StringContent(inputJson, Encoding.UTF8, "application/json");
            HttpResponseMessage response = client.PostAsync(apiUrl + "/getSurveyList", inputContent).Result;
            if (response.IsSuccessStatusCode)
            {
                List<Result> results = (new JavaScriptSerializer()).Deserialize<List<Result>>(response.Content.ReadAsStringAsync().Result);
            }
        }
    }
}
Copied!
Click to copy

                              
<?php
$url = 'https://template.sogolytics.com/serviceAPI/service/getSurveyList';
$data = ['token'=> '41e5b9b6-5aae-40a1-9bbb-bd0176e93bf7'];
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS,  json_encode($data));
curl_setopt($curl, CURLOPT_HTTPHEADER, [
  'Content-Type: application/json'
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response . PHP_EOL;
Copied!
Click to copy
                           

curl https://template.sogolytics.com/serviceAPI/service/getSurveyList -H "Content-type:application/json" -X POST -d "{\"token\":\"41e5b9b6-5aae-40a1-9bbb-bd0176e93bf7\"}"

Copied!
Click to copy

                                 

import requests
import json
url = 'https://template.sogolytics.com/serviceAPI/service/getSurveyList'
payload = {'token':'41e5b9b6-5aae-40a1-9bbb-bd0176e93bf7'}
resp = requests.post(url,
data = json.dumps(payload), headers = {'Content-Type': 'application/json'})
resp.json()

Copied!
Click to copy

                              
Imports System.Text
Imports Newtonsoft.Json
Imports System.Net.Http
Imports System.Web.Script.Serialization

Public Class Result
    Public Property Data As String
    Public Property Status As String
    Public Property Description As String
End Class

Public Class Program
    Private Sub getSurveyList()
        Dim apiUrl As String = "https://template.sogolytics.com/serviceAPI/service"
        Dim input = New With {Key .token = "41e5b9b6-5aae-40a1-9bbb-bd0176e93bf7"}
        Dim inputJson As String = (New JavaScriptSerializer()).Serialize(input)
        Dim client As HttpClient = New HttpClient()
        Dim inputContent As HttpContent = New StringContent(inputJson, Encoding.UTF8, "application/json")
        Dim response As HttpResponseMessage = client.PostAsync(apiUrl & "/getSurveyList", inputContent).Result

        If response.IsSuccessStatusCode Then
            Dim results As List(Of Result) = (New JavaScriptSerializer()).Deserialize(Of List(Of Result))(response.Content.ReadAsStringAsync().Result)
        End If
    End Sub
End Class
Output
{
		"Data": "{\"Table\":[{\"corporate_no\":54547.0,\"survey_no\":2.0,\"title\":\"Event Planning Survey 2019\",\"start_date\":null,\"Responses\":0.0,\"activate\":false,\"Expired\":false,\"distribution_date\":null,\"Multilingual\":false,\"Anonymity\":false,\"semi_anonymous\":false,\"last_Response_Update\":null,\"lastEditDate\":\"2019-06-19T10:48:45.013\",\"Createdby\":54547.0,\"UniqueResponses\":0.0,\"PublicResponses\":0.0,\"UniquePartialResponses\":0.0,\"PublicPartialResponses\":0.0}]}",
		"Status": "Success",
		"Description": null
	}
{
		"Data": "{\"Table\":[{\"corporate_no\":54547.0,\"survey_no\":2.0,\"title\":\"Event Planning Survey 2019\",\"start_date\":null,\"Responses\":0.0,\"activate\":false,\"Expired\":false,\"distribution_date\":null,\"Multilingual\":false,\"Anonymity\":false,\"semi_anonymous\":false,\"last_Response_Update\":null,\"lastEditDate\":\"2019-06-19T10:48:45.013\",\"Createdby\":54547.0,\"UniqueResponses\":0.0,\"PublicResponses\":0.0,\"UniquePartialResponses\":0.0,\"PublicPartialResponses\":0.0}]}",
		"Status": "Success",
		"Description": null
	}
{
		"Data": "{\"Table\":[{\"corporate_no\":54547.0,\"survey_no\":2.0,\"title\":\"Event Planning Survey 2019\",\"start_date\":null,\"Responses\":0.0,\"activate\":false,\"Expired\":false,\"distribution_date\":null,\"Multilingual\":false,\"Anonymity\":false,\"semi_anonymous\":false,\"last_Response_Update\":null,\"lastEditDate\":\"2019-06-19T10:48:45.013\",\"Createdby\":54547.0,\"UniqueResponses\":0.0,\"PublicResponses\":0.0,\"UniquePartialResponses\":0.0,\"PublicPartialResponses\":0.0}]}",
		"Status": "Success",
		"Description": null
	}
{
		"Data": "{\"Table\":[{\"corporate_no\":54547.0,\"survey_no\":2.0,\"title\":\"Event Planning Survey 2019\",\"start_date\":null,\"Responses\":0.0,\"activate\":false,\"Expired\":false,\"distribution_date\":null,\"Multilingual\":false,\"Anonymity\":false,\"semi_anonymous\":false,\"last_Response_Update\":null,\"lastEditDate\":\"2019-06-19T10:48:45.013\",\"Createdby\":54547.0,\"UniqueResponses\":0.0,\"PublicResponses\":0.0,\"UniquePartialResponses\":0.0,\"PublicPartialResponses\":0.0}]}",
		"Status": "Success",
		"Description": null
	}
{
		"Data": "{\"Table\":[{\"corporate_no\":54547.0,\"survey_no\":2.0,\"title\":\"Event Planning Survey 2019\",\"start_date\":null,\"Responses\":0.0,\"activate\":false,\"Expired\":false,\"distribution_date\":null,\"Multilingual\":false,\"Anonymity\":false,\"semi_anonymous\":false,\"last_Response_Update\":null,\"lastEditDate\":\"2019-06-19T10:48:45.013\",\"Createdby\":54547.0,\"UniqueResponses\":0.0,\"PublicResponses\":0.0,\"UniquePartialResponses\":0.0,\"PublicPartialResponses\":0.0}]}",
		"Status": "Success",
		"Description": null
	}

getData()

This method can be used to obtain response Data in JSON format.

Input ParameterData TypeDescription
tokenStringToken generated in the platform.
intsurveynoIntegerThis is the unique identifier for the survey
isincludeincompleteresponsesBooleanTrue if you would like to add incomplete responses, otherwise false.
getassigncodesBooleanTrue if you would like to receive data with assigned codes.
intstartnoIntegerSpecify a response number to start fetching responses from
intendnoIntegerSpecify the response number up to which responses need to be fetched, or use ‘0’ to fetch all responses
 
Output ParameterData TypeDescription
strResponseJSONResponses in JSON format

Copied!
Click to copy

                              
using System.Collections.Generic; 
using System.Text; 
using Newtonsoft.Json; 
using System.Net.Http; 
using System.Web.Script.Serialization; 
namespace APICallsUsingCSharp 
{ 
public class QuestionAndAnswer 
{ 
public int Qno { get; set; } 
public int Sub_Qno { get; set; } 
public string QText { get; set; } 
public string QType { get; set; } 
public List<string> Answers { get; set; } 
} 
public class IndividualResponse 
{ 
public int SrNO { get; set; } 
public string ResponseNum { get; set; } 
public string EmailID { get; set; } 
public string IPAddress { get; set; } 
public string StartTime { get; set; } 
public string EndTime { get; set; } 
public List<QuestionAndAnswer> QuestionsAndAnswers { get; set; } 
} 
public class SurveyResponse 
{ 
public string Status { get; set; } 
public string Data { get; set; } 
public string Description { get; set; } 
public List<QuestionAndAnswer> QuestionsAndAnswers { get; set; } 
public List<IndividualResponse> IndividualResponses { get; set; } 
} 
public class Program 
{ 
private void getData() 
{ 
string apiUrl = "https://template.sogolytics.com/serviceAPI/service"; 
var input = new 
{ 
token = "41e5b9b6-5aae-40a1-9bbb-bd0176e93bf7", 
intsurveyno = "181", 
intstartno = "1", 
intendno = "0", 
getassigncodes = false 
}; 
string inputJson = (new JavaScriptSerializer()).Serialize(input); 
HttpClient client = new HttpClient(); 
HttpContent inputContent = new StringContent(inputJson, Encoding.UTF8, "application/json"); 
HttpResponseMessage response = client.PostAsync(apiUrl + "/getData", inputContent).Result; 
if (response.IsSuccessStatusCode) 
{ 
List<SurveyResponse> surveyResponses = (new JavaScriptSerializer()).Deserialize<List<SurveyResponse>>(response.Content.ReadAsStringAsync().Result); 
} 
} 
} 
} 
Copied!
Click to copy

                              
<?php 
$url = 'https://template.sogolytics.com/serviceAPI/service/getData'; 
$data = ['token'=> '41e5b9b6-5aae-40a1-9bbb-bd0176e93bf7', 'intsurveyno'=> '181', 'intstartno'=> '1', 'intendno'=> '0', 'getassigncodes'=> false]; 
$curl = curl_init($url); 
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); 
curl_setopt($curl, CURLOPT_POST, true); 
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data)); 
curl_setopt($curl, CURLOPT_HTTPHEADER, [ 
'Content-Type: application/json' 
]); 
$response = curl_exec($curl); 
curl_close($curl); 
echo $response . PHP_EOL; 
Copied!
Click to copy
                           
curl https://template.sogolytics.com/serviceAPI/service/getData -H "Content-type:application/json" -X POST -d "{\"token\":\"41e5b9b6-5aae-40a1-9bbb-bd0176e93bf7\",\"intsurveyno\":\"181\",\"intstartno\":\"1\",\"intendno\":\"0\",\"getassigncodes\":\"false\"}" 
Copied!
Click to copy

                                 
import requests 

import json 

url = 'https://template.sogolytics.com/serviceAPI/service/getData' 

payload = {'token': '41e5b9b6-5aae-40a1-9bbb-bd0176e93bf7', 'intsurveyno': '181', 'intstartno': '1', 'intendno': '0', 'getassigncodes': false} 

resp = requests.post(url, 

data = json.dumps(payload), headers = {'Content-Type': 'application/json'} 

resp.json() 
Copied!
Click to copy

                              
Imports System.Text 

Imports Newtonsoft.Json 

Imports System.Net.Http 

Imports System.Web.Script.Serialization 

 

Public Class QuestionAndAnswer 

Public Property Qno As Integer 

Public Property Sub_Qno As Integer 

Public Property QText As String 

Public Property QType As String 

Public Property Answers As List(Of String) 

End Class 

 

Public Class IndividualResponse 

Public Property SrNO As Integer 

Public Property ResponseNum As String 

Public Property EmailID As String 

Public Property IPAddress As String 

Public Property StartTime As String 

Public Property EndTime As String 

Public Property QuestionsAndAnswers As List(Of QuestionAndAnswer) 

End Class 

 

Public Class SurveyResponse 

Public Property Status As String 

Public Property Data As String 

Public Property Description As String 

Public Property QuestionsAndAnswers As List(Of QuestionAndAnswer) 

Public Property IndividualResponses As List(Of IndividualResponse) 

End Class 

 

Public Class Program 

Private Sub getData() 

Dim apiUrl As String = "https://template.sogolytics.com/serviceAPI/service" 

Dim input = New With {Key .token = "41e5b9b6-5aae-40a1-9bbb-bd0176e93bf7", Key .intsurveyno = "181", Key .intstartno = "1", Key .intendno = "0", Key.getassigncodes = false} 

Dim inputJson As String = (New JavaScriptSerializer()).Serialize(input) 

Dim client As HttpClient = New HttpClient() 

Dim inputContent As HttpContent = New StringContent(inputJson, Encoding.UTF8, "application/json") 

Dim response As HttpResponseMessage = client.PostAsync(apiUrl & "/getData", inputContent).Result 

 

If response.IsSuccessStatusCode Then 

Dim surveyResponses As List(Of SurveyResponse) = (New JavaScriptSerializer()).Deserialize(Of List(Of SurveyResponse))(response.Content.ReadAsStringAsync().Result) 

End If 

End Sub 

End Class 
Output
{ 
"Data": { 
"Questions": [ 
{ 
"QuestionNum": "1", 
"QuestionText": "Please rate your overall level of satisfaction with our product.", 
"AnswerOption": [ 
"1 - Very Dissatisfied", 
"2 - Dissatisfied", 
"3 - Neutral", 
"4 - Satisfied", 
"5 - Very Satisfied" 
] 
}, 
{ 
"QuestionNum": "2", 
"QuestionText": "How likely is it that you would recommend us to a friend or colleague?", 
"AnswerOption": [ 
"0 - Not at all Likely", 
"1", 
"2", 
"3", 
"4", 
"5", 
"6", 
"7", 
"8", 
"9", 
"10 - Extremely Likely" 
] 
}, 
{ 
"QuestionNum": "3", 
"QuestionText": "Thanks for the feedback. How can we earn your recommendation in the future?", 
"AnswerOption": [ 
null 
] 
}, 
{ 
 "QuestionNum": "4", 
"QuestionText": "That's great news! What makes you likely to recommend us?", 
"AnswerOption": [ 
 null 
] 
} 
], 
"Responses": [ 
{ 
"SrNO": "1", 
"ResponseNum": "1", 
"EmailID": "Public Access", 
"ParticipationStatus": "Completed", 
"IPAddress": "123.123.123.12", 
"StartTime": "2/28/2020 12:22 PM", 
"EndTime": "2/28/2020 12:22 PM", 
"AnswerSet": [ 
{ 
"QuestionNum": "1", 
"answer": "5 - Very Satisfied" 
}, 
{ 
"QuestionNum": "2", 
"answer": "9" 
}, 
{ 
"QuestionNum": "3", 
"answer": "" 
}, 
{ 
"QuestionNum": "4", 
"answer": "Easy of use and value for money." 
} 
] 
{ 
"Data": { 
"Questions": [ 
{ 
"QuestionNum": "1", 
"QuestionText": "Please rate your overall level of satisfaction with our product.", 
"AnswerOption": [ 
"1 - Very Dissatisfied", 
"2 - Dissatisfied", 
"3 - Neutral", 
"4 - Satisfied", 
"5 - Very Satisfied" 
] 
}, 
{ 
"QuestionNum": "2", 
"QuestionText": "How likely is it that you would recommend us to a friend or colleague?", 
"AnswerOption": [ 
"0 - Not at all Likely", 
"1", 
"2", 
"3", 
"4", 
"5", 
"6", 
"7", 
"8", 
"9", 
"10 - Extremely Likely" 
] 
}, 
{ 
"QuestionNum": "3", 
"QuestionText": "Thanks for the feedback. How can we earn your recommendation in the future?", 
"AnswerOption": [ 
null 
] 
}, 
{ 
 "QuestionNum": "4", 
"QuestionText": "That's great news! What makes you likely to recommend us?", 
"AnswerOption": [ 
 null 
] 
} 
], 
"Responses": [ 
{ 
"SrNO": "1", 
"ResponseNum": "1", 
"EmailID": "Public Access", 
"ParticipationStatus": "Completed", 
"IPAddress": "123.123.123.12", 
"StartTime": "2/28/2020 12:22 PM", 
"EndTime": "2/28/2020 12:22 PM", 
"AnswerSet": [ 
{ 
"QuestionNum": "1", 
"answer": "5 - Very Satisfied" 
}, 
{ 
"QuestionNum": "2", 
"answer": "9" 
}, 
{ 
"QuestionNum": "3", 
"answer": "" 
}, 
{ 
"QuestionNum": "4", 
"answer": "Easy of use and value for money." 
} 
] 
{ 
"Data": { 
"Questions": [ 
{ 
"QuestionNum": "1", 
"QuestionText": "Please rate your overall level of satisfaction with our product.", 
"AnswerOption": [ 
"1 - Very Dissatisfied", 
"2 - Dissatisfied", 
"3 - Neutral", 
"4 - Satisfied", 
"5 - Very Satisfied" 
] 
}, 
{ 
"QuestionNum": "2", 
"QuestionText": "How likely is it that you would recommend us to a friend or colleague?", 
"AnswerOption": [ 
"0 - Not at all Likely", 
"1", 
"2", 
"3", 
"4", 
"5", 
"6", 
"7", 
"8", 
"9", 
"10 - Extremely Likely" 
] 
}, 
{ 
"QuestionNum": "3", 
"QuestionText": "Thanks for the feedback. How can we earn your recommendation in the future?", 
"AnswerOption": [ 
null 
] 
}, 
{ 
 "QuestionNum": "4", 
"QuestionText": "That's great news! What makes you likely to recommend us?", 
"AnswerOption": [ 
 null 
] 
} 
], 
"Responses": [ 
{ 
"SrNO": "1", 
"ResponseNum": "1", 
"EmailID": "Public Access", 
"ParticipationStatus": "Completed", 
"IPAddress": "123.123.123.12", 
"StartTime": "2/28/2020 12:22 PM", 
"EndTime": "2/28/2020 12:22 PM", 
"AnswerSet": [ 
{ 
"QuestionNum": "1", 
"answer": "5 - Very Satisfied" 
}, 
{ 
"QuestionNum": "2", 
"answer": "9" 
}, 
{ 
"QuestionNum": "3", 
"answer": "" 
}, 
{ 
"QuestionNum": "4", 
"answer": "Easy of use and value for money." 
} 
] 
{ 
"Data": { 
"Questions": [ 
{ 
"QuestionNum": "1", 
"QuestionText": "Please rate your overall level of satisfaction with our product.", 
"AnswerOption": [ 
"1 - Very Dissatisfied", 
"2 - Dissatisfied", 
"3 - Neutral", 
"4 - Satisfied", 
"5 - Very Satisfied" 
] 
}, 
{ 
"QuestionNum": "2", 
"QuestionText": "How likely is it that you would recommend us to a friend or colleague?", 
"AnswerOption": [ 
"0 - Not at all Likely", 
"1", 
"2", 
"3", 
"4", 
"5", 
"6", 
"7", 
"8", 
"9", 
"10 - Extremely Likely" 
] 
}, 
{ 
"QuestionNum": "3", 
"QuestionText": "Thanks for the feedback. How can we earn your recommendation in the future?", 
"AnswerOption": [ 
null 
] 
}, 
{ 
 "QuestionNum": "4", 
"QuestionText": "That's great news! What makes you likely to recommend us?", 
"AnswerOption": [ 
 null 
] 
} 
], 
"Responses": [ 
{ 
"SrNO": "1", 
"ResponseNum": "1", 
"EmailID": "Public Access", 
"ParticipationStatus": "Completed", 
"IPAddress": "123.123.123.12", 
"StartTime": "2/28/2020 12:22 PM", 
"EndTime": "2/28/2020 12:22 PM", 
"AnswerSet": [ 
{ 
"QuestionNum": "1", 
"answer": "5 - Very Satisfied" 
}, 
{ 
"QuestionNum": "2", 
"answer": "9" 
}, 
{ 
"QuestionNum": "3", 
"answer": "" 
}, 
{ 
"QuestionNum": "4", 
"answer": "Easy of use and value for money." 
} 
] 
{ 
"Data": { 
"Questions": [ 
{ 
"QuestionNum": "1", 
"QuestionText": "Please rate your overall level of satisfaction with our product.", 
"AnswerOption": [ 
"1 - Very Dissatisfied", 
"2 - Dissatisfied", 
"3 - Neutral", 
"4 - Satisfied", 
"5 - Very Satisfied" 
] 
}, 
{ 
"QuestionNum": "2", 
"QuestionText": "How likely is it that you would recommend us to a friend or colleague?", 
"AnswerOption": [ 
"0 - Not at all Likely", 
"1", 
"2", 
"3", 
"4", 
"5", 
"6", 
"7", 
"8", 
"9", 
"10 - Extremely Likely" 
] 
}, 
{ 
"QuestionNum": "3", 
"QuestionText": "Thanks for the feedback. How can we earn your recommendation in the future?", 
"AnswerOption": [ 
null 
] 
}, 
{ 
 "QuestionNum": "4", 
"QuestionText": "That's great news! What makes you likely to recommend us?", 
"AnswerOption": [ 
 null 
] 
} 
], 
"Responses": [ 
{ 
"SrNO": "1", 
"ResponseNum": "1", 
"EmailID": "Public Access", 
"ParticipationStatus": "Completed", 
"IPAddress": "123.123.123.12", 
"StartTime": "2/28/2020 12:22 PM", 
"EndTime": "2/28/2020 12:22 PM", 
"AnswerSet": [ 
{ 
"QuestionNum": "1", 
"answer": "5 - Very Satisfied" 
}, 
{ 
"QuestionNum": "2", 
"answer": "9" 
}, 
{ 
"QuestionNum": "3", 
"answer": "" 
}, 
{ 
"QuestionNum": "4", 
"answer": "Easy of use and value for money." 
} 
] 

deleterecords()

This method can be used to delete records present under Track.

Input ParameterData TypeDescription
tokenStringToken generated in the platform.
intsurveynoIntegerThis is the unique identifier for the survey.
msidsIntegerThis is the unique identifier for every record.
 
Output ParameterData TypeDescription
strResponseJSONResponses in JSON format

Copied!
Click to copy

                              
using System; 

using System.Collections.Generic; 

using System.Text; 

using System.Net.Http; 

using System.Web.Script.Serialization; 

  

namespace WebAPISampleCode 

{ 

    public class RootObject 

    { 

        public string token { get; set; } 

        public string intsurveyno { get; set; } 

        public string msids{ get; set; } 

   } 

    public class Result 

    { 

        public string Status { get; set; } 

        public string Description { get; set; } 

    } 

  

    class Program 

    { 

        static void Main(string[] args) 

        { 

            deleterecords (); 

            Console.ReadKey(); 

        } 

  

        public static void deleterecords() 

        { 

            RootObject objRootObject = new RootObject(); 

            objRootObject.token = "1c2720f3-01a4-4bc7-a6be-c72d3d930dd1"; 

            objRootObject.intsurveyno = "5453"; 

            objRootObject.msids = "150221450,150221457"; 

 

           string apiUrl = "https://template.sogolytics.com/serviceAPI/service/deleterecords"; 

            string inputJson = (new JavaScriptSerializer()).Serialize(objRootObject); 

            HttpClient client = new HttpClient(); 

            HttpContent inputContent = new StringContent(inputJson, Encoding.UTF8, "application/json"); 

            HttpResponseMessage response = client.PostAsync(apiUrl + "/deleterecords", inputContent).Result; 

            if (response.IsSuccessStatusCode) 

            { 

                List<Result> results = (new   JavaScriptSerializer()).Deserialize<List<Result>>(response.Content.ReadAsStringAsync().Result); 

            } 

        } 

    } 

}
Copied!
Click to copy

                              
<?php 

$url = 'https://template.sogolytics.com/serviceAPI/service/deleterecords'; 

 $data = ['token'=> '2769058b-324e-4949-8367-2fa52ecdddfe', 'intsurveyno'=> '5420', msids=> 150221492,150221499 ']; 

 $curl = curl_init($url); 

 curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); 

 curl_setopt($curl, CURLOPT_POST, true); 

 curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data)); 

 curl_setopt($curl, CURLOPT_HTTPHEADER, [ 

 'Content-Type: application/json' 

 ]); 

 $response = curl_exec($curl); 

 curl_close($curl); 

 echo $response . PHP_EOL; 
Copied!
Click to copy
                           
curl https://template.sogolytics.com/serviceAPI/service/deleterecords -H "Content-type: application/json" -X POST -d "{\"token\": \"1c2720f3-01a4-4bc7-a6be-c72d3d930dd1\", \"intsurveyno\": \"5453\",\"msids\": \"150221492,150221499\"}"
Copied!
Click to copy

                                 
import requests 

import json 

url = 'https://template.sogolytics.com/serviceAPI/service/deleterecords' 

payload = {'token': '1c2720f3-01a4-4bc7-a6be-c72d3d930dd1', 'intsurveyno': '5453', 'msids': '150221478,150221485'} 

resp = requests.post(url, 

data = json.dumps(payload), headers = {'Content-Type': 'application/json'})

resp.json() 
Copied!
Click to copy

                              
Imports System.Text 

Imports System.Net.Http 

Imports System.Web.Script.Serialization 

  

Namespace WebAPISampleCode 

  

    Public Class RootObject 

        Public Property token As String 

        Public Property intsurveyno As String 

        Public Property msids As String 

    End Class 

  

    Public Class Result 

        Public Property Status As String 

        Public Property Description As String 

    End Class 

  

    Public Class Program 

        Shared Sub Main(ByVal args As String()) 

            deleterecords() 

        End Sub 

  

        Public Shared Sub deleterecords() 

  

            Dim objRootObject As RootObject = New RootObject() 

  

            objRootObject.token = "1c2720f3-01a4-4bc7-a6be-c72d3d930dd1" 

            objRootObject.intsurveyno = "5453" 

            objRootObject.msids = "150221464,150221471" 

  

            Dim apiUrl As String = "https://template.sogolytics.com/serviceAPI/service/deleterecords" 

            Dim inputJson As String = (New JavaScriptSerializer()).Serialize(objRootObject) 

            Dim client As HttpClient = New HttpClient() 

            Dim inputContent As HttpContent = New StringContent(inputJson, Encoding.UTF8, "application/json") 

            Dim response As HttpResponseMessage = client.PostAsync(apiUrl & "/deleterecords", inputContent).Result 

  

            If response.IsSuccessStatusCode Then 

                Dim results As List(Of Result) = (New JavaScriptSerializer()).Deserialize(Of List(Of Result))(response.Content.ReadAsStringAsync().Result) 

            End If 

  

        End Sub     

End Class 

End Namespace 
Output
{ 

    "Data":"2 record(s) deleted successfully.", 

    "Status":"Success" 

}
{ 

    "Data":"2 record(s) deleted successfully.", 

    "Status":"Success" 

}
{ 

    "Data":"2 record(s) deleted successfully.", 

    "Status":"Success" 

}
{ 

    "Data":"2 record(s) deleted successfully.", 

    "Status":"Success" 

}
{ 

    "Data":"2 record(s) deleted successfully.", 

    "Status":"Success" 

}