We are using your API to sync contacts. We are using the C# Wrapper and we get the below error when adding contacts.
json.field.address.state_code.and.state.mismatch:#/addresses/0/state_code: This attribute value does not match the specified state attribute MA.
This is happening with multiple states, not just MA. It seems to have started in our system about a month ago.
It looks like when we build the message we fill the State Name and State Code to the "State Code" value which in this case would be MA. Looking through the API, it looks like this should work and set the State Name by matching the state code in your API. Do we need to leave the State Name blank?
Solved! Go to Solution.
Thank you for reaching out to Constant Contact's API Support.
When using those fields you need to make sure you are using both the state and the state code. Here is an example of what it should look like in a JSON format.
"state_code": "MA", "state": "Massachusetts"
Ok. Would the error we are receiving be from setting the Sate to MA? I thought the API set the State if the correct State_Code was passed in?
"state_code": "MA", "state": "MA"
It is the other way around. The state is the full state name and it will set the state code.
It worked to send null for the state_code and the proper state value. I would like to point out that the API Documentation is incorrect for how the API is behaving. Maybe I am misreading it, but it looks to me like if I submit the proper state_code it should override the state property.
This field accepts any state or province name. However, if a valid 2 letter US state or Canadian province is entered in the state_code field, the system resolves the code to a state or province and overwrites any name manually entered in this field.
Standard 2 letter abbreviation for contact's state or Canadian province; if state_code is entered, the system overwrites the state property with the resolved US state or Canadien province name.
I would read this the same way you are reading it. I'll see if we can get this reworded. I'll check if it has always been this way or if we changed it. Thanks for pointing this out.