cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
133
Views
0
Helpful
0
Comments
cdnadmin
Level 11
Level 11
This document was generated from CDN thread

Created by: Daniel Nikolov on 06-09-2012 11:51:16 AM
Hello guys,
I need help with the following problem:
Need to retrieve all posts in specific community containing tag = 'XXXX'. I checked the Quad REST API documentation for any clues but I could find only how to retireve posts in specific community (without filtering by tag's name) or how to retrieve posts with specific tag's name (but without filtering by community).
Can anyone help ?
 
BR,
Daniel

Subject: RE: Need to retrieve posts count with tag = 'XXX' in a specific community
Replied by: Adrienne Moherek on 12-09-2012 02:23:22 PM
Hi Daniel,

You can use the search API with filterBy and filterValue parameters to get the specific posts you want.
Here is an example:
http://<quad-server>/api/quad/rest/search?q=tag:idea&filterBy=communities&filterValue=2210355&filterBy=information&filterValue=post

In the above example, the tag we are searching for is idea. We are filtering this search to only look in a community with community id 2210355. We are adding another filter to search for only posts in that community.

Here are examples of the search APIs: http://developer.cisco.com/webexsocial/webexsocial-api-examples/search.html#searchtag

Thanks,
Adrienne

Subject: RE: Need to retrieve posts count with tag = 'XXX' in a specific community
Replied by: Daniel Nikolov on 18-09-2012 12:42:33 AM
Hi Adrienne,
What if I want to retrieve also the meta data (like and favorite) ?
I tried the following rest call: GET http://10.128.33.35:80/api/quad/rest/search?q=tag:idea&filterBy=communities&filterValue=110063&filterBy=information&filterValue=post&filterBy=meta&filterValue=like,favorite
but the result posts had no meta tags includedl.
Can you tell me what I'm doing wrong in this case ?

Thanks,
Daniel

Subject: RE: Need to retrieve posts count with tag = 'XXX' in a specific community
Replied by: Adrienne Moherek on 18-09-2012 06:00:47 PM
Hi Daniel,

You will have to retrieve the like and favorite data in a separate call.

After you have retrieved the data from your GET request, you will have to parse through the data to retrieve the post IDs.

Then you will have to create another request with the post IDs. Here is an example:

STEP 1:
GET http://<server>/api/quad/rest/search?q=tag:idea&filterBy=communities&filterValue=2210355&filterBy=information&filterValue=post

STEP 2:
Parse the response to get the post IDs

STEP 3:
GET http://<server>/api/quad/rest/posts/1400001,1200008?meta=favorite,like
where 1400001 and 120008 are post IDs

The response will provide you the information for like and favorite for each post listed.

Thanks,
Adrienne

Subject: RE: Need to retrieve posts count with tag = 'XXX' in a specific community
Replied by: Adrienne Moherek on 18-09-2012 06:25:48 PM
Hi Daniel,

Using this will only show the like and favorites in relation to whichever user you are logged in as in the authentication of the API.
http://<server>/api/quad/rest/posts/1400001,1200008?meta=favorite,like
This means that if 5 other people like 1400001, you will not know who these 5 other people are. The response will only show your like or favorite status, not anyone else's status.

Using these will show all like and favorites for all users. However, you can only look up 1 post at a time.
1. http://server[:port_number]/api/quad/rest/posts/post_id/favorite/@favoritedbyusers
2. http://server[:port_number]/api/quad/rest/posts/post_id/like/@likersusers

Thanks,
Adrienne

Subject: RE: Need to retrieve posts count with tag = 'XXX' in a specific community
Replied by: Daniel Nikolov on 18-09-2012 06:05:09 PM
Hi,
Thanks about this info. I thought that only one Post ID was allowed to be provided ?

What is better: use the described approach, or use the following API calls:

1. http://server[:port_number]/api/quad/rest/posts/post_id/favorite/@favoritedbyusers

2. http://server[:port_number]/api/quad/rest/posts/post_id/like/@likersusers

Thanks,
Daniel

Subject: RE: Need to retrieve posts count with tag = 'XXX' in a specific community
Replied by: Daniel Nikolov on 19-09-2012 01:02:33 AM
Thanks, I will use the second approach because it will provide list of likes/favorites for all users, not only for the authorized one.
Just one more question - what is the mechanism to obtain the user's image located on the left side on each post in Streams portlet ?
For example we have 4 different post authors and I need to retrieve the image url for each of them.
I detected image url like this: /image/user_portrait?img_id=210132&t=1343073520795  but not sure how to obtain these id values and what they mean.
Any idea ?

Thanks,
Daniel

Subject: RE: Need to retrieve posts count with tag = 'XXX' in a specific community
Replied by: Adrienne Moherek on 19-09-2012 06:19:30 PM
Hi Daniel,

You will have to parse the response for the URL of the image.

For example, if you sent this request:
http://server[:port_number]/api/quad/rest/posts/post_id/favorite/@favoritedbyusers

and this was the response:

    {
       "statusCode": 200,
       "startIndex": 0,
       "itemsPerPage": 1,
       "totalResults": 1,
       "filtered": false,
       "sorted": false,
       "entry":
       [
           {
               "data":
               {
                   "destination":
                   {
                       "firstName": "user1",
                       "fullName": "user1 user1",
                       "id": 810008,
                       "images":
                       [
                           {
                               "id": 0,
                               "resource": "http://quad.cisco.com/schema/1.0/profileimage",
                               "image":
                               {
                                   "id": 2410031,
                                   "resource": "http://quad.cisco.com/schema/1.0/image",
                                   "size": 1398,
                                   "published": 0,
                                   "updated": 1348092928221,
                                   "fileName": null,
                                   "mimeType": "jpg",
                                   "author": null,
                                   "updatedBy": null,
                                   "uri": "/image/user_portrait?img_id=2410031&t=1348092928221",
                                   "height": 48,
                                   "width": 48
                               },
                               "sizeType": "medium2"
                           },
                           {
                               "id": 0,
                               "resource": "http://quad.cisco.com/schema/1.0/profileimage",
                               "image":
                               {
                                   "id": 2410030,
                                   "resource": "http://quad.cisco.com/schema/1.0/image",
                                   "size": 1047,
                                   "published": 0,
                                   "updated": 1348092928178,
                                   "fileName": null,
                                   "mimeType": "jpg",
                                   "author": null,
                                   "updatedBy": null,
                                   "uri": "/image/user_portrait?img_id=2410030&t=1348092928178",
                                   "height": 31,
                                   "width": 31
                               },
                               "sizeType": "medium1"
                           },
                           {
                               "id": 0,
                               "resource": "http://quad.cisco.com/schema/1.0/profileimage",
                               "image":
                               {
                                   "id": 2410029,
                                   "resource": "http://quad.cisco.com/schema/1.0/image",
                                   "size": 897,
                                   "published": 0,
                                   "updated": 1348092928134,
                                   "fileName": null,
                                   "mimeType": "jpg",
                                   "author": null,
                                   "updatedBy": null,
                                   "uri": "/image/user_portrait?img_id=2410029&t=1348092928134",
                                   "height": 24,
                                   "width": 24
                               },
                               "sizeType": "small"
                           },
                           {
                               "id": 0,
                               "resource": "http://quad.cisco.com/schema/1.0/profileimage",
                               "image":
                               {
                                   "id": 2410027,
                                   "resource": "http://quad.cisco.com/schema/1.0/image",
                                   "size": 3829,
                                   "published": 0,
                                   "updated": 1348092928348,
                                   "fileName": null,
                                   "mimeType": "jpg",
                                   "author": null,
                                   "updatedBy": null,
                                   "uri": "/image/user_portrait?img_id=2410027&t=1348092928348",
                                   "height": 150,
                                   "width": 150
                               },
                               "sizeType": "large"
                           }
                       ],
                       "jobTitle": "",
                       "lastName": "user1",
                       "resource": "http://quad.cisco.com/schema/1.0/user",
                       "screenName": "user1",
                       "status": "ACTIVE"
                   },
                   "id": "post:1400001,user:810008",
                   "relationship": "favoriter"
               }
           }
       ],
       "serverMessages": null
    }


you can see several image URLs which you can use. They are all different sizes. Just use these image URLs to display the images of the users.
Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Quick Links