Skip to content

abheekda1/AwesomeSciBo-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AwesomeSciBo API

An awesome API for hosting user submitted questions and rounds randomly generated by AwesomeSciBo!

Bot

This API hosts rounds generated by the AwesomeSciBo bot, which you can install here.

Deployment/Installation

Deploying this API on your own server is relatively simple, and can be completed in just a few steps:

  1. Clone and enter the repository
git clone https://github.com/ADawesomeguy/AwesomeSciBo-API/ && cd AwesomeSciBo-API
  1. Install dependencies
npm i
  1. Run process (default port is 8000)
DATABASE_NAME=[DB_NAME] API_PORT=[PORT] MASTER_API_KEY=[RANDOM STRING] npm run start

Usage

Schemas:

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
}

Endpoints:

/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
}

Credit

The API was made by @ADawesomeguy for his bot, AwesomeSciBo.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published