【发布时间】:2021-05-27 19:48:14
【问题描述】:
我有一个部署 API 的天蓝色管道。部署后,我有一个门将调用 API 并在部署到下一个环境之前检查成功状态。 问题是每次运行此门时都会出现此错误:
2021-05-27T19:42:30.3298765Z GET https://management.azure.com/https://apim-myapi.azure-api.net/api/Vehicle/Makes?year=2017?api-version=2020-09-01.12.0
Response Code: 0
Response: An error was encountered while processing request. Exception: {"error":{"code":"MissingApiVersionParameter","message":"The api-version query parameter (?api-version=) is required for all requests."}}
Exception Message: The remote server returned an error: (400) Bad Request. (type WebException)
Evaluation of expression 'eq(root['status'], 'successful')' failed.
Exception Message: Error parsing API response into a JSON object. (type DistributedTaskException)
我尝试向我正在使用的 URL 添加不同的版本,但我总是遇到同样的错误。 尽管看起来我正在传递它想要的价值!
有人用过这个门法吗?版本控制参数如何工作?
更新:添加我正在使用的门设置:
【问题讨论】:
-
看起来您将 api-version 添加到您的 api。也许改为通过(内联)powershell向您的api发出请求?
-
在postman中运行这个api看看会不会出现400错误。错误 400 可能是 api url 本身的问题。
-
我可以从 Azure 的测试门户很好地调用 API。它不需要 API 版本。只有当我从门口的这个任务中调用它时。我也可以在 azure 之外调用它,它不是必需的。
标签: azure-devops azure-pipelines azure-api-management