Strapi provides a set of powerful APIs to let the developers create custom API end-points. In this article, we will be creating a custom API endpoint from scratch.
Not sure if this is the “proper” way, but my solution for this was to send the strapi jwt with the API request and then validating it on the server side in a custom policy.
for limiting the route to authenticated users, we don’t really need to write a custom policy. From the Roles & permissions UI, instead of public, we can select the roles to be one of the authenticated roles.
yes, once the access is restricted to authenticated roles, we need to make an authenticated request.
I hope you find the links useful. In case of queries, please feel free to ask.
I am getting the output in results, pagination format. Now I want to transform this to the default data, attributes format since the output of custom API is different from others.
this.transformResponse is not working in strapi new version.
Looking forward to the solution. I am stuck with this
Hi, there is a way to format the custom API response to the format from the content type endpoints that wish to include the data and meta objects for pagination?