webflow / js-webflow-api

Node.js SDK for the Webflow Data API
https://www.npmjs.com/package/webflow-api
299 stars 97 forks source link

updateItem not working #156

Open gitinthehole opened 2 months ago

gitinthehole commented 2 months ago

Hi there, We're trying to update an item but we keep getting an error: An error occurred while updating item in Webflow collection JsonError: Missing required key "id"

Our code is as follows

console.info(`itemId:`, itemId)
const updatedItem = await webflow.collections.items.updateItem(process.env.WEBFLOW_COLLECTION_ID, itemId, itemInfo)
console.info(`updatedItem:`, updatedItem)

We've verified that itemId is valid.

Please advise. Thanks much in advance.

gitinthehole commented 2 months ago

I ended up building my own Fetch and that worked better.

zplata commented 1 month ago

Hi @gitinthehole - sorry for the delayed response! We're hoping to quickly address this issue; it's a small caveat from the way our OpenAPI spec generates the SDK.

To get around this if you're still interested, you should be able to pass in a redundant id property in your itemInfo object and it should pass the request (try this with our updated version v2.4.0). A follow up fix will eliminate the need to do this. I'll keep this issue open until that core issue is resolved though. Glad you were able to find a work around!

gitinthehole commented 1 month ago

Hi @zplata - All good. Thank you for the update and the workaround. We're currently in a good spot so we're not in a crunch any more but hopefully this helps someone else. When the core issue is resolved, we look forward to giving this a try again.