How to have an API REST in 10 minutes with Strapi 🔵
The first thing we would do is open the terminal and copy the following script.
npx create-starpi-app my-app-name — quickstart
Now we will wait a moment for the dependencies to be installed and the necessary folders to be created.
We will proceed to create a user, with an email and a password
Now we will create a collection following the steps as shown in the image.
We will add the following fields, name, price, description, image, and a UID that will be the name and will be called slug
Field price like this
Field image like this
Finally, you must save, and your collection should look like this.
Now we will go to the Content Manager section and create our data.
Finally, we will save our new entry, and publish it.
Now we must give public permissions to our REST API, for this we will go to SETTINGS and USERS & PERMISSIONS PLUGIN, ROLES and PUBLIC.
Now we can consume, as follows with Postman.
To make a filter by ID what we will do is.
As you can see, the request returns all the data except the images, this is because we will have to send parameters for the request to return the images, and for this, we will do the following.
With that, we would have thousands of possibilities to start with our projects in a simple and fast way if you liked my explanation do not forget to like it and follow me since that would help me a lot 🙏