Edit Contact

This request is used to edit the details of an existing contact.

HTTP Request

URLMethodDescription
https://app.tellody.com/CampaignCloud/Subscription/<subscriptionId>/<path_variable> PUT Edit Contact Details

Path Variables

The API uses a different path variable for each type of contact information to be edited.For example, to edit the MSISDN, the URL has to be written usign the key "msisdn" at the end.

All calls should include as a path variable the actual value of the subscription Id of the contact to be edited.

NameDescription
"msisdn" This key is used as a path variable to edit the MSISDN of the contact.
"subscriber.email"

This key is used as a path variable to edit the email of the contact.

"subscriber.firstName" This key is used as a path variable to edit the first name of the contact.
"subscriber.middleName" This key is used as a path variable to edit the middle name of the contact.
"subscriber.lastName" This key is used as a path variable to edit the last name of the contact.
"subscriber.streetAddress" This key is used as a path variable to edit the address of the contact.
"subscriber.dateOfBirth" This key is used as a path variable to edit the birth date of the contact.
"subscriber.profession" This key is used as a path variable to edit the profession of the contact.

POST Parameters

Except for the path variables that need to be substituted in the request URL, the PUT request has to pass a data parameter including any of the following keys, based on the edited information.

NameDescription
"msisdn" This key is set to the new MSISDN as a string.
"subscriber" This key describes the subscriber as an object and is comprised by a list of keys which hold all information regarding the subscriber except for 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 key is part of "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" key can be excluded. Otherwise, an email value should be provided mandatorily.

"firstName" This key is part of "subscriber" object and sets the first name of the contact as a string value.
"middleName" This key is part of "subscriber" object and sets the middle name of the contact as a string value.
"lastName" This key is part of "subscriber" object and sets the last name of the contact as a string value.
"streetAddress" This key is part of "subscriber" object and sets the address of the contact as a string value.
"dateOfBirth" This key is part of "subscriber" object and sets a date as a string in the format: "yyyy-mm-dd".
"profession" This key is part of "subscriber" object and sets the profession as a string value.
"msisdn"

This key is not part of "subscriber" object and sets the MSISDN of the new contact as a string value.

Sample Request

PythonOther

# get new value for MSISDN from a file
text_file = open("textfile1.txt", "w")
text_file.write("\"+306909898876\"")
text_file.close()
# get new value for profession from a file
text_file = open("textfile2.txt", "w")
text_file.write("\"software developer\"")
text_file.close()
filepath_msisdn = 'textfile1.txt'
with open(filepath_msisdn) as fh:
	mydata=fh.read()
	
filepath_prof = 'textfile2.txt'
with open(filepath_prof) as fh:
	mydata=fh.read()
	
#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
headers = {"Content-Type" : "application/json", "X-XSRF-TOKEN" : xsrfToken}
#update contact info with subscriptionId=5
subscriptionId="5"
base_url="https://app.tellody.com/CampaignCloud/Subscription/" + subscriptionId 
	
#Edit MSISDN
response1 = my_session.put(base_url + "/msisdn", data=mydata,headers=headers,params={'file':filepath_msisdn}).json() 

#Edit profession 
response2 = my_session.put(base_url + "/subscriber.profession", data=mydata,headers=headers,params={'file':filepath_prof}).json() 
print(json.dumps(response2,ensure_ascii=False))

Sample Response

The key “outcome” returns the string “OK”, when the request is executed with success and the contact has been updated with the selected values.

{ 
   "outcome":"OK",
   "id":null,
   "data":null
}

Errors

In case of error, the “outcome” returns the value “Error” and the key ‘id’ contains a string with the description of the error as shown in the below example.

{
   "outcome":"Error",
   "data":null,
   "id":"Error: Validation failed for classes [com.msensis.campaign.entity.Subscription] during update time for groups [javax.validation.groups.Default, ]\nList of constraint violations:[\n\tConstraintViolationImpl{interpolatedMessage='The msisdn and the CountryCode must be both null or have both values', propertyPath=, rootBeanClass=class com.msensis.campaign.entity.Subscription, messageTemplate='The msisdn and the CountryCode must be both null or have both values'}\n\tConstraintViolationImpl{interpolatedMessage='{Phone number is not valid}', propertyPath=msisdn, rootBeanClass=class com.msensis.campaign.entity.Subscription, messageTemplate='{Phone number is not valid}' 
}\n]"
}
Back to Top