Skip to content

Instantly share code, notes, and snippets.

@ssherar
Last active August 29, 2015 14:27
Show Gist options
  • Save ssherar/3f6c6cb3b09ee1df6d14 to your computer and use it in GitHub Desktop.
Save ssherar/3f6c6cb3b09ee1df6d14 to your computer and use it in GitHub Desktop.

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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment