ADLS Rest API - 使用 SAS 令牌从目录而不是容器获取目录列表?

问题描述 投票:0回答:1

我希望您能帮助我解决我在尝试通过专为 SAS 令牌(目录令牌,而不是容器令牌)创建的 SAS 令牌访问 ADLS 目录时做错的事情。

网址:

https://testingsastk.dfs.core.windows.net/testcontainer/testfolder/

我一直在关注其余的 API 文档这里,并且我已经使用 postman 创建了请求。

邮递员请求

https://{{accountName}}.{{dnsSuffix}}/{{filesystem}}?directory={{directory}}&recursive=true&resource=filesystem&{{sas_token}}

此请求得到的结果表明我缺少必需的参数

缺少参数,目录 SAS

但是,当我将 SAS 令牌切换到容器 SAS 令牌时,请求工作正常

https://{{accountName}}.{{dnsSuffix}}/{{filesystem}}?directory={{directory}}&recursive=true&resource=filesystem&{{sas_token_container}}

容器 SAS 的工作请求

azure-blob-storage azure-storage
1个回答
0
投票

"code": "MissingRequiredQueryParameter", "message": "未指定此请求必需的查询参数。 请求 ID:e434310e-e01f-0033-597e-e21b1c000000 时间:2024-07-30T12:46:42.0903704Z"

当未为此请求指定所需的查询参数时,会出现上述错误。

在我的环境中,我通过具有

SAS
权限的门户从目录级别创建了
rl(read and list)
令牌。

传送门:

enter image description here

我按照相同的MS-Document从特定目录获取文件列表。

要求:

GET https://<storage account name>.dfs.core.windows.net/<filesystem name>?directory=<directory name>&recursive=true&resource=filesystem&sp=rl&st=2024-07-31T07:44:10Z&se=2024-07-31T15:44:10Z&spr=https&sv=2022-11-02&sr=d&sig=8uPG8VD4lusVnx8srtr7S0yzzzzzzzz1

上面提供了

URL
directory sas token
,它通过postman执行并列出特定目录中的文件。

输出:

enter image description here

{
    "paths": [
        {
            "contentLength": "4516",
            "creationTime": "1336zzzz62520",
            "etag": "0x8Dzzzz1238",
            "expiryTime": "0",
            "group": "$superuser",
            "lastModified": "Fri, 26 Jul 2024 06:24:08 GMT",
            "name": "sample-directory/22-07-2024 (1).html",
            "owner": "$superuser",
            "permissions": "rw-r-----"
        },
        {
            "contentLength": "1903",
            "creationTime": "1336zzz77725788",
            "etag": "0x8DCADzz005C",
            "expiryTime": "0",
            "group": "$superuser",
            "lastModified": "Fri, 26 Jul 2024 06:24:07 GMT",
            "name": "sample-directory/22-07-2024.html",
            "owner": "$superuser",
            "permissions": "rw-r-----"
        },
        {
            "contentLength": "1923",
            "creationTime": "13366zz6477056276",
            "etag": "0x8DCzzzE03C914",
            "expiryTime": "0",
            "group": "$superuser",
            "lastModified": "Fri, 26 Jul 2024 06:24:07 GMT",
            "name": "sample-directory/24-07-2024.html",
            "owner": "$superuser",
            "permissions": "rw-r-----"
        },
        {
            "contentLength": "18425",
            "creationTime": "133664486476388104",
            "etag": "0x8DCAD3B8DF99708",
            "expiryTime": "0",
            "group": "$superuser",
            "lastModified": "Fri, 26 Jul 2024 06:24:07 GMT",
            "name": "sample-directory/25-07-2024 (1).html",
            "owner": "$superuser",
            "permissions": "rw-r-----"
        },
        {
            "contentLength": "11204",
            "creationTime": "133zz6476337656",
            "etag": "0x8DCzzzDF8D1F8",
            "expiryTime": "0",
            "group": "$superuser",
            "lastModified": "Fri, 26 Jul 2024 06:24:07 GMT",
            "name": "sample-directory/25-07-2024.html",
            "owner": "$superuser",
            "permissions": "rw-r-----"
        },
        {
            "contentLength": "9631",
            "creationTime": "1336zz367948",
            "etag": "0x8DCzDF94z84C",
            "expiryTime": "0",
            "group": "$superuser",
            "lastModified": "Fri, 26 Jul 2024 06:24:07 GMT",
            "name": "sample-directory/26-07-2024.html",
            "owner": "$superuser",
            "permissions": "rw-r-----"
        },
        {
            "contentLength": "0",
            "creationTime": "1336zzz193661964",
            "etag": "0x8DCzzzFAE01BD68",
            "expiryTime": "0",
            "group": "$superuser",
            "isDirectory": "true",
            "lastModified": "Fri, 26 Jul 2024 06:53:39 GMT",
            "name": "sample-directory/test1",
            "owner": "$superuser",
            "permissions": "rwxr-x---"
        },
        {
            "contentLength": "4516",
            "creationTime": "133zzz93873524",
            "etag": "0x8DCAzzzzFAE04F674",
            "expiryTime": "0",
            "group": "$superuser",
            "lastModified": "Fri, 26 Jul 2024 06:53:39 GMT",
            "name": "sample-directory/test1/22-07-2024 (1).html",
            "owner": "$superuser",
            "permissions": "rw-r-----"
        },
        {
            "contentLength": "1903",
            "creationTime": "133664zz3977008",
            "etag": "0x8DCAzzE068AB0",
            "expiryTime": "0",
            "group": "$superuser",
            "lastModified": "Fri, 26 Jul 2024 06:53:39 GMT",
            "name": "sample-directory/test1/22-07-2024.html",
            "owner": "$superuser",
            "permissions": "rw-r-----"
        },
        {
            "contentLength": "1923",
            "creationTime": "13366zz99374548",
            "etag": "0x8DCzzzAE58E6D4",
            "expiryTime": "0",
            "group": "$superuser",
            "lastModified": "Fri, 26 Jul 2024 06:53:39 GMT",
            "name": "sample-directory/test1/24-07-2024.html",
            "owner": "$superuser",
            "permissions": "rw-r-----"
        },
        {
            "contentLength": "18425",
            "creationTime": "1336zzz93776276",
            "etag": "0x8zzFAE037A94",
            "expiryTime": "0",
            "group": "$superuser",
            "lastModified": "Fri, 26 Jul 2024 06:53:39 GMT",
            "name": "sample-directory/test1/25-07-2024 (1).html",
            "owner": "$superuser",
            "permissions": "rw-r-----"
        },
        {
            "contentLength": "11204",
            "creationTime": "1336zzz4199196200",
            "etag": "0x8DzzzAE562E28",
            "expiryTime": "0",
            "group": "$superuser",
            "lastModified": "Fri, 26 Jul 2024 06:53:39 GMT",
            "name": "sample-directory/test1/25-07-2024.html",
            "owner": "$superuser",
            "permissions": "rw-r-----"
        },
        {
            "contentLength": "9631",
            "creationTime": "133664zz7472",
            "etag": "0x8DCzzAE037F40",
            "expiryTime": "0",
            "group": "$superuser",
            "lastModified": "Fri, 26 Jul 2024 06:53:39 GMT",
            "name": "sample-directory/test1/26-07-2024.html",
            "owner": "$superuser",
            "permissions": "rw-r-----"
        }
    ]
}
© www.soinside.com 2019 - 2024. All rights reserved.