Skip to content
Ryan Christiani edited this page Dec 1, 2016 · 8 revisions

##Authentication All routes require you to be authorized. Make a GET request to /v1/user/authenticate to get your token. Every authenticated route requires a x-access-token header with your token sent.

####Available Fields

{
  type: 'string',
  category: 'string',
  difficulty: 'string',
  body: 'string',
  multiAnswer: 'string',
  multiChoice: [{
    label: 'string',
    value: 'string'
  }],
  unitTest: 'string',
  title: String,
  created_at: Number,
  created_by: String,
  updated_at: Number,
  updated_by: String
}

###Types

  • Multiple Choice
  • Code

###Categories

  • HTML
  • CSS
  • JavaScript
  • React

###/v2/questions GET Return all questions

Headers Value Description
x-access-token : string token Token received from authentication.

Response

{
  "questions": [
    {
      //...
    },
    {
      //...
    },
    {
      //...
    }
  ]
}

###/v2/questions/:id GET Return single question

Headers Value Description
x-access-token : string token Token received from authentication.
Params Value Description
id : string 564a449a2e55ee5430afb12d ID for question that you want to get.

Response

{
  "question": {
    title: "Sample Question",
    //...
  }
}

###/v2/questions POST Create a new question

Headers Value Description
x-access-token : string token Token received from authentication.

Request

{
  {
    title: "Sample Question",
    type: "Multiple Choice",
    //...
  }
}

Response

{
  "question": {
    _id: 
    title: "Sample Question",
    type: "Multiple Choice",
    //...
  }
}

###/v2/questions/:id PUT Update a question

Headers Value Description
x-access-token : string token Token received from authentication.
Params Value Description
id : string 564a449a2e55ee5430afb12d ID for question that you want to update.

Send back the object with the updated fields

Request

{
  {
    title: "Sample Question Updated",
    type: "Multiple Choice",
    //...
  }
}

Response

{
  "question": {
    _id: 
    title: "Sample Question Updated",
    type: "Multiple Choice",
    //...
  }
}

###/v2/questions/:id DELETE Delete a question

Headers Value Description
x-access-token : string token Token received from authentication.
Params Value Description
id : string 564a449a2e55ee5430afb12d ID for the question you want to remove

If the question being deleted is of type: "Code" it will also delete the test file associated with it.

Response

{
  "success" : true
}
Clone this wiki locally