Skip to content

Instantly share code, notes, and snippets.

@mpguerra
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mpguerra/8973616 to your computer and use it in GitHub Desktop.
Save mpguerra/8973616 to your computer and use it in GitHub Desktop.
A sample Active Docs Spec for an OAuth enabled Sentiment API
{
"basePath": "http://sentiment-api.herokuapp.com",
"apiVersion": "v1",
"apis": [
{
"path": "/v1/words/{word}.json",
"operations": [
{
"httpMethod": "GET",
"summary": "Returns the sentiment value of a given word",
"description": "<p>This operation returns the sentiment value on a scale from -5 to +5 of the given word.<p>For instance, the word \"awesome\" returns {\"word\":\"awesome\",\"sentiment\":4} with a positive connotation whereas \"damnit\" is less positive {\"word\":\"damnit\",\"sentiment\":-4}",
"group": "words",
"parameters": [
{
"name": "word",
"description": "The word whose sentiment is returned",
"dataType": "string",
"required": true,
"paramType": "path"
},
{
"name": "access_token",
"description": "Your access token",
"dataType": "string",
"paramType": "query"
}
]
},
{
"httpMethod": "POST",
"summary": "Sets the sentiment value of a given word",
"description": "<p>This operation allows you to set the sentiment value to a word.<p>The sentiment value needs to be on the range -5 to +5.",
"group": "words",
"parameters": [
{
"name": "word",
"description": "The word whose sentiment is returned",
"dataType": "string",
"required": true,
"paramType": "path"
},
{
"name": "value",
"description": "The sentiment value of the word, must be -5 to -1 for negative or to +1 to +5 for positive connotations",
"allowableValues": {
"values": [
"-5",
"-4",
"-3",
"-2",
"-1",
"1",
"2",
"3",
"4",
"5"
],
"valueType": "LIST"
},
"dataType": "string",
"required": true,
"defaultValue": "1",
"paramType": "query"
},
{
"name": "access_token",
"description": "Your access token",
"dataType": "string",
"paramType": "query"
}
]
}
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment