Trying to change asset on a page

I am trying to convert images from jpg to webp, upload them back to webflow and change the asset with the webp image. Unfortunately, I can’t change the file of the asset so I am trying to recreate a new asset and update the new asset on the page.

When I try to update the webflow page, using ‘https://api.webflow.com/v2/pages/{page_id}/dom?locale={locale_id}
I get the following error if I don’t enter any locale_id:
Query should have required property ‘locale’\

If I enter a local a locale_id, I get an error saying that tit isn’t the primary locale_id (as described in the API description)

Is there any way to change images on a page through the API when it is the only locale?

You don’t need to go through all of that headache. There is a conversion option directly in the assets panel if you expand it.

Once you expand it, click the tiny checkbox under the asset (second image) and then click on Compress and choose WebP. It will update the format for you inside of Webflow without having to swap out the image.

image

image

1 Like

Not at the moment; as the description for the Update Page Content API mentions, it’s designed for secondary locales (this may change in the future though to support your primary locale!)

If this is for an App, you can make a Hybrid App and thus make an associated Designer Extension counterpart to your backend that’s calling Data APIs. The Designer Extension APIs have the ability to both upload assets (similar to the Data API, but it will reflect immediately in the Assets panel) and swap out the asset on the page.