在 Azure API 管理中,是否可以有一个允许斜线(例如路径)的模板参数?

San*_*nti 2 rest azure azure-api-management azure-data-lake

我正在使用 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
Run Code Online (Sandbox Code Playgroud)
GET https://example.com/api/data/MyFileSystem/Path/To/File.json
Run Code Online (Sandbox Code Playgroud)

但是,当我在 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
Run Code Online (Sandbox Code Playgroud)

200 OK

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

Vit*_*tin 5

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