Last active
December 5, 2019 22:04
-
-
Save peterjaap/85952d87f4d46df7ca1724b75f917a1e to your computer and use it in GitHub Desktop.
Generate PHP client with Swagger for Magento 2 including private endpoints (make sure you have the Swagger modules installed & enabled)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
SHOP_URL=https://yourshop.url | |
ADMIN_USERNAME=yourusername | |
ADMIN_PASSWORD=yourpassword | |
BEARER=$(curl -XPOST -H 'Content-Type: application/json' ${SHOP_URL}/index.php/rest/V1/integration/admin/token -d '{ "username": "${ADMIN_USERNAME}", "password": "${ADMIN_PASSWORD}" }') | |
curl -XGET -H "Authorization: Bearer ${BEARER}" ${SHOP_URL}/rest/default/schema?services=all | tee swagger.json | |
docker run --rm -v ${PWD}:/local swaggerapi/swagger-codegen-cli generate -i /local/swagger.json -l php -o /local/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment