Interacting with the Strapi API
To access any API endpoint in Strapi, we will use the HOST
server and PORT
, followed by /api/
, and then the API ID (Plural) value.
Remember
The API ID (Plural) value was generated when we created the classroom content-type earlier in this chapter. It is usually the plural form of the content-type name.
So, to access the classroom
endpoint on our API, we can use the following URL: http://localhost:1337/api/classrooms
. This can be done from the browser since it's a GET
request, but let's get into the habit of using Postman early on. The expectation is that this endpoint should return a list of classrooms:
Setting permissions
We received a 403 Forbidden
HTTP status code from the backend. Strapi secures API endpoints by default, so we will have to explicitly tell it to allow access to the API for all users. To do that, let's head back to the admin panel...