An awesome API for hosting user submitted questions and rounds randomly generated by AwesomeSciBo!
This API hosts rounds generated by the AwesomeSciBo bot, which you can install here.
Deploying this API on your own server is relatively simple, and can be completed in just a few steps:
- Clone and enter the repository
git clone https://github.com/ADawesomeguy/AwesomeSciBo-API/ && cd AwesomeSciBo-API
- Install dependencies
npm i
- Run process (default port is 8000)
DATABASE_NAME=[DB_NAME] API_PORT=[PORT] MASTER_API_KEY=[RANDOM STRING] npm run start
Question Schema:
{
'Category': {
type: String,
enum: categoryNames
},
'Toss-Up Subcategory': {
type: String,
enum: subCategoryNames
},
'Bonus Subcategory': {
type: String,
enum: subCategoryNames
},
'Toss-Up Question Format': {
type: String,
enum: ["Multiple Choice", "Short Answer"]
},
'Toss-Up Question': String,
'Toss-Up Answer': String,
'Toss-Up Explanation': String,
'Bonus Question Format': {
type: String,
enum: ['Multiple Choice', 'Short Answer']
},
'Bonus Question': String,
'Bonus Answer': String,
'Bonus Explanation': String,
'Submitter': String,
'Timestamp': String,
'Source': String,
'Round': Number
}
/questions
Method GET
: Returns a list of all questions in the database.
Parameters:
Limit
(default: 0)Category
Submitter
Source
q
Example:
curl https://api.adawesome.tech/questions?Limit=5&Category=Biology&Category=Chemistry&Submitter=abheekd@adawesome.tech&Source=LOST&q=Methane
Returns: Question Schema
.
/questions/random
Method GET
: Returns a random question from the list.
Parameters:
Limit
(default: 1)Category
Submitter
Source
q
Example:
curl https://api.adawesome.tech/questions/ra ndom?Limit=5&Category=Biology&Category=Chemistry&Submitter=abheekd@adawesome.tech&Source=LOST&q=Methane
Returns: Question Schema
.
/questions/[id]/update
Method POST
: Updates a question from the database with the given ID.
Data: Question Schema
.
/apikeys/request
Method POST
: Adds an email to the database with an API key that is disabled until validated by someone with the master API key (defined upon running to program).
Data:
{
'Email': String
}
/apikeys/validate
Validates/invalidates API keys (best managed through webpage).
Method POST
(if request contains Master API Key
and Email
): Will update a user's API key (normally validating/invalidating).
Data:
{
'Master API Key': String,
'Email': String,
'Valid': Boolean
}
The API was made by @ADawesomeguy for his bot, AwesomeSciBo.