Merge pull request #13007 from hashicorp/vancluever-fix-vagrant-cloud-docs

Some fixes for the Vagrant Cloud API docs
This commit is contained in:
Chris Marchesi 2022-11-28 15:15:51 -08:00 committed by GitHub
commit d588438840
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -108,6 +108,7 @@ In order to create a usable box on Vagrant Cloud, perform the following steps:
```shell ```shell
# Create a new box # Create a new box
curl \ curl \
--request POST \
--header "Content-Type: application/json" \ --header "Content-Type: application/json" \
--header "Authorization: Bearer $VAGRANT_CLOUD_TOKEN" \ --header "Authorization: Bearer $VAGRANT_CLOUD_TOKEN" \
https://app.vagrantup.com/api/v1/boxes \ https://app.vagrantup.com/api/v1/boxes \
@ -116,6 +117,7 @@ curl \
# Create a new version # Create a new version
curl \ curl \
--request POST \
--header "Content-Type: application/json" \ --header "Content-Type: application/json" \
--header "Authorization: Bearer $VAGRANT_CLOUD_TOKEN" \ --header "Authorization: Bearer $VAGRANT_CLOUD_TOKEN" \
https://app.vagrantup.com/api/v1/box/myuser/test/versions \ https://app.vagrantup.com/api/v1/box/myuser/test/versions \
@ -124,6 +126,7 @@ curl \
# Create a new provider # Create a new provider
curl \ curl \
--request POST \
--header "Content-Type: application/json" \ --header "Content-Type: application/json" \
--header "Authorization: Bearer $VAGRANT_CLOUD_TOKEN" \ --header "Authorization: Bearer $VAGRANT_CLOUD_TOKEN" \
https://app.vagrantup.com/api/v1/box/myuser/test/version/1.2.3/providers \ https://app.vagrantup.com/api/v1/box/myuser/test/version/1.2.3/providers \
@ -132,8 +135,9 @@ curl \
# Prepare the provider for upload/get an upload URL # Prepare the provider for upload/get an upload URL
response=$(curl \ response=$(curl \
--request GET \
--header "Authorization: Bearer $VAGRANT_CLOUD_TOKEN" \ --header "Authorization: Bearer $VAGRANT_CLOUD_TOKEN" \
https://app.vagrantup.com/api/v1/box/myuser/test/version/1.2.3/provider/virtualbox/upload) https://app.vagrantup.com/api/v1/box/myuser/test/version/1.2.3/provider/virtualbox/upload)
# Extract the upload URL from the response (requires the jq command) # Extract the upload URL from the response (requires the jq command)
@ -141,14 +145,14 @@ upload_path=$(echo "$response" | jq .upload_path)
# Perform the upload # Perform the upload
curl $upload_path --request PUT --upload-file virtualbox-1.2.3.box curl --request PUT "${upload_path}" --upload-file virtualbox-1.2.3.box
# Release the version # Release the version
curl \ curl \
--request PUT \
--header "Authorization: Bearer $VAGRANT_CLOUD_TOKEN" \ --header "Authorization: Bearer $VAGRANT_CLOUD_TOKEN" \
https://app.vagrantup.com/api/v1/box/myuser/test/version/1.2.3/release \ https://app.vagrantup.com/api/v1/box/myuser/test/version/1.2.3/release
--request PUT
``` ```
@ -225,6 +229,7 @@ Creates a new token for the given user.
```shell ```shell
curl \ curl \
--request POST \
--header "Content-Type: application/json" \ --header "Content-Type: application/json" \
https://app.vagrantup.com/api/v1/authenticate \ https://app.vagrantup.com/api/v1/authenticate \
--data ' --data '
@ -290,6 +295,7 @@ Responds [`200 OK`](#200-ok) if the authentication request was successful, other
```shell ```shell
curl \ curl \
--request GET \
--header "Authorization: Bearer $VAGRANT_CLOUD_TOKEN" \ --header "Authorization: Bearer $VAGRANT_CLOUD_TOKEN" \
https://app.vagrantup.com/api/v1/authenticate https://app.vagrantup.com/api/v1/authenticate
``` ```
@ -330,8 +336,8 @@ Responds [`204 OK`](#204-no-content) if the deletion request was successful, oth
```shell ```shell
curl \ curl \
--header "Authorization: Bearer $VAGRANT_CLOUD_TOKEN" \
--request DELETE \ --request DELETE \
--header "Authorization: Bearer $VAGRANT_CLOUD_TOKEN" \
https://app.vagrantup.com/api/v1/authenticate https://app.vagrantup.com/api/v1/authenticate
``` ```
@ -379,8 +385,9 @@ Sends a 2FA code to the requested delivery method.
```shell ```shell
curl \ curl \
--request POST \
--header "Content-Type: application/json" \ --header "Content-Type: application/json" \
https://app.vagrantup.com/api/v1/authenticate \ https://app.vagrantup.com/api/v1/two-factor/request-code \
--data ' --data '
{ {
"two_factor": { "two_factor": {
@ -443,6 +450,7 @@ end
```shell ```shell
curl \ curl \
--request GET \
--header "Authorization: Bearer $VAGRANT_CLOUD_TOKEN" \ --header "Authorization: Bearer $VAGRANT_CLOUD_TOKEN" \
https://app.vagrantup.com/api/v1/user/myuser https://app.vagrantup.com/api/v1/user/myuser
``` ```
@ -506,8 +514,9 @@ end
```shell ```shell
curl \ curl \
--request GET \
--header "Authorization: Bearer $VAGRANT_CLOUD_TOKEN" \ --header "Authorization: Bearer $VAGRANT_CLOUD_TOKEN" \
https://app.vagrantup.com/api/v1/search?q=test&provider=virtualbox "https://app.vagrantup.com/api/v1/search?q=test&provider=virtualbox"
``` ```
</Tab> </Tab>
@ -594,6 +603,7 @@ end
```shell ```shell
curl \ curl \
--request GET \
--header "Authorization: Bearer $VAGRANT_CLOUD_TOKEN" \ --header "Authorization: Bearer $VAGRANT_CLOUD_TOKEN" \
https://app.vagrantup.com/api/v1/box/myuser/test https://app.vagrantup.com/api/v1/box/myuser/test
``` ```
@ -704,6 +714,7 @@ end
```shell ```shell
curl \ curl \
--request POST \
--header "Content-Type: application/json" \ --header "Content-Type: application/json" \
--header "Authorization: Bearer $VAGRANT_CLOUD_TOKEN" \ --header "Authorization: Bearer $VAGRANT_CLOUD_TOKEN" \
https://app.vagrantup.com/api/v1/boxes \ https://app.vagrantup.com/api/v1/boxes \
@ -777,10 +788,10 @@ Response body is identical to [Reading a box](#read-a-box).
```shell ```shell
curl \ curl \
--request PUT \
--header "Content-Type: application/json" \ --header "Content-Type: application/json" \
--header "Authorization: Bearer $VAGRANT_CLOUD_TOKEN" \ --header "Authorization: Bearer $VAGRANT_CLOUD_TOKEN" \
https://app.vagrantup.com/api/v1/box/myuser/test \ https://app.vagrantup.com/api/v1/box/myuser/test \
--request PUT \
--data ' --data '
{ {
"box": { "box": {
@ -837,8 +848,8 @@ end
```shell ```shell
curl \ curl \
--header "Authorization: Bearer $VAGRANT_CLOUD_TOKEN" \
--request DELETE \ --request DELETE \
--header "Authorization: Bearer $VAGRANT_CLOUD_TOKEN" \
https://app.vagrantup.com/api/v1/box/myuser/test https://app.vagrantup.com/api/v1/box/myuser/test
``` ```
@ -884,6 +895,7 @@ Response body is identical to [Reading a box](#read-a-box).
```shell ```shell
curl \ curl \
--request GET \
--header "Authorization: Bearer $VAGRANT_CLOUD_TOKEN" \ --header "Authorization: Bearer $VAGRANT_CLOUD_TOKEN" \
https://app.vagrantup.com/api/v1/box/myuser/test/version/1.2.3 https://app.vagrantup.com/api/v1/box/myuser/test/version/1.2.3
``` ```
@ -959,6 +971,7 @@ end
```shell ```shell
curl \ curl \
--request POST \
--header "Content-Type: application/json" \ --header "Content-Type: application/json" \
--header "Authorization: Bearer $VAGRANT_CLOUD_TOKEN" \ --header "Authorization: Bearer $VAGRANT_CLOUD_TOKEN" \
https://app.vagrantup.com/api/v1/box/myuser/test/versions \ https://app.vagrantup.com/api/v1/box/myuser/test/versions \
@ -1024,10 +1037,10 @@ Response body is identical to [Reading a version](#read-a-version).
```shell ```shell
curl \ curl \
--request PUT \
--header "Content-Type: application/json" \ --header "Content-Type: application/json" \
--header "Authorization: Bearer $VAGRANT_CLOUD_TOKEN" \ --header "Authorization: Bearer $VAGRANT_CLOUD_TOKEN" \
https://app.vagrantup.com/api/v1/box/myuser/test/version/1.2.3 \ https://app.vagrantup.com/api/v1/box/myuser/test/version/1.2.3 \
--request PUT \
--data ' --data '
{ {
"version": { "version": {
@ -1084,8 +1097,8 @@ Response body is identical to [Reading a version](#read-a-version).
```shell ```shell
curl \ curl \
--header "Authorization: Bearer $VAGRANT_CLOUD_TOKEN" \
--request DELETE \ --request DELETE \
--header "Authorization: Bearer $VAGRANT_CLOUD_TOKEN" \
https://app.vagrantup.com/api/v1/box/myuser/test/version/1.2.3 https://app.vagrantup.com/api/v1/box/myuser/test/version/1.2.3
``` ```
@ -1129,9 +1142,9 @@ Response body is identical to [Reading a version](#read-a-version).
```shell ```shell
curl \ curl \
--request PUT \
--header "Authorization: Bearer $VAGRANT_CLOUD_TOKEN" \ --header "Authorization: Bearer $VAGRANT_CLOUD_TOKEN" \
https://app.vagrantup.com/api/v1/box/myuser/test/version/1.2.3/release \ https://app.vagrantup.com/api/v1/box/myuser/test/version/1.2.3/release
--request PUT
``` ```
</Tab> </Tab>
@ -1174,9 +1187,9 @@ Response body is identical to [Reading a version](#read-a-version).
```shell ```shell
curl \ curl \
--request PUT \
--header "Authorization: Bearer $VAGRANT_CLOUD_TOKEN" \ --header "Authorization: Bearer $VAGRANT_CLOUD_TOKEN" \
https://app.vagrantup.com/api/v1/box/myuser/test/version/1.2.3/revoke \ https://app.vagrantup.com/api/v1/box/myuser/test/version/1.2.3/revoke
--request PUT
``` ```
</Tab> </Tab>
@ -1221,6 +1234,7 @@ Response body is identical to [Reading a version](#read-a-version).
```shell ```shell
curl \ curl \
--request GET \
--header "Authorization: Bearer $VAGRANT_CLOUD_TOKEN" \ --header "Authorization: Bearer $VAGRANT_CLOUD_TOKEN" \
https://app.vagrantup.com/api/v1/box/myuser/test/version/1.2.3/provider/virtualbox https://app.vagrantup.com/api/v1/box/myuser/test/version/1.2.3/provider/virtualbox
``` ```
@ -1285,6 +1299,7 @@ end
```shell ```shell
curl \ curl \
--request POST \
--header "Content-Type: application/json" \ --header "Content-Type: application/json" \
--header "Authorization: Bearer $VAGRANT_CLOUD_TOKEN" \ --header "Authorization: Bearer $VAGRANT_CLOUD_TOKEN" \
https://app.vagrantup.com/api/v1/box/myuser/test/version/1.2.3/providers \ https://app.vagrantup.com/api/v1/box/myuser/test/version/1.2.3/providers \
@ -1352,10 +1367,10 @@ Response body is identical to [Reading a provider](#read-a-provider).
```shell ```shell
curl \ curl \
--request PUT \
--header "Content-Type: application/json" \ --header "Content-Type: application/json" \
--header "Authorization: Bearer $VAGRANT_CLOUD_TOKEN" \ --header "Authorization: Bearer $VAGRANT_CLOUD_TOKEN" \
https://app.vagrantup.com/api/v1/box/myuser/test/version/1.2.3/provider/virtualbox \ https://app.vagrantup.com/api/v1/box/myuser/test/version/1.2.3/provider/virtualbox \
--request PUT \
--data ' --data '
{ {
"provider": { "provider": {
@ -1414,8 +1429,8 @@ Response body is identical to [Reading a provider](#read-a-provider).
```shell ```shell
curl \ curl \
--header "Authorization: Bearer $VAGRANT_CLOUD_TOKEN" \
--request DELETE \ --request DELETE \
--header "Authorization: Bearer $VAGRANT_CLOUD_TOKEN" \
https://app.vagrantup.com/api/v1/box/myuser/test/version/1.2.3/provider/virtualbox https://app.vagrantup.com/api/v1/box/myuser/test/version/1.2.3/provider/virtualbox
``` ```
@ -1463,6 +1478,7 @@ Prepares the provider for upload, and returns a JSON blob containing an `upload_
```shell ```shell
response=$(curl \ response=$(curl \
--request GET \
--header "Authorization: Bearer $VAGRANT_CLOUD_TOKEN" \ --header "Authorization: Bearer $VAGRANT_CLOUD_TOKEN" \
https://app.vagrantup.com/api/v1/box/myuser/test/version/1.2.3/provider/virtualbox/upload) https://app.vagrantup.com/api/v1/box/myuser/test/version/1.2.3/provider/virtualbox/upload)
@ -1470,9 +1486,9 @@ response=$(curl \
upload_path=$(echo "$response" | jq .upload_path) upload_path=$(echo "$response" | jq .upload_path)
curl \ curl \
$upload_path \
--request PUT \ --request PUT \
--upload-file virtualbox-1.2.3.box --upload-file virtualbox-1.2.3.box \
"${upload_path}"
``` ```
</Tab> </Tab>
@ -1534,6 +1550,7 @@ provided in the `callback` field (complete with authentication header) finalizes
```shell ```shell
response=$(curl \ response=$(curl \
--request GET \
--header "Authorization: Bearer $VAGRANT_CLOUD_TOKEN" \ --header "Authorization: Bearer $VAGRANT_CLOUD_TOKEN" \
https://app.vagrantup.com/api/v1/box/myuser/test/version/1.2.3/provider/virtualbox/upload/direct) https://app.vagrantup.com/api/v1/box/myuser/test/version/1.2.3/provider/virtualbox/upload/direct)
@ -1542,14 +1559,14 @@ upload_path=$(echo "$response" | jq .upload_path)
callback=$(echo "$response" | jq .callback) callback=$(echo "$response" | jq .callback)
curl \ curl \
"$upload_path" \
--request PUT \ --request PUT \
--upload-file virtualbox-1.2.3.box --upload-file virtualbox-1.2.3.box \
"${upload_path}"
curl curl
$callback \ --request PUT \
--header "Authorization: Bearer $VAGRANT_CLOUD_TOKEN" \ --header "Authorization: Bearer $VAGRANT_CLOUD_TOKEN" \
--request PUT "${callback}"
``` ```
</Tab> </Tab>