如何使用Citrix ShareFile API进行搜索 [英] How to search using the Citrix ShareFile API
问题描述
我正在为项目使用Sharefile REST API,但遇到了问题.缺少他们的文档,到目前为止,我到api @地址的5封电子邮件都没有得到答复.想通了我会众包...
I am using the Sharefile REST API for a project and have run into an issue. Their documentation is lacking and so far my 5 emails to the api@ address have gone unanswered. Figured I would crowdsource this one...
我需要做的是按文件名搜索文件,并且还必须具有特定的parentID.我会尽最大努力关注他们的文档,但在响应中仍然会出现500错误.
What I need to do is search for a file by its name and it also has to have a specific parentID. I am following their documentation as best I can, but I still get a 500 error on the response.
根据他们的API 文档我必须发布到:https://account.sf-api.com/sf/v3/Items/AdvancedSimpleSearch
并显示以下信息:
According to their API documentation I have to post to: https://account.sf-api.com/sf/v3/Items/AdvancedSimpleSearch
with the following post:
{
"Query":{
"AuthID":"",
"ItemType":"",
"ParentID":"",
"CreatorID":"",
"LuceneQuery":"",
"SearchQuery":"",
"CreateStartDate":"",
"CreateEndDate":"",
"ItemNameOnly":"",
},
"Paging":{
"Key":"",
"PageNumber":1,
"PageSize":10,
},
"Sort":{
"SortBy":"",
"Ascending":false,
},
"TimeoutInSeconds":10
}
我发送的JSON帖子如下:
The JSON post I am sending looks like this:
{
"Query": {
"AuthID": "",
"ItemType": "",
"ParentID": "xxxxxxxxxxxx",
"CreatorID": "",
"LuceneQuery": "",
"SearchQuery": "filename ='foo.png'",
"CreateStartDate": "4/2/2014",
"CreateEndDate": "4/4/2014",
"ItemNameOnly": ""
},
"Paging": {
"Key": "",
"PageNumber": 1,
"PageSize": 10
},
"Sort": {
"SortBy": "",
"Ascending": false
},
"TimeoutInSeconds": 10
}
他们在示例帖子中预填充了一些属性,因此我进行了复制.我也确实尝试只发送我需要的内容(而不是空白属性),但仍然得到500.
They prefilled some properties in their example post so I replicated. I did also try sending only what I needed too (instead of the blank properties) but still get a 500.
我可以上传文件,删除,修改等,一切正常,没有问题,所以我确定这是此JSON结构中的内容.我认为归结为"SearchQuery"属性.在其文档站点上有零个示例,并且成为第3方的任何库都仅显示传入的查询"参数,而没有类似示例的示例...
I can upload files, delete, modify, etc all fine with no issues so I am certain it is something in this JSON structure. I think it comes down to the "SearchQuery" property. There is zero examples on their documentation site, and any libraries that were made 3rd party only show a "query" parameter being passed in with no example of what that looks like...
推荐答案
尝试一下:
{
"Query": {
"AuthID": "",
"ItemType": "",
"ParentID": "xxxxxxxxxxxx",
"CreatorID": "",
"LuceneQuery": "",
"SearchQuery": "foo.png",
"CreateStartDate": "4/2/2014",
"CreateEndDate": "4/4/2014",
"ItemNameOnly": ""
},
"Paging": {
"Key": "",
"PageNumber": 1,
"PageSize": 10
},
"Sort": {
"SortBy": "",
"Ascending": false
},
"TimeoutInSeconds": 10
}
在searchQuery中,我们必须指定项目名称本身,而不是filename ='itemname'.为我工作:)
In searchQuery we have to specify item name itself instead of filename='itemname'. Working for me :)
这篇关于如何使用Citrix ShareFile API进行搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!