Merge pull request #9953 from hashicorp/website-vagrant-cloud-api-delete-token

website: Vagrant Cloud API docs - deleting tokens
This commit is contained in:
Justin Campbell 2018-06-27 14:04:28 -04:00 committed by GitHub
commit 45dcc43392
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 43 additions and 0 deletions

View File

@ -106,6 +106,7 @@ Vagrant Cloud may respond with the following response codes, depending on the st
##### **200** OK
##### **201** Created
##### **204** No Content
#### Client Errors
@ -361,6 +362,48 @@ Responds [`200 OK`](#200-ok) if the authentication request was successful, other
</div>
</div>
### Delete a token
`DELETE /api/v1/authenticate`
Responds [`204 OK`](#204-no-content) if the deletion request was successful, otherwise responds [`401 Unauthorized`](#401-unauthorized).
#### Example Request
<div class="examples">
<ul class="examples-header">
<li class="examples-menu examples-menu-shell"><a onclick="setExampleLanguage('shell');">cURL</a></li>
<li class="examples-menu examples-menu-ruby"><a onclick="setExampleLanguage('ruby');">Ruby</a></li>
</ul>
<div class="examples-body">
```shell
curl \
--header "Authorization: Bearer $VAGRANT_CLOUD_TOKEN" \
--request DELETE \
https://app.vagrantup.com/api/v1/authenticate
```
```ruby
# gem install http, or add `gem "http"` to your Gemfile
require "http"
api = HTTP.persistent("https://app.vagrantup.com").headers(
"Authorization" => "Bearer #{ENV['VAGRANT_CLOUD_TOKEN']}"
)
response = api.delete("/api/v1/authenticate")
if response.status.success?
# Success, the response attributes are available here.
p response.parse
else
# Error, inspect the `errors` key for more information.
p response.code, response.body
end
```
</div>
</div>
### Request a 2FA code
`POST /api/v1/two-factor/request-code`