Podling API Documentation

Post

A post represents a message inside a conversation, created by a user. The original post differs from the others only in the is_original boolean attribute.

The content attribute of a post represents the text submitted by the post author. The content_html attribute prodives a version converted to HTML, with URLs linked etc.

Posts may be hidden by their author or by the group administrator. This is a form of soft-deletion.

Posts may be "liked" by members of the group to which the conversation belongs.

Creating Posts

Example: Creating Posts can reply to an individual post.

Request
POST /api/v1/groups/1612-group-96/conversations/1542/posts HTTP/1.1
Host: podling.com
Authorization: Bearer accesstoken77
Content-Type: application/json; charset=utf-8

{
  "content": "You are WRONG on the internet!",
  "in_reply_to_id": 1339
}
Reponse
HTTP/1.1 201 Created
Content-Type: application/json; charset=utf-8
ETag: "34411c9b0586e3666dfe1ee7d7bc3786"
Cache-Control: max-age=0, private, must-revalidate
Content-Length: 941

{
  "id": 1340,
  "content": "You are WRONG on the internet!",
  "content_html": "<p>You are WRONG on the internet!</p>",
  "is_original": false,
  "in_reply_to_id": 1339,
  "created_at": "2013-02-28T07:19:21Z",
  "updated_at": "2013-02-28T07:19:21Z",
  "attachments": [

  ],
  "user": {
    "id": 3176,
    "name": "OAuth user",
    "email": "user182@example.org",
    "avatar_url": null,
    "twitter_username": null,
    "profile": null,
    "location": null,
    "created_at": "2013-02-28T07:19:21Z",
    "url": "http://www.example.com/api/v1/users/3176"
  },
  "in_reply_to": {
    "id": 1339,
    "content": "Post content goes here",
    "content_html": "<p>Post content goes here</p>",
    "is_original": true,
    "in_reply_to_id": null,
    "created_at": "2013-02-28T07:19:21Z",
    "updated_at": "2013-02-28T07:19:21Z",
    "attachments": [

    ],
    "user": {
      "id": 3177,
      "name": "User 135",
      "email": "user183@example.org",
      "avatar_url": null,
      "twitter_username": null,
      "profile": null,
      "location": null,
      "created_at": "2013-02-28T07:19:21Z",
      "url": "http://www.example.com/api/v1/users/3177"
    }
  },
  "likes": [

  ]
}
Back to top

Hiding Posts

Example: Hiding Posts authenticated as User patches hidden_by_user for oauth.

Request
POST /api/v1/groups/1618-group-102/conversations/1547/posts/1348 HTTP/1.1
X-Http-Method-Override: PATCH
Host: podling.com
Authorization: Bearer accesstoken82
Content-Type: application/json; charset=utf-8

{
  "hidden_by_user": true
}
Reponse
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
ETag: "dc5b9212598eacc3861660cedde260d0"
Cache-Control: max-age=0, private, must-revalidate
Content-Length: 540

{
  "id": 1348,
  "content": "Post content goes here",
  "content_html": "<p>Post content goes here</p>",
  "is_original": false,
  "in_reply_to_id": null,
  "created_at": "2013-02-28T07:19:22Z",
  "updated_at": "2013-02-28T07:19:22Z",
  "attachments": [

  ],
  "user": {
    "id": 3186,
    "name": "OAuth user",
    "email": "user192@example.org",
    "avatar_url": null,
    "twitter_username": null,
    "profile": null,
    "location": null,
    "created_at": "2013-02-28T07:19:22Z",
    "url": "http://www.example.com/api/v1/users/3186"
  },
  "likes": [

  ],
  "hidden_by_user": true,
  "hidden_by_group": false,
  "hidden_by_administrator": false
}
Back to top

Example: Hiding Posts authenticated as User who is administrator of Group patches hidden_by_administrator.

Request
POST /api/v1/groups/1623-group-107/conversations/1552/posts/1359 HTTP/1.1
X-Http-Method-Override: PATCH
Host: podling.com
Authorization: Bearer accesstoken87
Content-Type: application/json; charset=utf-8

{
  "hidden_by_administrator": true
}
Reponse
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
ETag: "13f37e26ff367c39091a1715dd357308"
Cache-Control: max-age=0, private, must-revalidate
Content-Length: 540

