3

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.

1
  • Nitish here, have you checked magento logs or php logs, did you find any thing? If yes then please share, it will help us to identify the exact root cause. I had the same issue before, it was an issue with custom extension.
    – Nits
    Jul 28 at 6:06

5 Answers 5

4

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"}'
1
0

I'm stuck here too

I also tried with an api_key in the form field on top, generated as described in this document:

http://devdocs.magento.com/guides/v2.1/rest/generate-local.html

using

curl -X POST "https://magento.host/index.php/rest/V1/integration/admin/token" \ -H "Content-Type:application/json" \ -d '{"username":"username", "password":"password"}'

but got the same message as @ramkishan

0

To get all admin api's just send a post request using integrationAdminTokenServiceV1 after hitting domain-name/swagger in browser.

This post request contains username and password of admin after hitting this request you will get a token just copy this token and paste it at api_key input at top-right of this page and click on apply button.

You will get all api's related to magento admin.

1
  • The error icon is still displayed in the bottom of the methods. May 14, 2018 at 3:32
0

Use this url to get your token

https://{{url_magento_test}}/rest/V1/integration/admin/token?username=username&password=password

Then add it here, it will load all api that need permission:

enter image description here

To debug what is wrong you cant visit the url that is expose: https://magento.test/rest/all/schema?services=all

-2

Magento core developers like to hard-code everything into there code.

The storeview "default" is ofcourse hard-coded Magento style.

Magento only works a little bit when you install it, like they did. At that is with everything called default and as simple as possible. But don't worry you can debug Magento for them in your own free time and submit a bug on github ! (2000+ and counting)

1
  • 1
    I also hate the bugs in M2 present in essential things. However, it doesn't help much complaining about them here. May 14, 2018 at 3:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.