Skip to content

API Documentation

jlyneu edited this page Jul 14, 2017 · 17 revisions

Index - /api/index

Indicates whether application is live on port 3000.

Returns:

  • status (boolean) - true

Login- /api/login

Create a search query for Jimmy to answer.Takes:

  • username (string) - Saved in the token, but not really used.
  • password (string) - Password saved in JPASS environment variable.

Returns:

  • token (string) - 7-day JWT token.
  • status (boolean) - true or false success

Renew- /api/renew

Create a search query for Jimmy to answer.Takes:

  • token (string) - the token to test

Returns:

  • token (string) - 7-day JWT token if token was still good.
  • status (boolean) - False if token had expired.

Query - /api/query

Create a search query for Jimmy to answer.Takes:

  • text (string) - the query text. Max of 255 characters.
  • type (string) - query type. "search" for the search page. Allows for some flexibility.

Returns:

  • key (int) - id of the query you just made.
  • status (boolean) - true or false success

Queue - /api/queue

Return 10 elements on top of queue. Takes: nothing at the moment.

Returns:

  • queue (list) - list of Query objects with key, type, text, and paid.
  • status (boolean) - true or false success

Answer - /api/answer

API for submitting Jimmy's answer.Takes:

  • key (int) - the query id.
  • answer (string) - Jimmy's string answer. Max length 800 characters at the moment.
  • token (int) - JWT token.
  • type (string) - the type of query you are answering.
  • list (list[string]) - any list of information that can be included with the answer.

Returns:

  • status (boolean) - true or false success

Check - /api/check

Polling to see if answer is complete.Takes:

  • key (int) - the query id.

Returns:

  • answer (query object) - If an answer exists it returns the string answer.
  • text (string) - the user's search query text
  • list (list[string]) - the list answer component.
  • status (boolean) - true or false success

Recent - /api/recent

Return 10 most recently answered queries. Takes: nothing at the moment.

Returns:

  • recents (list) - list of Query objects with key, type, text, answer, and paid.
  • status (boolean) - true or false success

Question - /api/question

Return the search query text for a query id. Takes:

  • key (int) - the query id.

Returns:

  • key (int) - id of the query
  • text (string) - the user's search query text
  • type (string) - query type. "search" for the search page. Allows for some flexibility.
  • status (boolean) - true or false success
Clone this wiki locally