Repository navigation
Get preset glide transforms from the content API with REST #5756
|
Is there a way to get glide preset transforms back from the assets endpoint (or any other endpoint) of the Content API? For bonus points I'd also love to get the glide secret so I can do asset transforms on the fly while keeping the |
Replies: 3 comments 5 replies
|
You can customize the resources. In one of these resource classes, you could have it output a Glide URL. The GraphQL docs has an example of doing that. You could take the code and put it into the REST API Resource class. |
|
Extend the class, for example create app/Asset.php: In your service provider: You need to see which methods you need to override, in this example it helps us have the presets in the Content API response of a Collection. |
|
@jasonvarga your answer worked great, I hadn't read the Graph QL section of the docs. Sadly, however, I need it on the @afonic I tried your example but nothing was coming through... |
You can customize the resources.
https://statamic.dev/rest-api#customizing-resources
In one of these resource classes, you could have it output a Glide URL.
The GraphQL docs has an example of doing that. You could take the code and put it into the REST API Resource class.
https://statamic.dev/graphql#custom-fields