Post

Get Post

GET /posts/(post_id)

Get a single post.

Example JSON response:

{
  "message": "생 마르탱 운하에서 본 할머니와 할아버지",
  "id": 14,
  "is_liked": false,
  "like_count": 0,
  "user": {
    "created_at": "2017-02-07T09:23:13+0000",
    "photo": {
      "id": "d7394923-cf39-4c78-891a-8714eb615ea7"
    },
    "username": "devxoul",
    "id": 1
  },
  "created_at": "2017-01-27T19:52:32+0000",
  "photo": {
    "id": "69e892b4-7dbd-403c-92fc-07f199c2be35"
  }
}
Response JSON Object:
 
  • id (int) –
  • photo (Photo) –
  • message (string) – A message (Optional)
  • user (User) – Post author
  • created_at (date) –
Status Codes:

Create Post

POST /posts

Create a post

Example JSON response:

{
  "message": "생 마르탱 운하에서 본 할머니와 할아버지",
  "id": 14,
  "is_liked": false,
  "like_count": 0,
  "user": {
    "created_at": "2017-02-07T09:23:13+0000",
    "photo": {
      "id": "d7394923-cf39-4c78-891a-8714eb615ea7"
    },
    "username": "devxoul",
    "id": 1
  },
  "created_at": "2017-01-27T19:52:32+0000",
  "photo": {
    "id": "69e892b4-7dbd-403c-92fc-07f199c2be35"
  }
}
Form Parameters:
 
  • photo – An image file
  • message – A message (Optional)
Status Codes:

Edit Post

PUT /posts/(post_id)

Edit the post

Example JSON response:

{
  "message": "생 마르탱 운하에서 본 할머니와 할아버지",
  "id": 14,
  "is_liked": false,
  "like_count": 0,
  "user": {
    "created_at": "2017-02-07T09:23:13+0000",
    "photo": {
      "id": "d7394923-cf39-4c78-891a-8714eb615ea7"
    },
    "username": "devxoul",
    "id": 1
  },
  "created_at": "2017-01-27T19:52:32+0000",
  "photo": {
    "id": "69e892b4-7dbd-403c-92fc-07f199c2be35"
  }
}
Form Parameters:
 
  • message – New message (Optional)
Status Codes:
PATCH /posts/(post_id)

Edit the post

Example JSON response:

{
  "message": "생 마르탱 운하에서 본 할머니와 할아버지",
  "id": 14,
  "is_liked": false,
  "like_count": 0,
  "user": {
    "created_at": "2017-02-07T09:23:13+0000",
    "photo": {
      "id": "d7394923-cf39-4c78-891a-8714eb615ea7"
    },
    "username": "devxoul",
    "id": 1
  },
  "created_at": "2017-01-27T19:52:32+0000",
  "photo": {
    "id": "69e892b4-7dbd-403c-92fc-07f199c2be35"
  }
}
Form Parameters:
 
  • message – New message (Optional)
Status Codes:

Delete Post

DELETE /posts/(post_id)

Delete the post

Example JSON response:

{}
Status Codes:

Like Post

POST /posts/(post_id)/likes

Like the post

Example JSON response:

{}
Status Codes:

Unlike Post

DELETE /posts/(post_id)/likes

Unlike the post

Example JSON response:

{}
Status Codes: