Skip to content

Instantly share code, notes, and snippets.

@pearkes
Last active August 29, 2015 14:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pearkes/b26b79b772ed34e53fc3 to your computer and use it in GitHub Desktop.
Save pearkes/b26b79b772ed34e53fc3 to your computer and use it in GitHub Desktop.

Uploading Boxes to Atlas via Curl

First, you'll need to get an access token.

Then, prepare the upload:

curl 'https://atlas.hashicorp.com/api/v1/box/USERNAME/BOX_NAME/version/VERSION/provider/PROVIDER_NAME/upload?access_token=ACCESS_TOKEN'

This should return something like this:

{
  "upload_path": "https://binstore.hashicorp.com/630e42d9-2364-2412-4121-18266770468e",
  "token": "630e42d9-2364-2412-4121-18266770468e"
}

Then, upload your box with the following command, with the filename in this case being foo.box:

curl -X PUT --upload-file @foo.box https://binstore.hashicorp.com/630e42d9-2364-2412-4121-18266770468e

When the upload finishes, you can verify it worked by making this request and matching the hosted_token it returns to the previously retrieved upload token.

curl 'https://atlas.hashicorp.com/api/v1/box/USERNAME/BOX_NAME/version/VERSION_NUMBER/provider/PROVIDER_NAME?access_token=ACCESS_TOKEN'

Your box should then be available for download.

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