cancel
Showing results for 
Search instead for 
Did you mean: 

Magento 2.2.7 Rest API unaccessible in localhost

Magento 2.2.7 Rest API unaccessible in localhost

I am currently attempting to use REST API in Magento Community Edition 2.2.7. I pretty much followed the instruction on devdocs (https://devdocs.magento.com/guides/v2.3/rest/tutorials/orders/order-admin-token.html).

For authentication, I got Token and Secret for both Access and Client side from Admin panel, as <host>/rest/<store_code>/V1/integration/admin/token endpoint isn't working. PHP works perfectly fine.

However, when I try to access to API endpoint using Postman, it gives 404 Error, along with html of nginx status. Since I'm hitting 404, I don't think this is a permission issue but endpoint itself. I did take a look at Magento config file and Nginx config file, but there isn't really a change from original files. On the other hand, when I access localhost/swagger and use Access Token for API Key, it just gives me 500 Error. 

2 REPLIES 2

Re: Magento 2.2.7 Rest API unaccessible in localhost

Hi @ginny_lee 

 

I would suggest you to pass index.php in the URL, so your URL should be like below :

 

http://your_host_name/index.php/rest/V1/integration/admin/token

 

Also to access the swagger you don't need to pass any token - after your host URL you just need to pass swagger and you will see the lists.

 

Hope it helps !

 

 

if issue solved,Click Kudos & Accept as Solution

Re: Magento 2.2.7 Rest API unaccessible in localhost

Hello Manthan,

 

I already tried with index.php in the url, but it gave the same 404 result. Also, when I access http://localhost/swagger, it gives the same warning without any list:

  • Failed to load API definition. Internal Server Error http://localhost/rest/all/scehma?services=all