Way to modify draft api , by making sure that all fields remain intact #74
-
|
I want to modify the ANS object by adding new fields under additional_properties, and I’m using the Draft API’s PUT method to update the ANS payload. However, when doing this, some fields from the original article—such as authors, creation_date, and content_restrictions—get dropped. In other cases, I run into errors because certain fields aren’t allowed in the ANS payload. What’s the correct way to use the Draft API so that I can update additional_properties without losing existing fields or triggering validation errors? Is there a recommended approach to handle this? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Updating
|
Beta Was this translation helpful? Give feedback.
-
|
Thankyou Rado !!. WIll try this out |
Beta Was this translation helpful? Give feedback.
-
|
this worked |
Beta Was this translation helpful? Give feedback.
Updating
additional_propertieswith the Draft API (without breaking ANS)Here’s a straightforward way to safely update
additional_propertieson a story using the Draft API, without losing fields like authors or running into validation errors.What’s going wrong
You’re seeing two things:
Fields disappear (authors, content_restrictions, etc.)
When you call:
the Draft API treats that as: “replace the draft’s ANS with whatever you send”. If you only send a partial ANS (for example, mainly
additional_propertiesand a few fields), anything you don’t include (likecredits.byfor authors orcontent_res…