Join the Webstudio community

Updated last month

Callback for api resources?

At a glance

The community member is looking for a way to manipulate the response from an API resource on the server-side before it is injected into the page. They are using an endpoint that does not support sorting, and would like to sort the data before it is sent to the DOM. The community members suggest that this would require a backend wrapper like a worker, and that data manipulation like sorting is typically the job of the API/backend.

Useful resources
Is there a way to manipulate the response from an api resource on the WS serverside before it is made avaiable in body->settings and injected into the page.
I'm using an endpoint that does not support sorting: https://api.utdanning.no/onet/onet_by_yrke and i would be great if i could do the sorting on the response before the data is sent to to the DOM in ws.
I could do the fetch with a script in an embed, but then i would have to insert the data into the dom myself? Or is there a way of doing this that is easier?
B
b
O
3 comments
This requires some backend wrapper like worker. There is no way to do sorting out of the box for now.
Thanks for the quick response (unsorted) πŸ™‚
Yeah, its kindof the job of the API/backend to do data manipulation like sorting etc
Add a reply
Sign up and join the conversation on Discord