From adf2a21ef839797b66524dc86fc6c16353b06b0a Mon Sep 17 00:00:00 2001 From: Justin Campbell Date: Fri, 20 Oct 2017 14:22:44 -0400 Subject: [PATCH] website: Add Vagrant Cloud API docs for orgs --- .../source/docs/vagrant-cloud/api.html.md.erb | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/website/source/docs/vagrant-cloud/api.html.md.erb b/website/source/docs/vagrant-cloud/api.html.md.erb index 84324a30d..d856b57ec 100644 --- a/website/source/docs/vagrant-cloud/api.html.md.erb +++ b/website/source/docs/vagrant-cloud/api.html.md.erb @@ -72,6 +72,8 @@ sidebar_current: "vagrant-cloud-api" * [Authentication Tokens](#authentication-tokens) * [Create a token](#create-a-token) * [Validate a token](#validate-a-token) +* [Organizations](#organizations) + * [Read an organization](#read-an-organization) * [Boxes](#boxes) * [Read a box](#read-a-box) * [Create a box](#create-a-box) @@ -385,6 +387,59 @@ Responds [`200 OK`](#200-ok) if the authentication request was successful, other +## Organizations + +### Read an organization + +`GET /api/v1/user/:username` + +#### Example Request + +
+ +
+ ```shell + curl \ + --header "X-Atlas-Token: $VAGRANT_CLOUD_TOKEN" \ + https://app.vagrantup.com/api/v1/user/myuser + ``` + + ```ruby + # gem install http, or add `gem "http"` to your Gemfile + require "http" + + api = HTTP.persistent("https://app.vagrantup.com").headers( + "X-Atlas-Token" => ENV['VAGRANT_CLOUD_TOKEN'] + ) + + response = api.get("/api/v1/user/myuser") + + 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 + ``` +
+
+ +#### Example Response + +```json +{ + "username": "myuser", + "avatar_url": "https://www.gravatar.com/avatar/130a640278870c3dada38b3d912ee022?s=460&d=mm", + "profile_html": "

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

\n", + "profile_markdown": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.", + "boxes": [] +} +``` + ## Boxes ### Read a box