Content Management API
Creation of new records via API no longer requires to specify all fields
November 26th, 2021
This change was long overdue, and we're glad we were able to address it! 🥳
Suppose you have ie. a model with 10 fields, 9 of which are optional. Until now, when creating a record, you were required to specify... all 10 fields. If you didn't want any value for the optional ones, you were required to pass a null
value in any case, or the API call would fail:
In addition to being redundant and inconvenient, this was a maintainability problem over time, because when a new optional field gets added on the model, you need adapt every script and add that null
value. Well, now optional fields can be omitted from the payload during creation:
const record = await client.items.create({ itemType: "1234", requiredField: "Lorem ipsum",});
Nice, simple and clean. Happy friday!