-
Notifications
You must be signed in to change notification settings - Fork 7
Exercise Endpoints
Ryan Christiani edited this page Nov 25, 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.
###/v1/exercise
GET Return all exercises
Headers | Value | Description |
---|---|---|
token : string |
token |
Token received from authentication. |
Response
{
"exercise": [
{
"_id": "565380b92185c27c0220a48a",
"title": "jQuery .each()",
"created_at": 1448313017925,
"updated_at": 1448313017963,
"revisions": [],
"topics": [],
"media": []
},
{
"_id": "56538143c5c8307c02de302a",
"title": "Ajax",
"created_at": 1448313155642,
"updated_at": 1448313155671,
"revisions": [],
"topics": [],
"media": []
}
]
}
###/v1/exercise
POST Create exercise
Headers | Value | Description |
---|---|---|
token : string |
token |
Token received from authentication. |
Request
{
"title" : "First React Component"
}
Response
{
"exercise": {
"__v": 0,
"title": "First React Component",
"created_at": 1448399822674,
"_id": "5654d3ce8128e72a364b8695",
"revisions": [],
"topics": []
}
}
###/v1/exercise/:id
GET Get specific exercise
Headers | Value | Description |
---|---|---|
token : string |
token |
Token received from authentication. |
Params | Value | Description |
---|---|---|
id : string |
token |
ID from exercise. |
Response
{
"exercise": {
"_id": "5654d3ce8128e72a364b8695",
"title": "First React Component",
"created_at": 1448399822674,
"revisions": [],
"topics": []
}
}
###/v1/exercise/:exerciseId
PUT Update specific exercise
Headers | Value | Description |
---|---|---|
token : string |
token |
Token received from authentication. |
Params | Value | Description |
---|---|---|
id : string |
token |
ID from exercise. |
Request
{
"_id": "5654d3ce8128e72a364b8695",
"title": "First React Component",
"body": "Exercise information goes here."
"created_at": 1448399822674,
"revisions": [],
"topics": []
}
Response
{
"exercise": {
"_id": "5654d3ce8128e72a364b8695",
"title": "First React Component",
"created_at": 1448399822674,
"__v": 0,
"updated_at": 1448399999619,
"body": "Exercise information goes here.",
"revisions": [
{
"_id": "5654d3ce8128e72a364b8695",
"title": "First React Component",
"created_at": 1448399822674,
"__v": 0,
"revisions": [],
"topics": []
}
],
"topics": []
}
}
###/v1/exercise/:exerciseId
DELETE Delete specific exercise
Headers | Value | Description |
---|---|---|
token : string |
token |
Token received from authentication. |
Params | Value | Description |
---|---|---|
id : string |
token |
ID from exercise. |
Response
{
"exercise": []
}