CMS API Publish Item "resource not found"

Hi,
Im trying to use the CMS API to create and publish CMS items. I have successfully managed to create the item, but when I try to publish it fails with the error “resource not found”. The item has been created and is returned if I use the “list items” API. I get the same error if I try to use the “try it” feature on the Webflow Developer documentation site as well.

Any pointers to what Im doing wrong would be greatly appreciated!

Duncan

Just to confirm:

You’re passing the item id of the newly created item via the publishedItemIds array in the request body and passing the same collection id as the one used to create the item in the path:

https://api.webflow.com/v2/collections/abc/items/publish where abc is your collectionId?

@dmitrypimenov thanks for the reply… I can confirm I was passing the itemIds and collection id correctly.

I have managed to work out what was wrong… I hadn’t published my site since I added the collection. Obvious when you think about it (how can you publish an item to a collection that hasn’t been published) but tricky in practice as you can query and create items in the unpublished collection.

Hopefully this will help someone else who makes the same rookie error in future!

Hey I’m having the same issue using the cms api. You mean you first need to publish the site or publish the collection ? I don’t see an endpoint for publishing a collection.

Yes, you can also granularly publish items using the /live endpoints - eg. Create Collection Item (Live)