Friday, August 16, 2013

REST API documentation

There are several tools to manage REST API documentation. Apiary.IO lets you create documentation from a terse blueprint written in their syntax. Input and output can be listed in an excel sheet and the scripts can be used to generate html pages.
HOST: https://testhost.openapi.starbucks.com

--- Sample API v2 ---
---
Welcome to the our sample API documentation. All comments can be written in (support [Markdown](http://daringfireball.net/projects/markdown/syntax) syntax)
---

--
OAuth workflow
The following is a section of resources related to the OAuth access grant methods
--
List products added into your shopping-cart. (comment block again in Markdown)
POST /v1/token
{ "grant_type":"password", "client_id":"abcdefg8hijklmno16", "client_secret=some_secret", "username":"test", "password":"password", scope:"test_scope"}
< 200
< Content-Type: application/json
{"return_type":"json","access_token":"nmhs7y7qmmh8mngyq2ncn3gp","token_type":"bearer","expires_in":3600,"refresh_token":"5skg9u4qdybksete8gaauvk3","scope":"test_scope","state":null,"uri":null,"extended":null}


OAuth workflow

The following is a section of resources related to the OAuth access grant methods

POST

/v1/token

List products added into your shopping-cart. (comment block again in Markdown)

Request
{ 
"grant_type":"password", 
"client_id":"abcdefg8hijklmno16", 
"client_secret=some_secret", 
"username":"test", 
"password":"password", 
scope:"test_scope"
}
Response
200 (OK)
    Content-Type: application/json
    
{"return_type":"json",
"access_token":"nmhs7y7qmmh8mngyq2ncn3gp",
"token_type":"bearer",
"expires_in":3600,
"refresh_token

No comments:

Post a Comment