[OLD] API Docs
These Docs apply to release version 3.0: https://github.com/DeveloperACE/Answery/releases/tag/v3.0
The api URL is https://answery.herokuapp.com/api/api.php
. all responses are in JSON.
?action=random
returns a random question out of all the questions in answery's list
?action=randomdynamic
returns a random dynamic question from answery's list (such as: which cat is cuter?)
?action=randomstatic
returns a random static question from answery's list (such as: How much do you like sunny days?)
?action=all
returns all the questions in answery's list. (coming soon)
"question":"Leaves are swell right?",
"answerType":"multiplechoice",
"choices":[
{...},
{...},
{...}
]
}
question
- This is the text of the question and is included in every response to a valid api call.
answerType
- This is a string specifying how the user should answer. Possibilities as of this writing are "short answer", "multiplechoice", and "rating" (rating means to display the user some kind of point scale to allow them to rank the thing mentioned in the question
).
choices
- An array containing possible choices, if applicable. This will be included for multiple choice questions. If the array contains one value, that means that al the answers are programmatically the same (see next section), and as such, you may duplicate that value as many times as you wish to get you to your desired number of options for the user.
{
"optionType":"text",
"optionContent":"Yes"
}
optionType
- Specifies the type of option that this is, possible types as of this writing are as follows:
-
"otherAPI" - the content of this option will be another array containing the path to an API used by answery as well as an index to use to get the desired value from that array. See the next section on "external API calls" for more information.
-
"image" - the content of this option will be an image path (or probably an external API call) to an image that can be used as a multiple-choice option for the user.
-
"text" - plain and simple text-based response option
-
"color" - currently only accompanied by the content "random", this option type basically means to generate a random color and present that to the user as a possible option
{
"path":"http:\/\/random.cat\/meow",
"key":"file",
"rawContent":false
}
path
- the URL of the API to call (sorry about the auto escaping of certain characters)
key
- the index to look for in the JSON response from the file at path
to get the desired value
rawContent
- if true, that means that the value that this API object represents is just the raw content of the URL given in path
. This is used for text-based, API-generated responses from the http://setgetgo.com/randomword/get.php API.