How would I format the JSON, if I only want to add the EmailAddress, FirstName and LastName? I want to make all the other fields blank or not even added them, if possible.
I keep getting a 400 error Bad request, if I do not supply all the fields.
string content =
"{\"email_address\" : {"
+ "\"address\" : \"" + emailAddress + "\", "
+ "\"permission_to_send\" : \"implicit\""
+ "}, "
+ "\"first_name\" : \"" + firstName + "\", "
+ "\"last_name\" : \"" + lastName + "\", "
+ "\"job_title\" : \"test\", "
+ "\"company_name\" : \"tst\", "
+ "\"create_source\" : \"Account\", "
+ "\"birthday_month\" : 11, "
+ "\"birthday_day\" : 11, "
+ "\"anniversary\" : \"2006-11-15\", "
+ "\"steet_addresses\" : {"
+ "\"kind\": \"home\", "
+ "\"street\" : \"1221 Robinson Road\", "
+ "\"city\" : \"Houston\", "
+ "\"state\" : \"Texas\", "
+ "\"country\" : \"United States\", "
+ "} }";
This string does not work. I always get an error.
string content2 =
"{\"email_address\" : {"
+ "\"address\" : \"" + emailAddress + "\", "
+ "\"permission_to_send\" : \"implicit\""
+ "}, "
+ "\"first_name\" : \"" + firstName + "\", "
+ "\"last_name\" : \"" + lastName + "\", "
+ "\"job_title\" : \"\", "
+ "\"company_name\" : \"\", "
+ "\"create_source\" : \"Account\", "
+ "\"birthday_month\" : , "
+ "\"birthday_day\" : , "
+ "\"anniversary\" : \"\", "
+ "\"steet_addresses\" : {"
+ "\"kind\": \"\", "
+ "\"street\" : \"\", "
+ "\"city\" : \"\", "
+ "\"state\" : \"\", "
+ "\"country\" : \"\", "
+ "} }";
Solved! Go to Solution.
if getting that 400 error, then request is not formatted correctly. Do you have/use Postman? very valuable tool for testing Requests, among other things. link: https://www.getpostman.com/
example for adding contact:
{
"email_address": {
"address": "ddipper@hotmail.com",
"permission_to_send": "implicit"
},
"first_name": "Dipali",
"last_name": "Nipperdipper" ,
"create_source": "Contact"
}
if getting that 400 error, then request is not formatted correctly. Do you have/use Postman? very valuable tool for testing Requests, among other things. link: https://www.getpostman.com/
example for adding contact:
{
"email_address": {
"address": "ddipper@hotmail.com",
"permission_to_send": "implicit"
},
"first_name": "Dipali",
"last_name": "Nipperdipper" ,
"create_source": "Contact"
}
The holidays have come and gone. For many seasonal businesses, this means the rush of shoppers has decreased as well. Instead of turning off the lights and waiting for spring, make your email marketi...
See Article