Socialid.selfie.posts

From Social ID Developers
(Difference between revisions)
Jump to: navigation, search
(Example)
 
(10 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
<span style="color: red; font-weight: bold">Deprecation notice:</span> this API is deprecated since July 19, 2018.
 +
 
== Description ==
 
== Description ==
  
Realiza a busca de posts moderados para uma determinada hashtag.
+
Searches for moderated posts for a given hashtag.
  
 
== Usage ==
 
== Usage ==
  
   socialid.selfie.posts(hashtag, handler, options)
+
   socialid.selfie.posts(handler, options)
 +
 
 +
<span style="color:red">Important:</span> the parameters in the format socialid.selfie.posts(hashtag, handler, options) are deprecated. Use the hashtag parameter as an option.
  
 
== Parameters ==
 
== Parameters ==
  
 
{|
 
{|
! align="left" width="200px" | hashtag
 
| width="200px" | obrigatório
 
| Hashtag dos posts a serem retornados.
 
|+
 
 
! align="left" width="200px" | handler
 
! align="left" width="200px" | handler
| width="200px" | opcional
+
| width="200px" | required
| Especifica uma função de callback para tratar a resposta da API.
+
| callback function to be called on the API response.
 
|+
 
|+
 
! align="left" width="200px" | options
 
! align="left" width="200px" | options
| width="200px" | opcional
+
| width="200px" | optional
| um objeto contendo parâmetros adicionais
+
| object containing additional parameters.
 +
|+
 +
! align="left" width="200px" style="padding-left: 20px" | hashtag
 +
| width="200px" | optional
 +
| hashtag used to search the posts. If no hashtag is informed, the API will return posts from all hashtags registered in the app.
 
|+
 
|+
 
! align="left" width="200px" style="padding-left: 20px" | page
 
! align="left" width="200px" style="padding-left: 20px" | page
| width="200px" | opcional
+
| width="200px" | optional
| Número da página dos resultados. Default: 1.
+
| 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" | opcional
+
| width="200px" | optional
| Número máximo de resultados para serem retornados na página. Default: 15.
+
| 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" | opcional
+
| width="200px" | optional
| Ordenação dos resultados. Pode ser "created_at", para ordenação decrescente por data de criação do post, ou "like", para ordenação decrescente por posts com mais likes. Default: "created_at".
+
| 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" | opcional
+
| width="200px" | optional
| Identificador do usuário para informação sobre likes.
+
| user identifier ("user_liked" attribute in the response). Default: User IP. <span style="color:red">This parameter is deprecated.</span>
 
|}
 
|}
  
Line 43: Line 47:
 
{|
 
{|
 
! align="left" width="200px" | data
 
! align="left" width="200px" | data
| Em caso de sucesso, será um objeto contendo os resultados da busca. O objeto contém as propriedades "results", "offset", "count" e "total".  
+
| 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
| O status da execução da chamada da API. Pode ser '''"success"''', se a busca foi realizada com sucesso ou '''"internal_server_error"''', caso algum erro desconhecido aconteça.
+
| API call status. Can be '''"success"''' on a successful search, or '''"internal_server_error"''' if any unknown error happens.
 
|}
 
|}
  
 
== Example ==
 
== Example ==
  
Retorna os últimos posts moderados para a hashtag "focacbt", com as opções default:
+
Returns the last moderated posts for all hashtags, with default options:
  
 
   var handler = function(response) {
 
   var handler = function(response) {
Line 57: Line 61:
 
         console.log(response.data.results);
 
         console.log(response.data.results);
 
     } else {
 
     } else {
         alert("Não foi possível realizar a busca.");
+
         alert("Couldn't perform the search.");
 
     }
 
     }
 
   }
 
   }
 
   var appId = 1;
 
   var appId = 1;
 
   socialid.selfie.init(appId);
 
   socialid.selfie.init(appId);
   socialid.selfie.posts('focacbt', handler);
+
   socialid.selfie.posts(handler);
  
