"Billing region invalid" when PATCHing for custom fields

I used the following code for adding data to a contact’s custom field (using Laravel and GuzzleHttp):

$obj = new \StdClass();
$obj->content= $infs_points;
$obj->id = env('INFS_POINTS_FIELD_ID');

$response = $client->request('PATCH', $url, array(
    'json' => array(
        "custom_fields" => array(
            $obj
        )
    )
));

Unfortunately, I get an error saying {"message":"BILLING Region is invalid, SHIPPING Region is invalid"}. Now, when I do this using command line, I get no error and the operation succeeds:

curl -H "Content-Type: application/json" -X PATCH -d '{"custom_fields":[{"content": "23","id":"476"}]}' https://api.infusionsoft.com/crm/rest/v1/contacts/12?access_token=my_access_token.

Am I doing something wrong?

Hi @Ankush_Thakur please refer to previous post for the answer: Billing and shipping region invalid when updating contact - #2 by JonSmith

@JonSmith the problem that I think @Ankush_Thakur is referring to, and that I’m also having is that this error is given when using PATCH even if you are not setting any address fields. If the existing Contact record has a state value such as “FL” instead of “US-FL” then this error is preventing me from updating all the rest of the Contact’s fields. I’m not aware of their address fields, so it would be very messy to have to look them up and then find the ISO standards for them when all I want to do is update a custom field.

Current work-around is to use the data service or PUT (with dupeCheck based on Email), but it definitely seems like a bug to not allow any updates to a contact record based on an unrelated Billing State value that was set previously by an order form.

@Josh This is a bug and is fixed already. It should be deployed in release next week.

@bradb great news, thank you.

I am now getting exactly the same issue as mentioned above. When trying to update a contact record (even when not posting any address information) I get this error.

Is this a bug that has returned?

From this post:

I am following up on this to see if it is safe to use PATCH on existing contacts yet.

I have still been using PUT with a dupeCheck ever since 2017 to update a known existing Contact, just because I can’t safely use PATCH without being forced to overwrite the Contact’s address fields.

This seems like its surfaced again. I was using the API to update a contacts custom fields using PATCH about a month ago and now im getting an error returned:

‘GuzzleHttp\Exception\ClientException’ with message ‘Client error: PATCH https:\/\/api.infusionsoft.com\/crm\/rest\/v1\/contacts\/91?access_token=xxxxxxxxxxxxxxxxx resulted in a 400 Bad Request response:\n{"message":"BILLING Region is invalid"}\n’ in /home/contractorsinmot/public_html/cim/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:113\nStack trace:\n#0 /home/contractorsinmot/public_html/cim/vendor/guzzlehttp/guzzle/src/Middleware.php(66): GuzzleHttp\Exception\RequestException::create(Object(GuzzleHttp\Psr7\Request), Object(GuzzleHttp\Psr7\Response))…