Update a field with locale

Hi,

Is there a way to update a field with locale option? Say I have a short-text field with two languages for two locales. Is it possible to specify only one language to be updated?

Hi Hyang,

That is certainly possible and you just have to select which locale you refer to in the payload of your request, as:

curl -X POST
  -H "Authorization: Bearer <CONTENT_MANAGEMENT_KEY>"
  -H "Content-Type: application/vnd.contentful.management.v1+json"
  -d '{
   "name":"English (British)",
   "code":"en-GB"
}'
"https://api.contentful.com/spaces/<SPACE_ID>/locales"

Let me know if you’re using one of our SDKs and I can also provide you an example with that.

Hi Gabriel,

Thanks for the reply. I’m trying to do similar thing to your example using the Content Management API in Python as you can see here:

entry= self.client.entries(<space id>, <environment id>).find(<id>)
entry.name = {'en-US': 'englishname', 'en-GB': 'britishname'}

I got this error message:

contentful_management.errors.UnprocessableEntityError: HTTP status code: 422
Message: Validation error
Details:

  • Name: type - Path: ‘[‘fields’, ‘name’, ‘en-US’]’ - Value: {‘en-US’: ‘englishname’, ‘en-GB’: ‘britishname’}

Only been able to update the default locale language using this so far:

entry= self.client.entries(<space id>, <environment id>).find(<id>)
entry.name = 'englishname'