Socialid.selfie.posts
(Difference between revisions)
Renato.neves (Talk | contribs) (→Example) |
Dirceu.tiegs (Talk | contribs) |
||
Line 1: | Line 1: | ||
== Description == | == Description == | ||
− | + | Searches for moderated posts for a given hashtag. | |
== Usage == | == Usage == | ||
Line 11: | Line 11: | ||
{| | {| | ||
! align="left" width="200px" | hashtag | ! align="left" width="200px" | hashtag | ||
− | | width="200px" | | + | | width="200px" | required |
− | | | + | | hashtag used to search the posts. |
|+ | |+ | ||
! 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" | page | ! align="left" width="200px" style="padding-left: 20px" | page | ||
− | | width="200px" | | + | | width="200px" | optional |
− | | | + | | results page number. Default: 1. |
|+ | |+ | ||
! align="left" width="200px" style="padding-left: 20px" | limit | ! align="left" width="200px" style="padding-left: 20px" | limit | ||
− | | width="200px" | | + | | width="200px" | optional |
− | | | + | | max number of results per page. Default: 15. |
|+ | |+ | ||
! align="left" width="200px" style="padding-left: 20px" | order | ! align="left" width="200px" style="padding-left: 20px" | order | ||
− | | width="200px" | | + | | width="200px" | optional |
− | | | + | | results sort order. Can be "created_at" to sort by post creation date in descending order, or "like" to sort by number of likes in descending order. Default: "created_at". |
|+ | |+ | ||
! 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 ("user_liked" attribute in the response). Default: User IP. |
|} | |} | ||
Line 43: | Line 43: | ||
{| | {| | ||
! align="left" width="200px" | data | ! align="left" width="200px" | data | ||
− | | | + | | In case of success, an object containing search results. The object has the following properties: "results", "offset", "count", and "total". |
|+ | |+ | ||
! align="left" width="200px" | status | ! align="left" width="200px" | status | ||
− | | | + | | Status for the API call. Can be '''"success"''' on a successful search, or '''"internal_server_error"''' if any unknown error happens. |
|} | |} | ||
== Example == | == Example == | ||
− | + | Returns the last moderated posts for the "focacbt" hashtag, with default options: | |
var handler = function(response) { | var handler = function(response) { | ||
Line 57: | Line 57: | ||
console.log(response.data.results); | console.log(response.data.results); | ||
} else { | } else { | ||
− | alert(" | + | alert("Couldn't perform the search."); |
} | } | ||
} | } | ||
Line 64: | Line 64: | ||
socialid.selfie.posts('focacbt', handler); | socialid.selfie.posts('focacbt', handler); | ||
− | + | Returns the last moderated posts for the "focacbt" hashtag, with custom options: | |
var handler = function(response) { | var handler = function(response) { | ||
Line 70: | Line 70: | ||
console.log(response.data.results); | console.log(response.data.results); | ||
} else { | } else { | ||
− | alert(" | + | alert("Couldn't perform the search."); |
} | } | ||
} | } | ||
Line 83: | Line 83: | ||
socialid.selfie.posts('focacbt', handler, options); | socialid.selfie.posts('focacbt', handler, options); | ||
− | + | Example "data" object: | |
data = { | data = { | ||
Line 104: | Line 104: | ||
} | } | ||
− | + | The low_picture_url, thumb_picture_url, and user_liked properties may return as null depending on the post. |
Revision as of 11:39, 4 November 2014
Contents |
Description
Searches for moderated posts for a given hashtag.
Usage
socialid.selfie.posts(hashtag, handler, options)
Parameters
hashtag | required | hashtag used to search the posts. | handler | optional | callback function to be called on the API response. | options | optional | object containing additional parameters. | page | optional | results page number. Default: 1. | limit | optional | max number of results per page. Default: 15. | order | optional | results sort order. Can be "created_at" to sort by post creation date in descending order, or "like" to sort by number of likes in descending order. Default: "created_at". | user_id | optional | user identifier ("user_liked" attribute in the response). Default: User IP. |
---|
API Response
data | In case of success, an object containing search results. The object has the following properties: "results", "offset", "count", and "total". | status | Status for the API call. Can be "success" on a successful search, or "internal_server_error" if any unknown error happens. |
---|
Example
Returns the last moderated posts for the "focacbt" hashtag, with default options:
var handler = function(response) { if (response.status == "success") { console.log(response.data.results); } else { alert("Couldn't perform the search."); } } var appId = 1; socialid.selfie.init(appId); socialid.selfie.posts('focacbt', handler);
Returns the last moderated posts for the "focacbt" hashtag, with custom options:
var handler = function(response) { if (response.status == "success") { console.log(response.data.results); } else { alert("Couldn't perform the search."); } } var appId = 1, options = { page: 2, limit: 40, order: 'like', user_id: '50.97.87.253' }; socialid.selfie.init(appId); socialid.selfie.posts('focacbt', handler, options);
Example "data" object:
data = { count: 1, offset: 0, results: [{ created_at: "2014-08-28T15:32:20+00:00", display_name: "jennyffer.suellen", likes: 0, low_picture_url: "http://scontent-b.cdninstagram.com/hphotos-xfa1/t51.2885-15/10632020_1540533216169293_1066110938_a.jpg", message: "Foca no iguana #focacbt", picture_url: "http://scontent-b.cdninstagram.com/hphotos-xfa1/t51.2885-15/10632020_1540533216169293_1066110938_n.jpg", post_id: 3, post_url: "http://instagram.com/p/sP0HM_jwVv/", provider: "instagram", thumb_picture_url: "http://scontent-b.cdninstagram.com/hphotos-xfa1/t51.2885-15/10632020_1540533216169293_1066110938_s.jpg", user_liked: true }], total: 1 }
The low_picture_url, thumb_picture_url, and user_liked properties may return as null depending on the post.