Skip to content

Instantly share code, notes, and snippets.

@justincampbell
Last active December 20, 2022 23:10
Show Gist options
  • Save justincampbell/27f3752e43055a51468bd859d6b8450d to your computer and use it in GitHub Desktop.
Save justincampbell/27f3752e43055a51468bd859d6b8450d to your computer and use it in GitHub Desktop.
Vagrant Cloud API Example

Vagrant Cloud API Example

Create box

curl \
  --header "X-Atlas-Token: $VAGRANT_CLOUD_TOKEN" \
  --header "Content-Type: application/json" \
  https://app.vagrantup.com/api/v1/boxes \
  --data '{"username":"justin_hashicorp", "name":"test"}'
{
  "created_at": "2017-10-16T19:29:09.415Z",
  "updated_at": "2017-10-16T19:29:09.415Z",
  "tag": "justin_hashicorp/test",
  "name": "test",
  "short_description": null,
  "description_html": null,
  "username": "justin_hashicorp",
  "description_markdown": null,
  "private": true,
  "current_version": null,
  "versions": []
}

Create version

curl \
  --header "X-Atlas-Token: $VAGRANT_CLOUD_TOKEN" \
  --header "Content-Type: application/json" \
  https://app.vagrantup.com/api/v1/box/justin_hashicorp/test/versions \
  --data '{"version":{"version":"0.1.0", "description":"Testing"}}'
{
  "version": "0.1.0",
  "status": "unreleased",
  "description_html": "<p>Testing</p>\n",
  "description_markdown": "Testing",
  "created_at": "2017-10-16T19:29:09.415Z",
  "updated_at": "2017-10-16T19:29:09.415Z",
  "number": "0.1.0",
  "release_url": "https://app.vagrantup.com/api/v1/box/justin_hashicorp/test/version/0.1.0/release",
  "revoke_url": "https://app.vagrantup.com/api/v1/box/justin_hashicorp/test/version/0.1.0/revoke",
  "providers": []
}

Create provider

curl \
  --header "X-Atlas-Token: $VAGRANT_CLOUD_TOKEN" \
  --header "Content-Type: application/json" \
  https://app.vagrantup.com/api/v1/box/justin_hashicorp/test/version/0.1.0/providers \
  --data '{"provider":{"name":"virtualbox"}}'
{
  "name": "virtualbox",
  "hosted": true,
  "hosted_token": null,
  "original_url": null,
  "created_at": "2017-10-16T19:31:03.277Z",
  "updated_at": "2017-10-16T19:31:03.277Z",
  "download_url": "https://vagrantcloud.com/justin_hashicorp/boxes/test/versions/0.1.0/providers/virtualbox.box"
}

Release version

curl \
  --header "X-Atlas-Token: $VAGRANT_CLOUD_TOKEN" \
  -X PUT \
  https://app.vagrantup.com/api/v1/box/justin_hashicorp/test/version/0.1.0/release
{
  "version": "0.1.0",
  "status": "active",
  "description_html": "<p>Testing</p>\n",
  "description_markdown": "Testing",
  "created_at": "2017-10-16T19:29:09.415Z",
  "updated_at": "2017-10-16T19:31:52.351Z",
  "number": "0.1.0",
  "release_url": "https://app.vagrantup.com/api/v1/box/justin_hashicorp/test/version/0.1.0/release",
  "revoke_url": "https://app.vagrantup.com/api/v1/box/justin_hashicorp/test/version/0.1.0/revoke",
  "providers": [
    {
      "name": "virtualbox",
      "hosted": true,
      "hosted_token": null,
      "original_url": null,
      "created_at": "2017-10-16T19:31:03.277Z",
      "updated_at": "2017-10-16T19:31:03.277Z",
      "download_url": "https://vagrantcloud.com/justin_hashicorp/boxes/test/versions/0.1.0/providers/virtualbox.box"
    }
  ]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment