Invalid US State code for Puerto Rico

Highlighted
Occasional Contributor

Invalid US State code for Puerto Rico

Hi!

 

I'm trying to update the CustomFields in a Contact List, but if the Contact has Puerto Rico as its state the API call PUT:contacts/{contactId} returns an error. I'm using the same JSON returned by GET:contacts/{contactId} and just changing the CustomFields.

 

I don't understand why this error happens. I'm working with a test ContactList with test users, and when I created them the Contact form allows to select Puerto Rico as state on the ConstanContacts Contact form.

 

Thanks for the help

1 REPLY 1
Highlighted
Moderator

Re: Invalid US State code for Puerto Rico

Hello!

 

Thank you for reaching out to the API Support team here at Constant Contact.

 

I received the following error when doing a PUT making no changes to the contact:

400 Bad Request

[{
    "error_key": "json.field.address.state_code.invalid",
    "error_message": "#/addresses/0/state_code: This attribute value is not a valid US State or Canadian Province."
}]

 

This appears to be an issue with our API not accepting "PR" as a valid state code. I will look into this as a possible bug. In the meantime, if you remove the state_code field from your PUT, you can keep the state field as "Puerto Rico" and your changes will be accepted.

 

 

Sincerely,

David B.

API Support Specialist

Developer Portal

View API documentation, code samples, get your API key.

Visit Page

Constant Contact Would Like To Hear From You!

We want to hear from customers like you about your favorite features and how they have helped your business or organization. Tell us by answering a few questions in...

Read More
Featured