I want to get reviews using Trustpilot APIs. I know that I can do one time fetch by using page parameter to get all reviews.
But is there a way to filter on a date? I would like to run my script to fetch the reviews after a certain date?
I want to get reviews using Trustpilot APIs. I know that I can do one time fetch by using page parameter to get all reviews.
But is there a way to filter on a date? I would like to run my script to fetch the reviews after a certain date?
You can use parameter startDateTime
when you are getting private reviews for your own business:
https://documentation-apidocumentation.trustpilot.com/business-units-api#business-unit-private-reviews
In this case add the following to the endpoint:
?startDateTime=2013-09-07
However, the parameter startDateTime
is not available for the public reviews:
https://documentation-apidocumentation.trustpilot.com/business-units-api#get-a-business-unit's-reviews
In that case you would first have to get all public reviews and then filter out afterwards using python/javascript/etc.
Assuming trustpilot has the date in the API, what you can do is quite simple. Create a new empty list for the reviews that you wish to show. The convert the date you want the reviews you want the reviews after to a millisecond/seconds date. Then proceed to loop through the reviews, and if the date converted to millisecond/seconds is greater than the one you want, append it to the list.