sharepoint-rest-api - SP 365 rest search api 返回“500 内部服务器错误”以使用 HTTP POST
问题描述
我们的产品使用 SP 365 搜索 API。我们的一些客户报告说,在使用以下搜索 API 时:'/_api/search/postquery' 和正文:
{'request': {
'Querytext':'test',
'SourceId':'8413cd39-2156-4e00-b54d-11efd9abdb89',
'RowLimit':400,
'SelectProperties':{
'results':['Title','Path','Description','Write','Rank','Size']},
'TrimDuplicates':true,
'ClientType':'Custom',
'Culture':1030,
'SortList':{'results':[{'Property':'Rank','Direction':'1'}]}
}}
返回带有错误文本的 HTTP 状态代码 500(在 json 响应中):“发生未知错误。” 但是,如果在查询中添加一个条件以将其限制为特定的 SP 列表,例如:
{'request': {
'Querytext':'test AND "ListId":{A7B96B28-6062-435B-A2EE-4792512A95A1}',
'SourceId':'8413cd39-2156-4e00-b54d-11efd9abdb89',
'RowLimit':400,
'SelectProperties':{
'results':['Title','Path','Description','Write','Rank','Size']},
'TrimDuplicates':true,
'ClientType':'Custom',
'Culture':1030,
'SortList':{'results':[{'Property':'Rank','Direction':'1'}]}
}}
然后查询运行良好。
这发生在特定租户,如“pfgroupas.sharepoint.com”。这个 API 调用已经工作多年了(从 SP 2013 开始)并且在最近几天被打破了。
解决方案
事实证明,对于某些租户,如果您指定“SortList”参数,内部服务器错误就会显现出来。如果您在没有它的情况下创建查询,例如:
{'request': {
'Querytext':'test',
'SourceId':'8413cd39-2156-4e00-b54d-11efd9abdb89',
'RowLimit':400,
'SelectProperties':{
'results':['Title','Path','Description','Write','Rank','Size']},
'TrimDuplicates':true,
'ClientType':'Custom',
'Culture':1030
}}
然后一切正常。在我看来,这就像一个服务器端错误。
推荐阅读
- opencv - Python:时间拉伸波文件 - 三种方法之间的比较
- ios - SWIFTUI 在 TabView 中隐藏当前视图的 navigationBarBackButton
- c++ - 什么可以防止类中相邻成员的重叠?
- javascript - 从 nodejs child_proccess 运行 kubectl
- django - 如何在 Django 设置中指定显式主机名?
- pandas - 删除仅包含一个类别的行 - Pandas - Python
- javascript - 等待 forEach 循环
- amazon-web-services - Terraform 推送 Cloudformation 堆栈。如何从参数制作字符串列表
- python - 如何将参数数组广播到函数矩阵上?
- java - Kafka 生产者连接到 localhost 而不是真实 IP