You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not entirely sure why this may be happening, but given the limited context, I think it's because when trying to update a field that's not currently available in the selected locale directly through the internal state, this doesn't get re-serialized properly when sent back to the API.
Therefore, to force the SDK to fetch the entry's content type and ensure field serialization, I'd recommend forcing the entry to the locale you want to edit, and then assign the field directly through the accessor properties, you can repeat this for any amount of locales you want to edit.
client=contentful_management.Client('TOKEN')
entry=client.entries('SpaceID').find('EntryID')
entry.locale='en-US'# or any other locale to editentry.name='name for english'entry.other_field='some other value'# and you can do the same for any number of localesentry.locale='es-AR'entry.name='nombre en español'# ... etc ...entry.save()
This will force the SDK to trigger the behaviour for looking up the content type for missing fields which gets triggered any time an assignment to a possible field happens.
Hope this helps,
Cheers
PS: I'll look into how to also introduce this behaviour for when trying to update the fields dictionary directly, but for the moment, the solution provided should work.
A simple request updating localized fields results in 422 errors.
The SDK forms payloads with wrongly formed fields insofar as it structures the updating property as
null
.In the following example:
The SDK generates a JSON payload with
Instead of
null
, it should instead be generatedname: 'test'
. Because of this error, the Management API prompts a 422 Validation error.The text was updated successfully, but these errors were encountered: