How to create a new "reference field" item when PATCH a collection's item?

We would like to create / PUT / PATCH items by API, but come into a problem when dealing with reference fields.

The data of the “reference field” is the “item id” of another collection. That is understandable.

But in case the “reference” in another collection does not exist yet, is there a way to make Webflow create that item automatically in a PATCH?

I tried:

"example-field" : Japan,
"example-field" : "Japan",

Although it does not return an error, it looks like Webflow will not create a new item “Japan” in the Collection “country”.

Nothing about this is mentioned in the API document.

Is there a smart way or an official way to create a “reference” item when POST, PUT or PATCH a collection item that has reference fields?

Thanks~

You have to POST create the “reference” CMS item first before you can set its ID as the reference field value of another item.

Usually, this will require using a data store in Make/Integromat to store those “reference” items and look them up when needed.

Often, it’s much easier to just use Airtable as your backend and sync it automatically to Webflow with PowerImporter. It will take care of all this logic for you.

https://www.powerimporter.com/post/why-you-should-use-airtable-as-a-webflow-backend

1 Like

Interesting product :+1:

1 Like