Rest Api - Only Products And Categories Are Working !

Hi there,

I was testing all the supported entities for the rest API with postman and for some reason only the products and categories requests are retrieving data, the rest shows the following error:

{
"message": "Forbidden",
"status": 403
}

I already changed the 'api_allow_customer' option to true in the config.local.php file.

Can you please suggest a fix for this issue ?

Thanks.

01.png

02.png

03.png

Hello!

Hi there,

I was testing all the supported entities for the rest API with postman and for some reason only the products and categories requests are retrieving data, the rest shows the following error:

{
"message": "Forbidden",
"status": 403
}

I already changed the 'api_allow_customer' option to true in the config.local.php file.

Can you please suggest a fix for this issue ?

Thanks.

Other API entities are not allowed for customers by default. In this case you need to either authorize with administrator's API key, or modify the existing entities, by adding a list of privileges that are allowed for the customers to the entity. For example I'm copying the code from the Products API entity (app/Tygh/Api/Entities/Products.php):

    public function privilegesCustomer()
    {
        return array(
            'index' => true
        );
    }

Hope it helps.

Hello!

Works as expected. Thanks for the explanation.

Regards.

You are welcome!