How to Generate Full Swagger Doc for Magento 2 REST API

apimagento-2.1rest

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.

Best Answer

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" }'
Related Topic