6

I have a fresh Magento 2.1.5 install, and I'd like to access the full swagger spec, like the one published on http://devdocs.magento.com/swagger, but with the Try it Out! buttons enabled.

I've accessed my local swagger spec on http://localhost/magento2/swagger, but the services list isn't complete, when compared to the published on the Magento site.

3

2 Answers 2

15

That's actually correct behavior.

You need to generate API credentials in magento backend, authenticate, and insert token like on the image below: token

Token can be obtained from swagger web interface calling integrationAdminTokenServiceV1 or you can authenticate use curl:

curl -XPOST -H 'Content-Type: application/json' http://your-host/index.php/rest/V1/integration/admin/token -d '{ "username": "yourUsername", "password": "yourPassword" }'
3
  • Why this swagger rest api list isn't the same as the one here: devdocs.magento.com/guides/v2.1/rest/list.html ?
    – DevonDahon
    Commented Jun 25, 2017 at 5:09
  • 2
    In order to see the full api list, I needed to create an integration in the admin and grant that integration full access to all APIs, then use the token for that integration. I was not able to see the full set of APIs using the admin user token even with a full control admin user.
    – Matt B
    Commented May 2, 2018 at 19:51
  • 1
    That's right @MattB swagger depends on the permissions and type of the token. Commented May 6, 2018 at 21:01
4

To see the full list of services you may want to generate a full permissions token from the admin panel.

  1. log into admin panel
  2. Navigate to Systems -> Integrations (under Extensions section)
  3. click on "Add a new Integration" Button
  4. Fill in the required fields and move to API tab on the left, for "Resource Access" select All
  5. Hit save and in the grid view click on Authorize.
  6. Grab the Access Token generated (and save the rest of the info, of course).
  7. Navigate to /swagger and paste that access token to see the full list of REST services on your site.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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