Updating a multi values field

Hi there,

I am looking for updating a custom field with can has multi-values as :
Capture d’écran 2021-05-05 à 19.10.28

The field is empty and I want to add one of these value as example BROCHURE EAD

I am trying to call the api :

Here is the url :
https://api.pipedrive.com/v1/persons/8432?api_token=API_TOKEN

VERB : PUT

Headers :

{
  'Content-Type' => 'application/json', 
  'Accept' => 'application/json'
}

Here is the body :

{
  "id": 8432,
  "abc1ab158f9beac1cf92aa64ce1aa214ba79b8d2": "LIVRE BLANC: CODIR,BROCHURE EAD"
}

Even if I tried if only one value, it throw an error

{
  "id": 8432,
  "abc1ab158f9beac1cf92aa64ce1aa214ba79b8d2": "BROCHURE EAD"
}

Response

{
  "data": null,
  "error": "Bad request",
  "success": false,
  "error_info": "Visitez developers.pipedrive.com pour en savoir plus sur l’API de Pipedrive.",
  "additional_data": null
}

Can you help me ?

Thanks for reading ! :slight_smile:

Hi @Remi_Carette

In short, you need to use IDs not labels to set the field. Long version with an example:

I have a multi-value field for a Person that can take one of three values

In order to set this field, first I need to call GET /personFields (docs) and find my custom field in the response to get ids

After that I can call PUT /persons/<personId> with the following body:

{
   "2c804c080cb2fbba1c9d9c335ff3778dad8308af": "51, 52"
}

Where 2c804c080cb2fbba1c9d9c335ff3778dad8308af is a custom field key, and "51, 52" values I want to set.

As result, a person got these values

Hope it clarified things.

1 Like

Works well !
Thanks :slight_smile:

1 Like