Skip to content
Ryan Christiani edited this page Nov 30, 2015 · 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

{	
	title: String,
	created_at: Number,
	created_by: String,
	updated_at: Number,
	updated_by: String,
	topics: [ /* Topic Objects */],
	revisions: [ /* Previous lesson versions */ ],
	body: String,
	description: String,
	catergory: String
}

###/v1/lesson GET Return all lessons

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

Response

{
  	"lesson": [
	    {
	      "_id": "565380b92185c27c0220a484",
	      "title": "Intro to HTML",
	      "created_at": 1448313017809,
	      "revisions": [...],
	      "topics": [...]
	    },
	    {
	      "_id": "56538143c5c8307c02de3024",
	      "title": "Semantic Elements",
	      "created_at": 1448313155528,
	      "revisions": [...],
	      "topics": [...]
	    },
	    {
	      "_id": "5653817bec65cc7c028075ba",
	      "title": "CSS Selectors",
	      "created_at": 1448313211109,
	      "revisions": [...],
	      "topics": [...]
	    }
   	]
}

###/v1/lesson POST Create lesson

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

Request

{
	title: "New lesson"
}

Response

{
	"lesson": {
		"__v": 0,
		"title": "New lesson",
		"created_at": 1448384326699,
		"_id": "5654974676099d4b1bf51641",
		"revisions": [],
		"topics": []
	}
}

###/v1/lesson/:id GET _Return specific lesson

Headers Value Description
x-access-token : string token Token received from authentication.
Params Value Description
id : string 5654974676099d4b1bf51641 ID from lesson.

Response

{
	"lesson": {
		"_id": "5654974676099d4b1bf51641",
		"title": "New lesson",
		"created_at": 1448384326699,
		"revisions": [],
		"topics": []
	}
}

###/v1/lesson/:id PUT Update specific course

Headers Value Description
x-access-token : string token Token received from authentication.
Params Value Description
id : string 5654974676099d4b1bf51641 ID from lesson.

Request

{
	"_id": "5654974676099d4b1bf51641",
	"title": "Updated lesson title",
	"created_at": 1448384326699,
	"revisions": [],
	"topics": []
}

Response

{
  "lesson": {
    "_id": "5654974676099d4b1bf51641",
    "title": "Updated lesson title",
    "created_at": 1448384326699,
    "__v": 0,
    "updated_at": 1448384581321,
    "revisions": [
      {
        "_id": "5654974676099d4b1bf51641",
        "title": "New lesson",
        "created_at": 1448384326699,
        "__v": 0,
        "revisions": [],
        "topics": []
      }
    ],
    "topics": []
  }
}

###/v1/lesson/:id DELETE Delete specific course

Headers Value Description
x-access-token : string token Token received from authentication.
Params Value Description
id : string 5654974676099d4b1bf51641 ID from lesson.

Response

{
	"lessons": []
}

###/v1/lesson/:lessonId/topic/:topicId PUT Add topic to lesson

Headers Value Description
x-access-token : string token Token received from authentication.
Params Value Description
lessonId : string 5654974676099d4b1bf51641 ID from lesson.
topicId : string 565380b92185c27c0220a488 ID from topic

Response

{
	"lesson": {
		"_id": "5654974676099d4b1bf51641",
		"title": "Updated lesson title",
		"created_at": 1448384326699,
		"__v": 1,
		"updated_at": 1448384987246,
		"revisions": [
			{
				"_id": "5654974676099d4b1bf51641",
				"title": "New lesson",
				"created_at": 1448384326699,
				"__v": 0,
				"revisions": [],
				"topics": []
			}
		],
		"topics": [
			"565380b92185c27c0220a488"
		]
	}
}

###/v1/lesson/:lessonId/topic/:topicId DELETE Remove topic to lesson

Headers Value Description
x-access-token : string token Token received from authentication.
Params Value Description
lessonId : string 5654974676099d4b1bf51641 ID from lesson.
topicId : string 565380b92185c27c0220a488 ID from topic

Response

{
	"lesson": {
		"_id": "5654974676099d4b1bf51641",
		"title": "Updated lesson title",
		"created_at": 1448384326699,
		"__v": 1,
		"updated_at": 1448384987246,
		"revisions": [
			{
				"_id": "5654974676099d4b1bf51641",
				"title": "New lesson",
				"created_at": 1448384326699,
				"__v": 0,
				"revisions": [],
				"topics": []
			}
		],
		"topics": []
	}
}
Clone this wiki locally