Forum Discussion

hiscapness's avatar
hiscapness
Contributor
12 years ago

rest api - search blog posts by date

I have seen posts such as this one that discusses the search API and this one that describes searching by date range but these search messages only.

 

I would like to use the search API or regular REST API to return all the blog posts (NOT messages/comments) between two dates. Currently, I'm doing this:

 

http://[stuff]/restapi/vc/blogs/id/[blog name]/threads?restapi.response_style=view&page_size=1000

 ... but that means that every time I search I have to manually go through the results again and discard ones I've previously fetched.

 

I want to do something like this:

http://[stuff]/restapi/vc/blogs/id/[blog name]/search/threads?q=date:[1341341612 TO 1341946412]

 ...where the date ranges are timestamps (time since epoch) and that whole thing would be URL-encoded.

 

However, it doesn't look like /search/threads works so when I search /messages I'm just getting comments on the blog posts, not the actual posts themselves (could care less about the comments.)

 

If I can do this with the REST API without using search please let me know.

 

 

3 Replies

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

    Hi,

     

    have you had a look at this TKB article? There are some extended parameters described there that should help you out.

     

    In particular, you may want to look into is_root:true ( peterlu has an example here ) which only return the root message (topic message) for a thread.As you will be passing multiple parameters in the q attribute you will want to have them in AND so they all apply.

     

    Let us know if that worked for you!

  • hiscapness's avatar
    hiscapness
    Contributor
    12 years ago

    that gets me closer, but is there any way to include the comment count in the results?