Create or Update contact issue with addresses

On API it’s clearly saying that, country_code is required if region is specified

In our api request we’re not sending region just line1 or line2 for addresses like follows

[addresses] => Array
        [0] => Array
                [line1] => shah ali bag, 243 lane, dhaka
                [field] => BILLING

        [1] => Array
                [line1] => shah ali bag, 243 lane, dhaka
                [field] => SHIPPING


But the response is:

Client error: `PUT` resulted in a `400 Bad Request` response:

{“message”:“BILLING Country Code is invalid, SHIPPING Country Code is invalid”}

Can you please advise what is going on? Also on Zapier we can see anything can be added to any field but through the API you provided we cannot send, it’s throwing error e.g for website

Hi @Yazamo_Developers, we are actively looking into this and I believe that it is a bug that was recently introduced. It should not return a 400 with an error message if you don’t provide a value for country code.

okay, please let us know, also I can add anything from Zapier to the contact field but from our api we cannot save anything to any field, it returns the validation error. How can we do it like Zapier?

If you set the country_code field to a valid ISO code value it will allow you to save the contact without error.

I just don’t want to send any country and region, then it should not give us any error right? Can you let me know what is the best way to map anything into infusionsoft contact without having these unwanted error like Zapier Integration, because on Zapier we can save anything to any field, for phone->type if we send a string that doesn’t match with the types on infusionsoft it gives us error, but on Zapier it takes any string and show on infusionsoft contact.

Please advice, what should we do?

It sounds like you are using the REST API which does enforce validation on certain fields. I believe that Zapier uses the XML-RPC API which enforces very few validation rules and will allow you to save any value for phone type like you mentioned.

We are actively working to transition developers over to using REST so I would recommend against developing new integrations using XML-RPC.

Yes we’re using REST API, and we want it to be like Zapier, then should we change our method to XML-RPC or we should stay with REST API because it looks like, you guys are developing the REST api still?

The phone type drop down can be customized if you go into the UI and then hover over the Infusionsoft logo > CRM > Settings > Contact & Company Settings > General > Phone Types. This is the list of values that the REST API validates against.

However, you could use the XML-RPC API if you need to provide arbitrary values for the phone type field. We are no longer actively developing the XML-RPC API and will be sun setting it at some point in the future.