如何使用REST API在magento 2中获取所有类别而无需任何登录或令牌?

时间:2019-11-06 06:34:30

标签: magento2

在剩余的API中使用管理令牌类别,但是没有令牌就无法解决如何在magento 2中获取所有没有令牌的类别的解决方案

1 个答案:

答案 0 :(得分:0)

默认情况下,Magento 2允许未经身份验证的少数端点被访问,这些端点被声明为anonymous资源。例如,无需任何身份验证即可访问V1/directory/currencyV1/directory/countries

但是,当用户需要访问非匿名端点时。必须启用此选项(Allow Anonymous Guest Access

Stores > Settings > Configuration > Services > Magento Web API > Web API Security > Allow Anonymous Guest Access

现在,可以通过使用此端点来获取未经身份验证的类别。

http://example.com/rest/V1/categories

注意:建议不要使用未经身份验证的Magento 2 REST API。