Adding Contact through API - V3
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\" : \"\", "
+ "} }";