Forum Discussion

nathan's avatar
nathan
Executive
12 years ago

Searching the community for messages using tags and user ID?

Hi All,

 

I am looking to be able to search for messages using miltiple tags but at the same time targetting only messages for threads created by a specific user? So I would want to use the User ID to target threads created by that specific user and then for messages within all those threads specific to that user I would like to pull messages based on the tags specified. 

 

The information required from the response would be message title, body, kudos, community link etc..

 

I have tried all sorts of combinations with the search but have failed to target even threads or messages for a specified user. I have been able to target tags for a specific user but im not sure if that is relevent. 

 

Any help or guidance would be appreciated.

 

Kind Regards. 

Kash

4 Replies

  • NoamanA's avatar
    NoamanA
    Lithium Alumni (Retired)
    12 years ago

    Have you tried using something like:

     

    http://community.lithium.com/community-name/restapi/vc/users/id/[id]/posts/messages

     

    This should return a list of messages authored by the user you specify in the call.  Remember, where you're adding the user id, you should be specifying the numeric id for that user rather than their community name.  If you go to a user's profile page, you should see their id in the page url.

     

    Is this something you've tried already?  If you're still having problems, please give some examples of REST calls you're trying to make so we can see if something in the call itself requires correcting.  Also, perhaps worth mentioning what results you're seeing when you make those calls.

     

    Thanks

    Noaman

  • nathan's avatar
    nathan
    Executive
    12 years ago
    Thanks Noaman for the response.

    I have been able to pull now the messages for the user specified with that api call you provided.

    However I'm more concerned in being able to target complete threads created by this specific user and getting the responses (messages) provided by other users in those threads. I would then like to target them messages within those threads.

    With regards to the tag searching, I have attempted:

    restapi/vc/tagging/for/users/id/[id]/tags/related/all - this allows me to obtain tags related to the user.

    restapi/vc/search/messages?q=tag1:[tag]+tags:[tag2] - this will search for messages based on the specified tags but I am unable to also specify a specific user.

    restapi/vc/tagging/for/tags/text/[tag]/messages/top - this works only for one tag and I am unable to use multiple tags here.

    Hope this is makes it more clear to what I am trying to achieve.

    Thanks,
    Kash
  • nathan's avatar
    nathan
    Executive
    12 years ago
    Using a combined search for user based messages and specified tags I have managed to get what is required.

    The following api call is now used:

    restapi/vc/search/messages?author_id=[tag]&q=tags:[tag]&restapi.format_detail=full_list_element

    Thanks
  • NoamanA's avatar
    NoamanA
    Lithium Alumni (Retired)
    12 years ago

    Glad you managed to sort it out!

     

    Regards

    Noaman