首页 > 解决方案 > 在 Azure API 管理中,是否可以有一个允许斜杠(例如,路径)的模板参数?

问题描述

我正在使用 Azure Data Lake Storage 存储大量文件。我在它前面设置了一个 Azure API 管理网关,它重写了 URI 并将后端服务设置为ADLS REST API (Gen2)

此时我正在尝试配置路径 - 读取传递。我在 APIM 中的操作是/data/{filesystem}/{path}?timeout={timeout},我希望能够如下调用:

timeout是可选的)

filesystem: MyFileSystem
path:       Path/To/File.json
GET https://example.com/api/data/MyFileSystem/Path/To/File.json

但是,当我在 Azure 门户中导航到此操作并使用测试功能时,它会报告以下错误:

{ "message": "Unable to identify Api or Operation for this request. Responding to the caller with 404 Resource Not Found." }

我了解 APIM 可能正在寻找匹配的操作/MyFileSystem/Path/To/File.json,但找不到。

对于它的价值,我的Path - List端点按我的预期工作,这就是为什么我知道它特别是{path}阻碍我的原因。

GET https://example.com/api/data/MyFileSystem?recursive=true&resource=filesystem

200 OK

我想我可以从模板参数更改为查询参数,但我现在更愿意避免这条路线。那么,有没有办法让模板参数允许斜杠?

标签: azurerestazure-data-lakeazure-api-management

解决方案


是的。最后一个模板参数可能有斜线。使用 {*path}。


推荐阅读