Skip to content

Latest commit

 

History

History
117 lines (93 loc) · 2.13 KB

File metadata and controls

117 lines (93 loc) · 2.13 KB

API Documentation

Public End Points
Description Endpoint
Sign-up POST /api/auth/create-account/
Sign-in POST /api/auth/sign-in/
Verify User GET /api/auth/verify/
Sign-out User GET /api/auth/sign-out
Get all Decks GET /api/decks/
Get a Card POST /api/card/
Create a Play POST /api/play/
Get a user's deck progress POST /api/progress

POST /api/auth/create-account/

POST /api/auth/sign-in/

GET /api/auth/verify/

GET /api/auth/sign-out

GET /api/decks/

Fetches all decks in the database

Example response

[
  {
  "_id": "575462759373c5503b4afcfc",
  "updatedAt": "2016-06-05T17:33:41.390Z",
  "createdAt": "2016-06-05T17:33:41.390Z",
  "name": "Deck 1"
  },
  {
  "_id": "575462759373c5503b4afcfd",
  "updatedAt": "2016-06-05T17:33:41.390Z",
  "createdAt": "2016-06-05T17:33:41.390Z",
  "name": "Deck 2"
  }
]

POST /api/card/

Returns the next card to study.

Example Request

{
  "deckId": "575462759373c5503b4afcfc",
  "userId": "575462759373c5503b4afcfa"
}

Example Response

{
  "_id": "575462759373c5503b4afcfe",
  "deckId": "575462759373c5503b4afcfc",
  "question": {
    "text": "What is 3 + 3"
  },
  "answer": {
    "text": "6",
    "explanation": "Basic addition"
  }
}

POST /api/play/

Saves a play.

Example Request

{
  "userId": "575462759373c5503b4afcfa",
  "deckId": "575462759373c5503b4afcfc",
  "cardId": "575462759373c5503b4afcfe",
  "side": 1,
  "rating": -1
}

Example Response

This response is not used by the application.

{
  "_id": "575462759373c5503b4afd10",
  "userId": "575462759373c5503b4afcfa",
  "deckId": "575462759373c5503b4afcfc",
  "cardId": "575462759373c5503b4afcfe",
  "side": 1,
  "rating": -1
}```

## `POST /api/progress`

Retrieves the percentage of cards in a deck that have been studied by a user.

### Example Request

```json
{
  "deckId": "575462759373c5503b4afcfc",
}

Example Response

"70%"