cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to get the categories list?

Unable to get the categories list?

Hi All,

 

I was unable to get list of categories through rest api which we created in magento website.

 

Can any one help me out. How to get all categories list through rest api calls?

 

I tried with below curl:

Request:

curl -X GET "http://192.168.1.173/index.php/rest/V1/categories/list" -H "Content-Type: application/json" -H "Authorization: Bearer 8oo3vq9wlmaageers95h5i7k6wo3ie8l"

 

Response:

{"message":"Invalid type for value: \"list\". Expected Type: \"int\"."}

 

Expected:

Showing list of categories which we created in website (inside our local setup)

 

4 REPLIES 4

Re: Unable to get the categories list?

Hi @Textile_Indus,

 

That's because your using list as a parameter and the API expects an integer as parameter (not a string).

Try with:

 

"http://192.168.1.173/index.php/rest/V1/categories"

Re: Unable to get the categories list?

Even if I use above suggested 

Request:

curl -X GET "http://192.168.1.173/index.php/rest/V1/categories" -H "Content-Type: application/json" -H "Authorization: Bearer 8oo3vq9wlmaageers95h5i7k6wo3ie8l" 

Result:

Gives default category its sub categories 

Expected: 

All root categories list which we created in our local magento CE setup.

 

Note:

I created 7 root categories a long with default category.

I need to get the all categories list

 

Re: Unable to get the categories list?

Hi @Textile_Indus,

 

I understand you will get only the current tree (it depends on the store you're requesting).

Each store group has it own root category.

I guess you won't get all the root categories in that way so maybe you'll need to create your own endpoint to get that information in that way.

Re: Unable to get the categories list?


Hi Damian Culotta,

How to create root category for specific store?
Can we create multiple root categories for specific store?
How to create "n" number of categories for specific store?
How to get the list of categories of selected specific store through rest api calls?