Skip to content

Instantly share code, notes, and snippets.

@trnsnt
Created October 31, 2017 14:58
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trnsnt/8ec73cc1a0c1c6d696d5dbfdf506b671 to your computer and use it in GitHub Desktop.
Save trnsnt/8ec73cc1a0c1c6d696d5dbfdf506b671 to your computer and use it in GitHub Desktop.
Simple OVH API bash example
#!/bin/bash
OVH_CONSUMER_KEY="***"
OVH_APP_KEY="***"
OVH_APP_SECRET="***"
HTTP_METHOD="GET"
HTTP_QUERY="https://api.ovh.com/1.0/domain"
HTTP_BODY=""
TIME=$(curl -s https://api.ovh.com/1.0/auth/time)
CLEAR_SIGN="$OVH_APP_SECRET+$OVH_CONSUMER_KEY+$HTTP_METHOD+$HTTP_QUERY+$HTTP_BODY+$TIME"
SIG='$1$'$(echo -n $CLEAR_SIGN | openssl dgst -sha1 | sed -e 's/^.* //')
curl -X $HTTP_METHOD -H "Content-Type:application/json;charset=utf-8" -H "X-Ovh-Application:$OVH_APP_KEY" -H "X-Ovh-Timestamp:$TIME" -H "X-Ovh-Signature:$SIG" -H "X-Ovh-Consumer:$OVH_CONSUMER_KEY" --data "$HTTP_BODY" $HTTP_QUERY
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment