From 969f6fda41a4fcf6d7d02f37c93db1cc96054ee6 Mon Sep 17 00:00:00 2001 From: Justin Campbell Date: Tue, 26 Jun 2018 12:44:56 -0400 Subject: [PATCH] website: Vagrant Cloud API docs - deleting tokens --- .../source/docs/vagrant-cloud/api.html.md.erb | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/website/source/docs/vagrant-cloud/api.html.md.erb b/website/source/docs/vagrant-cloud/api.html.md.erb index 693d42fe3..5b6d17ae1 100644 --- a/website/source/docs/vagrant-cloud/api.html.md.erb +++ b/website/source/docs/vagrant-cloud/api.html.md.erb @@ -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 +### 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 + +
+ +
+ ```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 + ``` +
+
+ ### Request a 2FA code `POST /api/v1/two-factor/request-code`