JSON structure for adding test contact

I have figured out how to use API to list retrieve a contact or multiple contacts, but when attempting to add a test contact with API I keep getting error “400 Bad Request” returned from post.

Would someone tell me what is wrong with this JSON data:

{
  "email_addresses": {
                      "field":  "EMAIL1",
                      "email":  "testr@test.com"
                     },
  "addresses": {
                 "zip_code":  "70448",
                 "locality":  "Test City",
                 "region":  "LA",
                 "line1":  "Test Street Address line1",
                 "line2":  "Test Street Address line2",
                 "postal_code":  "70448",
                 "field":  "BILLING"
               },
  "given_name": "Tester",
  "family_name": "User"
}

TIA,
Billy

Hey @Billy_Rowe, It looks like your address objects need to be put in an array:

{
  "email_addresses": [
  	{
    "field": "EMAIL1",
    "email": "testr@test.com"
  }
  ],
      "addresses": [
        {
            "line1": "Test Street Address Line 1",
            "line2": "Test Street Address Line 2",
            "locality": "LA",
            "region": "California",
            "field": "BILLING",
            "postal_code": "70448",
            "zip_code": "70448",
            "zip_four": "",
            "country_code": "USA"
        }
    ],
  "given_name": "Tester",
  "family_name": "User"
}
1 Like