Field type API validation Vé

Hi!!

I am facing an issue when updating values on custom fields on deals via the API.
The custom fields doc says that a custom field of type varchar accepts “texts up to 255 characters”.

I am therefore truncating all text to 255 characters but still get a 400 error: "{"success"=>false, "error"=>"Validation failed: custom_fields: Value of short text custom field cannot be longer than 255 characters", "code"=>"ERR_SCHEMA_VALIDATION_FAILED"}"

Here is a failing text string:

str = "Patrick Forlan est consultant indépendant avec une activité fluctuante. Il préfère un abonnement mensuel pour s'adapter à ses périodes de travail. Actuellement, il a beaucoup de contrats pour l'année en cours, mais il souhaite réduire son activité à l'..."
str.size # output is 255 meaning there are 255 characters in that string.
str.bytesize # output is 265

My strings are UTF-8 encoded (Which is default for ruby).
Am I expected to send a string of 255 characters or 255 bytes? Should I use an other encoding?
Are there specifications somewhere?

Thanks in advance for you help.

Hi Matthieu!

Which endpoint you’re using with this text?

I am using PATCH on https://api.pipedrive.com/api/v2/deals to update a deal.