我想让apim重写..。
https://apimpath/customers/1234
至
https://backendpath/api/customers/1234

但失败了。尝试了一些东西,但它们似乎都不认识customerId。我遗漏了什么?
------Update-------
尝试了下面的一些建议,但没有帮助。下面是显示相同消息的新ui

尝试通过api添加它的几个变体。
PUT {{url}}/apis/customers/operations/GET?api-version=2016-7-7
{
"name": "GET",
"method": "GET",
"urlTemplate": "/{customerId}",
"templateParameters": [
{"name": "customerId", "type": "string"}
],
"policies": null
}成功地增加了手术..。
PUT {{url}}/apis/customers/operations/GET/policy/?api-version=2016-7-7
<policies>
<inbound>
<base/>
<rewrite-uri template="/api/customers/{customerId}"/>
</inbound>
<outbound>
<base/>
</outbound>
</policies>但是上面的请求失败了。
{
"error": {
"code": "ValidationError",
"message": "One or more fields contain incorrect values:",
"details": [
{
"code": "ValidationError",
"target": "rewrite-uri",
"message": "Error in element 'rewrite-uri' on line 4, column 10: Only parameters specified in the original URL template can be used in the rewrite template. Original template is: /*"
}
]
}
}发布于 2017-07-21 12:17:13
这好像是个虫子。我也能重现这一切。
如果使用参数创建操作,则该操作将保存在某个地方。改变它似乎行不通,因为
正确的顺序是使用正确的参数名称直接创建操作。然后添加后端重写规则。
如果您查看屏幕截图,您创建的原始操作是"/*“,而不是"/{customerId}”。
我在新的UI/Portal中测试了这一点。
一个或多个字段包含不正确的值:第16行中的元素‘re写-uri’中的错误,第10列:只有在原始URL模板中指定的参数才能在重写模板中使用。原始模板为: /{id}
https://stackoverflow.com/questions/45203137
复制相似问题