Create Contact
This request is used to create a new contact.
HTTP Request
URL | Method | Description |
---|---|---|
https://app.tellody.com/CampaignCloud/Subscription | POST | Create contact |
POST Parameters
The contact's details have to be passed as a data parameter in the POST request.
In contact details, it is mandatory to set either MSISDN or email to create a new contact.
The "msisdn" key can be excluded from the request data only if a valid "email" value is provided in the request.Name | Description |
---|---|
"subscriber" | This key represents an object or a list of keys with all information regarding the subscriber, except for the MSISDN. As long as MSISDN is available it can be left blank as shown. Otherwise, an email value should be provided mandatorily.
e.g. "subscriber":{} |
"email" |
This parameter key is part of the "subscriber" object and is used to set the email address. A valid value has to be a string in the format Αυτή η διεύθυνση ηλεκτρονικού ταχυδρομείου προστατεύεται από τους αυτοματισμούς αποστολέων ανεπιθύμητων μηνυμάτων. Χρειάζεται να ενεργοποιήσετε τη JavaScript για να μπορέσετε να τη δείτε. As long a valid MSISDN is provided in the request, the "email" parameter can be excluded. Otherwise, an email value should be provided mandatorily. |
"firstName" | This parameter key is part of the "subscriber" object and is set to a string value for the first name of the contact. |
"middleName" | This parameter key is part of the "subscriber" object and is set to a string value for the middle name of the contact. |
"lastName" | This parameter key is part of the "subscriber" object and is set to a string value for the last name of the contact. |
"streetAddress" | This parameter key is part of the "subscriber" object and is set to a string value with the address of the contact. |
"dateOfBirth" | This parameter key is part of the "subscriber" object and is set to a date as a string in the format: "yyyy-mm-dd". |
"profession" | This parameter key is part of the "subscriber" object and is set to a string value for profession. |
"msisdn" |
This parameter key is not part of the "subscriber" object and it sets the MSISDN of the new contact as a string. |
Sample Request
#Retrieving the XSRF Token needed for Session
pingResponse = my_session.get("https://app.tellody.com/CampaignCloud/RememberMeController/ping")
#Import the X-XSRF-Token returned from RememberMeController/ping into the request headers
xsrfToken = pingResponse.headers.get("X-XSRF-TOKEN")
#HTTP request header
header = {"Content-Type" : "application/json", "X-XSRF-TOKEN" : xsrfToken}
data = {
"subscriber":{
"email":"Αυτή η διεύθυνση ηλεκτρονικού ταχυδρομείου προστατεύεται από τους αυτοματισμούς αποστολέων ανεπιθύμητων μηνυμάτων. Χρειάζεται να ενεργοποιήσετε τη JavaScript για να μπορέσετε να τη δείτε.",
"firstName":"Thomas",
"lastName":"Pierce",
"middleName":"Jeffry",
"streetAddress":"10 Johnson st",
"dateOfBirth":"2015-06-04",
"profession":"software developer"
},
"msisdn":"+306978199845"
}
response = my_session.post("https://app.tellody.com/CampaignCloud/Subscription", header, data).json()
print(json.dumps(response,ensure_ascii=False))
Sample Response
The new contact is created successfully when the result returns an integer value for "subscriptionId" key.
{
"subscriber":{
"middleName":"Jeffry",
"profession":"software developer",
"lastName":"Pierce",
"dateOfBirth":1433376000000,
"streetAddress":"10 Johnson st",
"email":"Αυτή η διεύθυνση ηλεκτρονικού ταχυδρομείου προστατεύεται από τους αυτοματισμούς αποστολέων ανεπιθύμητων μηνυμάτων. Χρειάζεται να ενεργοποιήσετε τη JavaScript για να μπορέσετε να τη δείτε.",
"firstName":"Thomas",
.....
},
"msisdn":"+306978199846",
"subscriptionId":75,
.....
}
Errors
If the result does not return a "subscriptionId", then the request has failed. More information on the issue can be derived by the HTTP response. (e.g. HTTP 400, 414 etc.)