Skip to main content

You can get the list of products of specific categories using search criteria concept of rest api.

Below is the url for that .

www.yoururl/rest/V1/products?searchCriteria[filterGroups][0][filters][0][field]=category_id& searchCriteria[filterGroups][0][filters][0][value]=2& searchCriteria[filterGroups][0][filters][0][conditionType]=eq&searchCriteria[sortOrders][0][field]=created_at& searchCriteria[sortOrders][0][direction]=DESC& searchCriteria[pageSize]=10& searchCriteria[currentPage]=1

Here i am getting products which having category id : 2

Here Id 2 is for jacket.

Same way you can pass your category id with the given criteria.

Authorization Header

Note : Assuming you are aware about how to get token for rest api and how Remember to call rest apiinform the Authorization header.
It must contain Bearer + admin token.
The admin token can be obtained with the following request: curl -X POST 'https://YOURMAGENTOURL.com/index.php/rest/V1/integration/admin/token' \ -H 'Content-Type: application/json' \ --data-raw '{ "username": "YOURADMINUSERNAME", "password": "YOURADMINPASS" }'

You can get the list of products of specific categories using search criteria concept of rest api.

Below is the url for that .

www.yoururl/rest/V1/products?searchCriteria[filterGroups][0][filters][0][field]=category_id& searchCriteria[filterGroups][0][filters][0][value]=2& searchCriteria[filterGroups][0][filters][0][conditionType]=eq&searchCriteria[sortOrders][0][field]=created_at& searchCriteria[sortOrders][0][direction]=DESC& searchCriteria[pageSize]=10& searchCriteria[currentPage]=1

Here i am getting products which having category id : 2

Here Id 2 is for jacket.

Same way you can pass your category id with the given criteria.

Note : Assuming you are aware about how to get token for rest api and how to call rest api.

You can get the list of products of specific categories using search criteria concept of rest api.

Below is the url for that .

www.yoururl/rest/V1/products?searchCriteria[filterGroups][0][filters][0][field]=category_id& searchCriteria[filterGroups][0][filters][0][value]=2& searchCriteria[filterGroups][0][filters][0][conditionType]=eq&searchCriteria[sortOrders][0][field]=created_at& searchCriteria[sortOrders][0][direction]=DESC& searchCriteria[pageSize]=10& searchCriteria[currentPage]=1

Here i am getting products which having category id : 2

Here Id 2 is for jacket.

Same way you can pass your category id with the given criteria.

Authorization Header

Remember to inform the Authorization header.
It must contain Bearer + admin token.
The admin token can be obtained with the following request: curl -X POST 'https://YOURMAGENTOURL.com/index.php/rest/V1/integration/admin/token' \ -H 'Content-Type: application/json' \ --data-raw '{ "username": "YOURADMINUSERNAME", "password": "YOURADMINPASS" }'

Source Link
Manthan Dave
  • 9.9k
  • 2
  • 33
  • 54

You can get the list of products of specific categories using search criteria concept of rest api.

Below is the url for that .

www.yoururl/rest/V1/products?searchCriteria[filterGroups][0][filters][0][field]=category_id& searchCriteria[filterGroups][0][filters][0][value]=2& searchCriteria[filterGroups][0][filters][0][conditionType]=eq&searchCriteria[sortOrders][0][field]=created_at& searchCriteria[sortOrders][0][direction]=DESC& searchCriteria[pageSize]=10& searchCriteria[currentPage]=1

Here i am getting products which having category id : 2

Here Id 2 is for jacket.

Same way you can pass your category id with the given criteria.

Note : Assuming you are aware about how to get token for rest api and how to call rest api.