Cannot set Organization address using API v2

Hi,

I cannot figure out how I can update the address field of an organization using API v2. (It works with API v1.)
I’ve tried these formats, but none of them works. They either give a validation error, or removes the existing address value:
‘address’ => [[‘value’ => $address]]
‘address’ => [$address]
‘address’ => $address

Which is the correct request format?

Thank you in advance,
Andras

Hi Andras,

In V2 address is now an object with sub parameters so you need to pass the address to address.value (or the other fields available)
See my example below.

const body = {
        "address": {
            "value": "123 Example street, birmingham, B12 3AB",
            "country":  "UK",
            "postal_code": "B12 3AB"
        }
    }

If you view the response schema from the get organisation request this is the same format required for create/update.

Hope that helps :slight_smile:

1 Like

Hi,

The expected format is

"address": {
   "value": "New York"
}

with value being required and everything else being optional (street_number, route, sublocality, locality, admin_area_level_1, admin_area_level_2, country, postal_code, formatted_address).

So in your case you should use

'address' => ['value' => $address]
1 Like