I want to update the Custom field information through webflow API but couldn’t see anything in the dev api for it.
Is it possible? If yes how?
Hi @aduttya! Great question - check this page out for more on updating a Collection Field here:
https://developers.webflow.com/data/reference/update-field
(note, you may want to call the GET Collection Details
API to retrieve the field ID for your Rich Text Field, which you’ll need to update the field)
If you want to update your Rich Text Field on an individual Collection Item, see this page:
https://docs.developers.webflow.com/data/reference/update-item
You can pass in under the fieldData
object in the request the key/value pair of the slug-name of the rich text field, and the new value (which can be stringified HTML).
I need to create/update the custom fields through API, At the following API reference I can use name and slug but in the CMS there are other fields like Reference, Multi-Reference which I can’t find info how to update.
https://developers.webflow.com/data/reference/create-item
The creation of a collection is possible through API but there I also don’t see how to add the additional fields (above mentioned).
This page may be of assistance with respect to how to update different types of fields, including ref/multi-ref:
https://developers.webflow.com/data/reference/field-types-item-values#set–multi-reference
And for example, to update a rich text field called “Free Text” (whose slug name is free-text
), my payload for the fieldData
in creating an item might look something like:
"fieldData": {
"name": "Blog Post 1",
"slug": "blog-post-1",
"free-text": "<h1>test</h1>"
}
I have tested it it works.
The other doubt I have is when I create a collection using
https://developers.webflow.com/data/reference/create-collection
endpoint I don’t see any option for custom field here.
How to Add a custom field while creating collection with API?
This might help you. Create Collection Field
But there aren’t any fields to set the custom fields there, How is it suppose to go there?
@aduttya do you mind walking through an example of what you’re looking to create and the roadblock you’re running up against?
You’ll want to create a collection with the link you posted above:
https://developers.webflow.com/data/reference/create-collection
Then use the id
from that response to then call the POST
Create Collection Field like Jeff posted above:
https://developers.webflow.com/data/reference/create-field
An example payload for creating a field:
POST https://api.webflow.com/v2/collections/your-new-collection-id-here/fields
{
"type": "RichText",
"displayName": "CustomPosts",
"helpText": "A field for custom rich text content"
}
So in all, you’ll want to call two APIs to accomplish setting fields on a collection:
- Create the collection
- Create the collection field(s)
If I am creating a collection with
https://developers.webflow.com/data/reference/create-collection
The custom fields you see in the image, How to send them with above API request?
If these fields aren’t created within collection, Would they can be used in an Item inside the collection?