Socialid.selfie.like
From Social ID Developers
(Difference between revisions)
Renato.neves (Talk | contribs) (→Example) |
Dirceu.tiegs (Talk | contribs) |
||
Line 1: | Line 1: | ||
== Description == | == Description == | ||
− | + | Adds a like in a post to a particular user (increments the likes count). Each user can only like a post 1 time. | |
== Usage == | == Usage == | ||
Line 11: | Line 11: | ||
{| | {| | ||
! align="left" width="200px" | postId | ! align="left" width="200px" | postId | ||
− | | width="200px" | | + | | width="200px" | required |
− | | | + | | numeric identifier for the post. |
|+ | |+ | ||
! align="left" width="200px" | handler | ! align="left" width="200px" | handler | ||
− | | width="200px" | | + | | width="200px" | optional |
− | | | + | | callback function to be called on the API response. |
|+ | |+ | ||
! align="left" width="200px" | options | ! align="left" width="200px" | options | ||
− | | width="200px" | | + | | width="200px" | optional |
− | | | + | | object containing additional parameters. |
|+ | |+ | ||
! align="left" width="200px" style="padding-left: 20px" | user_id | ! align="left" width="200px" style="padding-left: 20px" | user_id | ||
− | | width="200px" | | + | | width="200px" | optional |
− | | | + | | user identifier. Default: User IP. |
|} | |} | ||
Line 31: | Line 31: | ||
{| | {| | ||
! align="left" width="200px" | data | ! align="left" width="200px" | data | ||
− | | | + | | Always "null". This API doesn't return any data. |
|+ | |+ | ||
! align="left" width="200px" | status | ! align="left" width="200px" | status | ||
− | | | + | | API call status. Can be '''"success"''' in case of a successful like, '''"unprocessable_entity"''' in case the user already liked this post, '''"not_found"''' in case the post wasn't found, or '''"internal_server_error"''' in case an unknown error occurs. |
|} | |} | ||
== Example == | == Example == | ||
− | + | Makes the user with user_id = "32" like the post with post_id = "27": | |
var handler = function(response) { | var handler = function(response) { | ||
if (response.status == "success") { | if (response.status == "success") { | ||
− | alert("Like | + | alert("Like successful."); |
} else { | } else { | ||
− | alert(" | + | alert("Wasn't possible to like this post."); |
} | } | ||
} | } |
Latest revision as of 11:43, 4 November 2014
Contents |
Description
Adds a like in a post to a particular user (increments the likes count). Each user can only like a post 1 time.
Usage
socialid.selfie.like(postId, handler, options)
Parameters
postId | required | numeric identifier for the post. | handler | optional | callback function to be called on the API response. | options | optional | object containing additional parameters. | user_id | optional | user identifier. Default: User IP. |
---|
API Response
data | Always "null". This API doesn't return any data. | status | API call status. Can be "success" in case of a successful like, "unprocessable_entity" in case the user already liked this post, "not_found" in case the post wasn't found, or "internal_server_error" in case an unknown error occurs. |
---|
Example
Makes the user with user_id = "32" like the post with post_id = "27":
var handler = function(response) { if (response.status == "success") { alert("Like successful."); } else { alert("Wasn't possible to like this post."); } } var appId = 1; socialid.selfie.init(appId); socialid.selfie.like(27, handler, {user_id: 32});