Retorna os últimos posts moderados para a hashtag "focacbt", com opções customizadas:
+
Returns the last moderated posts for the "focacbt" hashtag, with default options:
  
 
   var handler = function(response) {
 
   var handler = function(response) {
Line 70: Line 74:
 
         console.log(response.data.results);
 
         console.log(response.data.results);
 
     } else {
 
     } else {
         alert("Não foi possível realizar a busca.");
+
         alert("Couldn't perform the search.");
 
     }
 
     }
 
   }
 
   }
 
   var appId = 1,
 
   var appId = 1,
 
         options = {
 
         options = {
           page: 2,
+
           hashtag: 'focacbt'
          limit: 40,
+
          order: 'like',
+
          user_id: '50.97.87.253'
+
 
         };
 
         };
 
   socialid.selfie.init(appId);
 
   socialid.selfie.init(appId);
   socialid.selfie.posts('focacbt', handler, options);
+
   socialid.selfie.posts(handler, options);
  
Exemplo de dados no objeto "data":
+
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 = {
 +
        hashtag: 'focacbt',
 +
        page: 2,
 +
        limit: 40,
 +
        order: 'like',
 +
        user_id: '50.97.87.253'
 +
      };
 +
  socialid.selfie.init(appId);
 +
  socialid.selfie.posts(handler, options);
 +
 
 +
Example "data" object:
  
 
   data = {
 
   data = {
Line 90: Line 111:
 
     results: [{
 
     results: [{
 
       created_at: "2014-08-28T15:32:20+00:00",
 
       created_at: "2014-08-28T15:32:20+00:00",
       display_name: "jennyffer.suellen",
+
       display_name: "Jennyffer Suellen",
 
       likes: 0,
 
       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",
 
       message: "Foca no iguana #focacbt",
 
       picture_url: "http://scontent-b.cdninstagram.com/hphotos-xfa1/t51.2885-15/10632020_1540533216169293_1066110938_n.jpg",
 
       picture_url: "http://scontent-b.cdninstagram.com/hphotos-xfa1/t51.2885-15/10632020_1540533216169293_1066110938_n.jpg",
 
       post_id: 3,
 
       post_id: 3,
 
       post_url: "http://instagram.com/p/sP0HM_jwVv/",
 
       post_url: "http://instagram.com/p/sP0HM_jwVv/",
 +
      profile_picture_url: "http://photos-e.ak.instagram.com/hphotos-ak-xaf1/10632016_256085694602076_741961532_a.jpg",
 
       provider: "instagram",
 
       provider: "instagram",
       user_liked: true
+
      thumb_picture_url: "http://scontent-b.cdninstagram.com/hphotos-xfa1/t51.2885-15/10632020_1540533216169293_1066110938_s.jpg",
 +
       user_liked: true,
 +
      username: "jennyffer.suellen"
 
     }],
 
     }],
 
     total: 1
 
     total: 1
 
   }
 
   }
 +
 +
The low_picture_url, thumb_picture_url, and user_liked properties may return as null depending on the post.

Latest revision as of 16:04, 29 October 2018

Deprecation notice: this API is deprecated since July 19, 2018.

Contents

Description

Searches for moderated posts for a given hashtag.

Usage

 socialid.selfie.posts(handler, options)

Important: the parameters in the format socialid.selfie.posts(hashtag, handler, options) are deprecated. Use the hashtag parameter as an option.

Parameters

handler required callback function to be called on the API response.
options optional object containing additional parameters.
hashtag optional hashtag used to search the posts. If no hashtag is informed, the API will return posts from all hashtags registered in the app.
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. This parameter is deprecated.

API Response

data In case of success, an object containing search results. The object has the following properties: "results", "offset", "count", and "total".
status API call status. Can be "success" on a successful search, or "internal_server_error" if any unknown error happens.

Example

Returns the last moderated posts for all hashtags, 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(handler);

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,
       options = {
         hashtag: 'focacbt'
       };
 socialid.selfie.init(appId);
 socialid.selfie.posts(handler, options);

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 = {
        hashtag: 'focacbt',
        page: 2,
        limit: 40,
        order: 'like',
        user_id: '50.97.87.253'
      };
 socialid.selfie.init(appId);
 socialid.selfie.posts(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/",
     profile_picture_url: "http://photos-e.ak.instagram.com/hphotos-ak-xaf1/10632016_256085694602076_741961532_a.jpg",
     provider: "instagram",
     thumb_picture_url: "http://scontent-b.cdninstagram.com/hphotos-xfa1/t51.2885-15/10632020_1540533216169293_1066110938_s.jpg",
     user_liked: true,
     username: "jennyffer.suellen"
   }],
   total: 1
 }

The low_picture_url, thumb_picture_url, and user_liked properties may return as null depending on the post.

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox