Magento – Magento 2 : Not loading all the core Api’s in swagger

apimagento2

I have started to work with the swagger tool but there is one problem while interacting with swagger using localhost/magento/2.1/swagger but all the Api's is not loading and at the bottom, the error has been showing

error img on the bottom

{"schemaValidationMessages":[{"level":"error","message":"Can't read from file http://127.0.0.1/magento/2.1/rest/default/schema?services=all"}]}

I think I need to increase the memory limit to load all the api's. Tell me how can I load all the Api's.

Best Answer

It seems that after authenticating and adding the API key on the top we can get all methods.

However, the error displayed on the botton is because the ajax request to online.swagger.io returns the error. It's because, the service can't reach your local environment. So, it's not a real error.

ajax request to online.swagger.io image response from online.swagger.io

As previously mentioned here, to authenticate and get the api key, that will allow you to see all the available methods, just make a POST to /rest/V1/integration/admin/token with your credentials (as described here).

I.e.:

curl -X POST \
https://magento222.local.com.br/rest/V1/integration/admin/token \
  -H 'Content-Type: application/json' \
  -d '{"username": "myAdminLogin","password":"myAdminPass"}'
Related Topic