问题描述
我已为Azure API管理(APIM)启用版本控制.版本基于查询字符串参数(例如?api-version = 1.0
).使用查询字符串的目的是,如果用户不提供参数,它将默认为最新版本.所以:
I have enabled versioning for Azure API Management (APIM). The versioning is based on querystring parameters (e.g. ?api-version=1.0
). The intent for using a querystring is so that if the user doesn't provide the parameter, it'll default to the latest version. So:
/api/operation?api-version=1.0 <- Goes to 1.0
/api/operation?api-version=1.1 <- Goes to 1.1
/api/operation <- Goes to 1.1 (assuming that is latest)
但是,APIM似乎使用该参数作为索引器,如果未提供该参数,APIM将不知道要使用哪个版本.有没有办法告诉APIM,如果缺少该参数,会自动转到特定版本?
However, it appears as though APIM uses that parameter as an indexer and if it's not provided, APIM doesn't know which version to use. Is there a way to tell APIM that, if the parameter is missing, automatically go to a specific version?
推荐答案
在Azure APIM中不可能.每个请求都必须传递API版本.
Not possible in Azure APIM. API version is required to be passed for every request.
这篇关于API管理的默认版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!