js-webflow-api icon indicating copy to clipboard operation
js-webflow-api copied to clipboard

Missing required key "id" on update collection item

Open Paroca72 opened this issue 1 year ago • 1 comments

Hello,

If I try to update a collection item using webflow.collections.items.updateItem I got an error. Error: Missing required key "id"

But both the collection id and the item id passed to the function are correct.

await webflow.collections.items.updateItem(this.collection.id, id, {
            fieldData: data,
        });

Thanks

Paroca72 avatar Aug 22 '24 05:08 Paroca72

Hey @Paroca72 - thanks for raising this! We'll take a look at fixing this; in the meantime, if you set the id again in your

{
  id: id,
  fieldData: data,
}

payload, that should in the short-term hopefully allow the request to go through.

zplata avatar Aug 26 '24 17:08 zplata

@Paroca72 check out the updated code snippet here https://github.com/webflow/js-webflow-api/blob/2f92f2921cab6171fada1e2899d4f2270e815351/src/api/resources/collections/resources/items/client/Client.ts#L486-L540

Now the id field is only required on the item directly

dsinghvi avatar Dec 04 '24 10:12 dsinghvi