无法在 Zoho People API 上使用 searchParams(HTTP 状态 400)
(与提供 HTTP 状态 400 相关– 错误请求 | Zoho API | searchParams | - 遵循官方文档位于 https://www.zoho.com/people /api/forms-api/search-record.html)
以下内容(导出为curl)获取今天的休假记录时
curl --location -g \
--request GET "https://people.zoho.eu/people/api/forms/leave/getRecords?searchParams={searchField:'To',searchOperator:'After',searchText:'02-Mar-2022'}|{searchField:'From', searchOperator: 'Before', searchText : '02-Mar-2022'}" \
--header "Authorization: Zoho-oauthtoken 1000.abcd1234.abcd1234"
当通过 Postman 发送 GET 请求以使用文档提供的 ,我只收到 HTTP 状态400 – Bad Request
错误响应。
但是,在没有 searchParams
的情况下发送相同的请求,获取所有休假记录作为响应,确实有效。因此,在我的例子中,URL 区域和 API 身份验证是正确的。
我按照记录进行了身份验证,并使用我的 clientId 和 clientSecret 使用 ZOHOPEOPLE.forms.ALL 范围接收了令牌。
(related to Giving HTTP Status 400 – Bad Request | Zoho API | searchParams | - following the official documentation at https://www.zoho.com/people/api/forms-api/search-record.html)
When sending a GET request via Postman to fetch leave-records for today by using the following (exported as curl)
curl --location -g \
--request GET "https://people.zoho.eu/people/api/forms/leave/getRecords?searchParams={searchField:'To',searchOperator:'After',searchText:'02-Mar-2022'}|{searchField:'From', searchOperator: 'Before', searchText : '02-Mar-2022'}" \
--header "Authorization: Zoho-oauthtoken 1000.abcd1234.abcd1234"
as provided by the documentation, I receive only a HTTP Status 400 – Bad Request
error response.
However, sending the same request without the searchParams
, getting all leave records as a response, does work. So the URL region and the Auth to the API are correct in my case.
I authenticated as documented and received the token, using my clientId and clientSecret using the ZOHOPEOPLE.forms.ALL scope.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
(与 给出 HTTP 状态 400 – 错误的答案类似请求 | Zoho API | searchParams |)
文档确实在此处提到了 GET(至少在撰写本文时) - 但该请求实际上适用于 POST 和发送
searchParams
作为表单数据。卷曲示例:
另请注意,我实际上可以省略
searchParams
中的引号,以提高易读性并减少转义。(similar answer as for Giving HTTP Status 400 – Bad Request | Zoho API | searchParams |)
The documentation does say GET here (at least at the time of writing) - but the request does actually work with a POST and sending the
searchParams
as form-data.curl example:
Also note that I could actually omit the quotes in the
searchParams
for better legibility with less escaping.