Create custom endpoint for Users in strapi v4

Hey @Andrew_Andrew, I’m glad that helped!

Routes are related to your api.

You could have routes for your admin panel, or for the client side API (content-api)

For example, imagine you are developing a custom plugin (or extending one), and you need access to some data in the frontend part of your plugin but ONLY for the admin side. You will create a route with the type of admin-api and you can now make an API call to that custom route/controller and get data that you need.

As expected, the route you created (let’s say /plugin-name/templates), will be added to the settings and you could restrict it by admin roles:

However, you may also need to create controler and a route for the client side with the type content-api, which would allow you to access it like your other content type API’s (/api/restaurant etc…), and restrict it by user role types and as they show up in this section of the settings:

I hope that helps!

All the best

1 Like