Skip to content

Conversation

@oxnr
Copy link
Member

@oxnr oxnr commented Jan 25, 2016

Implement Comments and Likes on external objects in SDK.

API

We going to provide a new set of routes which at their roots share /externals and offer the same functionality that can be found for /posts. Instead of expecting a post id we offer a that a set of alphanumeric characters can be passed which is used to associate the entity created with it for later reference and list retrieval.

/externals/{externalID:[a-zA-Z0-9]+}/comments
/externals/{externalID:[a-zA-Z0-9]+}/likes
...

To offer the same convenience that we have for Posts (e.g. Counts) for external objects we going to serve a limited response for /externals/:id.

"counts": {
  "comments": 3,
  "likes": 12,
  "shares": 1
},
"id": "1a2b7c4d3e6f3g1h3i0j3k6l4m7n8o3p9q"

Another assumption which doesn't hold true is the knowledge around Visibility which means that we have to force the caller to provide that information.

curl -X POST /externals/1a2b7c4d3e6f3g1h3i0j3k6l4m7n8o3p9q/comments \
    -d $'
    {
        "content": "Do like.",
        "visibility": 30
    }
    '
201 Created
{
  "content": "Do like.",
  "external_id": "1a2b7c4d3e6f3g1h3i0j3k6l4m7n8o3p9q",
  "id": "12743631303647840",
  "user_id": "11286878691041888",
  "visibility": 30,
  "created_at": "2015-11-27T16:03:36.171840385Z",
  "updated_at": "2015-11-27T16:03:36.171840478Z"
}
curl -X POST /externals/1a2b7c4d3e6f3g1h3i0j3k6l4m7n8o3p9q/like \
    -d $'
    {
      "visibility": 30
    }
    '
201 Created
{
  "external_id": "1a2b7c4d3e6f3g1h3i0j3k6l4m7n8o3p9q",
  "id": "37363583381716140",
  "user_id": "11286878691041888",
  "created_at":"2015-03-21T14:28:02.4+01:00",
  "updated_at":"2015-03-21T14:28:02.4+01:00"
}

@oxnr oxnr added the api label Jan 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

1 participant