Skip to content

Instantly share code, notes, and snippets.

@tiernano
Last active March 29, 2018 22:13
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save tiernano/9c061ae8d1312190f152 to your computer and use it in GitHub Desktop.
Save tiernano/9c061ae8d1312190f152 to your computer and use it in GitHub Desktop.
Hubic, Swift and CURL
Get Endpoint:
curl -H "Authorization: Bearer <AUTHCODE>" https://api.hubic.com/1.0/account/credentials
returns:
{"token":"<AUTHTOKEN>","endpoint":"https://lb1.hubic.ovh.net/v1/<AUTHURL>","expires":"2015-04-01T23:01:08+02:00"}
Get List of files:
curl -H "X-Auth-Token: <AUTHTOKEN>" https://lb1.hubic.ovh.net/v1/<AUTHURL>/default?format=json -i -X GET
LOTS OF JSON HERE!!!
to upload a file:
time curl -i https://lb1.hubic.ovh.net/v1/<AUTHURL>/default/<filename> -X PUT -H "X-Auth-Token: <AUTHTOKEN>" -T <FILENAME>
Should return 201 result
Finally, download a file:
curl -H "X-Auth-Token: <AUTHTOKEN>" https://lb1.hubic.ovh.net/v1/<AUTHURL>/default/<filelocation> -i -X GET -o <output>
@netomx
Copy link

netomx commented Dec 18, 2015

downloading a file doesn't work, as listing the file doesn't give you the location. Any ideas?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment