Cannot create company with state shortcodes through the API

Howdy,

We’ve noticed since 2019 there is a double standard for IFS API interactions that does not apply to user interactions.


You’ll notice that I can type random nonsense into the state field, and that’s great. Really, it’s just a string field; therefore there’s no enforcement of type etc. But if I were to do the same thing through the REST API, you’ll notice that my request gets rejected! Even if I use a valid state/province shortcode the API will say it is invalid.

Okay, so we came up with a really clever solution for this where we lookup the full name of the state from a table and then use THAT in our POST/PATCH request. This was working fine but then I realized, InfusionSoft provides a form for users to search multiple states by shortcode only
What?

Can you explain this to me? Is there a way I can use the XML-RPC API to post state shortcodes?

The Region field should conform to ISO_3166-2 standards, which means that for a Country of “US” it’s generally just as simple as providing “US-TX” for short values, or “Texas” for full name. There are libraries available for most major languages to provide the ISO list so that you can map it to dropdown values at need rather than hard-coding it.