【问题标题】:Is parameter startDateTime working in Trustpilot's business unit private reviews API call?参数 startDateTime 是否在 Trustpilot 的业务部门私人评论 API 调用中起作用?
【发布时间】:2023-02-16 17:56:51
【问题描述】:

我正在尝试使用 Trustpiolt 的业务部门私人评论 API 调用从特定日期开始获取所有 5 条开始评论。 API调用文档如下: https://documentation-apidocumentation.trustpilot.com/business-units-api#business-unit-private-reviews

我正在使用记录如下的参数“startDateTime”: “ startDateTime,可选字符串 按日期时间范围过滤评论。如果未指定时间,则隐含时间为 00:00:00 示例:?startDateTime=2013-09-07T13:37:00 “

它成功获取了 5 条开始评论,但结果还包括日期早于 startDateTime 的评论。

这是一个错误吗?

任何帮助,将不胜感激。 谢谢

【问题讨论】:

    标签: python trustpilot


    【解决方案1】:

    它正在工作,刚刚对其进行了测试,这是一个有效的 python 示例:

    import requests
    
    # assumption is you already created your access token
    access_token = "your access token"
    
    # you need to know the business_unit_id of your company to get your reviews
    business_unit_id = "your business unit id"
    
    
    endpoint_private_reviews = f"https://api.trustpilot.com/v1/private/business-units/{business_unit_id}/reviews"
    
    # get reviews filtering on startDateTime (amongst others)
    params = "?perPage=100&orderBy=createdat.desc&startDateTime=2023-02-16&page=1&stars=5"
    
    headers = {
        "Authorization": f"Bearer {access_token}",  # mandatory
    }
    
    response = requests.get(
        url=endpoint_private_reviews + params, 
        headers=headers,
    ).json()
    
    response["reviews"]
    

    【讨论】:

      猜你喜欢
      • 2017-08-28
      • 1970-01-01
      • 2016-07-29
      • 1970-01-01
      • 2020-02-24
      • 2019-03-02
      • 2019-10-21
      • 2021-07-08
      • 1970-01-01
      相关资源
      最近更新 更多