Current endpoints implemented:
GET :8000/v1/ - returns version
{"version": "0.0.1"}
POST :8000/v1/story - submits a new story (1)
{"status": "200", "message": "submitted"}
GET :8000/v1/story/list/approved - returns last 10 stories which are approved
GET :8000/v1/story/list/all - returns last 10 stories with no filters
GET :8000/v1/story/list/pending - returns last 10 stories aren't approved or accepted
GET :8000/v1/story/list/accepted - returns last 10 winners
[
{
"content": "bar",
"date_submitted": "2015-01-01 00:00:00",
"giver": {
"fullname": "Sam Sherar",
"sso": "212340985"
},
"is_accepted": true,
"is_approved": true,
"receiver": {
"fullname": "Gary Barlow",
"sso": "123456789"
},
"title": "foo"
},
...
}
GET :8000/v1/story/$id/ - returns individual story
{
"content": "bar",
"date_submitted": "2015-01-01 00:00:00",
"giver": {
"fullname": "Sam Sherar",
"sso": "212340985"
},
"is_accepted": true,
"is_approved": true,
"receiver": {
"fullname": "Gary Barlow",
"sso": "123456789"
},
"title": "foo"
}
POST :8000/v1/story/$id/accept - accepts a story
{"status": "200", "message": "accepted"}
POST :8000/v1/story/$id/approve - approves a story
{"status": "200", "message": "approved"}
DELETE :8000/v1/story/$id
{"status": "200", "message": "deleted!"}
POST :8000/v1/story/search
payload:
{
"query": "foo bar baz"
}
return:
[
{
"content": "bar",
"date_submitted": "2015-01-01 00:00:00",
"giver": {
"fullname": "Sam Sherar",
"sso": "212340985"
},
"is_accepted": true,
"is_approved": true,
"receiver": {
"fullname": "Gary Barlow",
"sso": "123456789"
},
"title": "foo"
},
...
]
(1) fields needed are:
- title: string
- content: string
- date_submitted: string (in dd/mm/yyyy)
- giver: string (sso)
- receiver: string(sso)