Skip to content

Instantly share code, notes, and snippets.

@ryo-murai
Last active September 12, 2015 01:19
Show Gist options
  • Save ryo-murai/908a564c43a2be6f7d36 to your computer and use it in GitHub Desktop.
Save ryo-murai/908a564c43a2be6f7d36 to your computer and use it in GitHub Desktop.
Heroku API

Heroku REST API Examples


See Heroku Platform API for details.

  • Config Vars
  • Get
curl -n -X GET https://api.heroku.com/apps/${APP_NAME}/config-vars \
    -H "Accept: application/vnd.heroku+json; version=3"
  • Update
curl -n -X PATCH https://api.heroku.com/apps/${APP_NAME}/config-vars \
    -H "Accept: application/vnd.heroku+json; version=3" \
    -H "Content-Type: application/json" \
    -d '{ \
        "ERROR_PAGE_URL ": "//s3.amazonaws.com/heroku_pages/error.html", \
        "OTHER_CONFIG ": "abcd", \
    }'
  • Maintenance Mode
curl -n -X PATCH https://api.heroku.com/apps/${APP_NAME} \
    -H "Accept: application/vnd.heroku+json; version=3" \
    -H "Content-Type: application/json" \
    -d '{ \
        "maintenance": true \
    }'

tips

  • curl -n: Must read .netrc for user name and password
# .netrc example
machine api.heroku.com
login login_email@example.com
password 12345678-abcd-1234-efgh-ijkl5678mnop

or explicitly specify Authorization: header

    -H "Authorization: Bearer 12345678-abcd-1234-efgh-ijkl5678mnop" \
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment