Skip to content
jorge-d edited this page Feb 4, 2013 · 1 revision

List wall posts

Route: GET /api/v1/posts

This will return an array containing all the posts of your family, or a 404 error code if you're not in a family.

Example:

curl -X GET \
   -H "Accept: application/json" \
   -d 'auth_token=sYcyvuHUopjT46iMhkU5' \
    http://localhost:3001/api/v1/posts

Will have the following output:

[
  {
    "id": 11,
    "message": "Salut je suis tres content!",
    "date_posted": "04 Feb 13 16:03",
    "user_id": 1
  },
  {
    "id": 15,
    "message": "Salut les copains!",
    "date_posted": "04 Feb 13 16:43",
    "user_id": 6
  },
  {
    "id": 19,
    "message": "Bonjour!",
    "date_posted": "04 Feb 13 16:59",
    "user_id": 3
  }
]

Create wall post

Route: POST /api/v1/posts

You MUST send a message param with your query.

Example:

curl -X POST \
   -H "Accept: application/json" \
   -d 'auth_token=sYcyvuHUopjT46iMhkU5' \
   -d 'post[message]=Bonjour les zoizions' \
    http://localhost:3001/api/v1/posts

Will have the following output:

{
  "id": 22,
  "message": "Bonjour les zoizions",
  "date_posted": "04 Feb 13 18:04",
  "user_id": 1
}

Delete a wall post

Route: DELETE /api/v1/posts/:id

This WILL delete the message identified by :id.

Example:

curl -X DELETE \
   -H "Accept: application/json" \
   -d 'auth_token=sYcyvuHUopjT46iMhkU5' \
    http://localhost:3001/api/v1/posts/22

The response will be empty with a 204 status code in case of success

Clone this wiki locally