我试图让APIM采取重写......不能得到PARAMS到Azure中阿比管理正确重写URL
https://apimpath/customers/1234
到
https://backendpath/api/customers/1234
失败。尝试了几件事情,但他们似乎都不认可customerId。我错过了什么?
------更新-------
尝试下面的一些建议,并没有帮助。下面是该相同的消息
尝试添加它通过与这几个变化的API全新的UI ...
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: /*"
}
]
}
}
似乎很奇怪。它看起来像你在做什么是正确的。尝试设置网址模板,将其保存,然后设置重写网址模板作为第二步。 –
另外,您可能想尝试将其设置在Azure门户的新UI中。 –
欣赏建议,但都无效。不知道有一个新的用户界面,但如果失败,同样的错误。将该截图添加到原始问题中。真的停留在这一个。 – sjdirect