Search code examples
strapi

strapi API: curl examples for searching


Can someone give me some simple curl examples for how to use the strapi API?

For example I can fetch items of a content type like this:

$ curl http://127.0.0.1:1337/products
$ curl http://127.0.0.1:1337/products/1

But how can I search for specific fields? I saw in the docs that there is a way to query for other fields than ID, like e.g. name of products. But what's the right URL syntax?


Solution

  • You can find all params here: https://strapi.io/documentation/developer-docs/latest/developer-resources/content-api/content-api.html#api-parameters

    curl http://127.0.0.1:1337/products?name=somename