如何使用 Citrix ShareFile API 进行搜索 [英] How to search using the Citrix ShareFile API

查看:20
本文介绍了如何使用 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"属性.他们的文档站点上有零个示例,任何第三方库都只显示传入的查询"参数,而没有示例...

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