Skip to content

Instantly share code, notes, and snippets.

@markuman
Last active September 13, 2018 18:56
Show Gist options
  • Save markuman/fea22ade605b9633bab0f07501a92a02 to your computer and use it in GitHub Desktop.
Save markuman/fea22ade605b9633bab0f07501a92a02 to your computer and use it in GitHub Desktop.
# https://developer.scaleway.com/#snapshots-snapshots-post
import requests
import json
token = '...'
header = {'x-auth-token': token,'Content-type': 'application/json'}
serverurl = "https://cp-ams1.scaleway.com/servers"
r = requests.get(serverurl, headers=header)
volume_id = r.json()['servers'][0]['volumes']['0']['id']
body = {'name': 'test-0-1', 'organization': token, 'volume_id': volume_id}
snapshoturl = "https://cp-ams1.scaleway.com/snapshots"
r = requests.post(snapshoturl, headers=header, data=json.dumps(body))
# b'{"message": "Authorization required", "type": "authorization_required"}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment