我们可以使用相同的查询参数来识别API管理版本和api版本吗?

时间:2020-06-21 10:08:22

标签: api asp.net-core azure-api-management

我们是否可以使用相同的查询参数来识别API管理版本和api版本

如下所示:

https://apim-***.azure-api.net/suffixname/api/action1?api-version = 1.0

where-> api-version = 1.0用于识别APIM api版本,还使用 swagger-swashbuckle 来识别在ASP.NET CORE API实际api实现基于查询参数的版本定义中使用的相同查询参数>。

当我将api导入没有版本集的APIM时,我已经尝试过了,然后可以正常工作,但是如果我使用 api-version 作为查询参数差异的版本集,APIM api调用将失败并显示404错误。

在查看apim跟踪日志时:

api-inspector (0.004 ms)
{
    "configuration": {
        "api": {
            "from": "/suffixname",
            "to": {
                "scheme": "https",
                "host": "appdeployed.azurewebsites.net",
                "port": 443,
                "path": "/",
                "queryString": "",
                "query": {},
                "isDefaultPort": true
            },
            "version": "1.0",
            "revision": "1"
        },
        "operation": "-",
        "user": "-",
        "product": "-"
    }
}

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

无法识别该操作且其值为“-”。

在删除查询参数后,其在APIM测试窗口请求测试中的工作情况正常。

是否可以使用单个查询参数在APIM和API上定义API。

0 个答案:

没有答案