{
  "id": 1359,
  "content": "Post content goes here",
  "content_html": "<p>Post content goes here</p>",
  "is_original": false,
  "in_reply_to_id": null,
  "created_at": "2013-02-28T07:19:23Z",
  "updated_at": "2013-02-28T07:19:23Z",
  "attachments": [

  ],
  "user": {
    "id": 3197,
    "name": "OAuth user",
    "email": "user203@example.org",
    "avatar_url": null,
    "twitter_username": null,
    "profile": null,
    "location": null,
    "created_at": "2013-02-28T07:19:23Z",
    "url": "http://www.example.com/api/v1/users/3197"
  },
  "likes": [

  ],
  "hidden_by_user": false,
  "hidden_by_group": false,
  "hidden_by_administrator": true
}
Back to top

Listing Posts

Example: Listing Posts as an authenticated user only lists posts by the user in groups shared with the auth-user.

Request
GET /api/v1/users/3243/posts HTTP/1.1
Host: podling.com
Authorization: Bearer accesstoken111
Reponse
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
ETag: "be8dea49e6299ad13e134015e9e6c61c"
Cache-Control: max-age=0, private, must-revalidate
Content-Length: 595

[
  {
    "id": 1380,
    "content": "Post content goes here",
    "content_html": "<p>Post content goes here</p>",
    "is_original": true,
    "in_reply_to_id": null,
    "created_at": "2013-02-28T07:19:25Z",
    "updated_at": "2013-02-28T07:19:25Z",
    "attachments": [

    ],
    "user": {
      "id": 3243,
      "name": "User 174",
      "email": "user245@example.org",
      "avatar_url": null,
      "twitter_username": null,
      "profile": null,
      "location": null,
      "created_at": "2013-02-28T07:19:25Z",
      "url": "http://www.example.com/api/v1/users/3243"
    },
    "likes": [

    ],
    "conversation": {
      "id": 1565,
      "group": {
        "id": 1641,
        "slug": "1641-group-125"
      }
    },
    "group": {
      "id": 1641,
      "name": "Group 125",
      "slug": "1641-group-125"
    }
  }
]
Back to top

Example: Listing Posts authenticated as User with some posts returns a list of posts.

Request
GET /api/v1/groups/1626-group-110/conversations/1555/posts HTTP/1.1
Host: podling.com
Authorization: Bearer accesstoken89
Reponse
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
ETag: "ca8cedfba3e5a761b92113cabbe2c05a"
Cache-Control: max-age=0, private, must-revalidate
Content-Length: 462

[
  {
    "id": 1360,
    "content": "Post content goes here",
    "content_html": "<p>Post content goes here</p>",
    "is_original": false,
    "in_reply_to_id": null,
    "created_at": "2013-02-28T07:19:23Z",
    "updated_at": "2013-02-28T07:19:23Z",
    "attachments": [

    ],
    "user": {
      "id": 3204,
      "name": "User 151",
      "email": "user210@example.org",
      "avatar_url": null,
      "twitter_username": null,
      "profile": null,
      "location": null,
      "created_at": "2013-02-28T07:19:23Z",
      "url": "http://www.example.com/api/v1/users/3204"
    },
    "likes": [

    ]
  }
]
Back to top

Showing Posts

Example: Showing Posts returns JSON representation of original post.

Request
GET /api/v1/groups/1628-group-112/conversations/1557/posts/1365 HTTP/1.1
Host: podling.com
Authorization: Bearer accesstoken91
Reponse
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
ETag: "8045a59fc96ca6ebf8cc5f9e8549c6f7"
Cache-Control: max-age=0, private, must-revalidate
Content-Length: 586

{
  "id": 1365,
  "content": "Hello http://example.org/ world.\nLine 2.\n\nLine 4.",
  "content_html": "<p>Hello <a href=\"http://example.org/\" target=\"_blank\">http://example.org/</a> world.\n<br />Line 2.</p>\n\n<p>Line 4.</p>",
  "is_original": true,
  "in_reply_to_id": null,
  "created_at": "2013-02-28T07:19:23Z",
  "updated_at": "2013-02-28T07:19:23Z",
  "attachments": [

  ],
  "user": {
    "id": 3212,
    "name": "User 158",
    "email": "user218@example.org",
    "avatar_url": null,
    "twitter_username": null,
    "profile": null,
    "location": null,
    "created_at": "2013-02-28T07:19:23Z",
    "url": "http://www.example.com/api/v1/users/3212"
  },
  "likes": [

  ]
}
Back to top