What is the correct format to pass an array of URLs to the Multi Image field in Webflow's API for updating?
TL;DR
- Prepare a JSON payload with an array of image URLs under the multi-image field key.
- Set headers with
Content-Typeasapplication/jsonand include the Authorization token. - Send a PUT request to the Webflow API with the payload to update the collection item.
To update a Multi Image field in Webflow using the API, you need to pass an array of URLs in a specific format.
1. API Request Preparation
- When you send the request to update a collection item, ensure your Content-Type is set to
application/json. - You will also need your Authorization token for authentication in the header.
2. Proper Array Format
- The array of image URLs should be included in the request payload where the Multi Image field key resides.
- Format the array as a JSON list:
"multiImageField": ["url1", "url2", "url3"].
3. Example JSON Payload
- Construct your JSON payload similar to this:
```json
{
"fields": {
"name": "Item Name",
"multiImageField": [
"https://example.com/image1.jpg",
"https://example.com/image2.jpg"
]
}
}
```
4. Make the PUT Request
- Send a PUT request to the appropriate URL, usually in the form of:
https://api.webflow.com/collections/{collectionid}/items/{itemid}.
5. Check for Success
- A successful update will typically return a confirmation JSON with updated item data.
Summary
To update a Multi Image field in Webflow via its API, structure your JSON payload with the image URLs in an array. Make a PUT request with the correctly formatted JSON to ensure the field updates appropriately.