gpt4 book ai didi

Azure API 运行命令 - 已接受 202 响应

转载 作者:行者123 更新时间:2023-12-02 08:00:50 24 4
gpt4 key购买 nike

我正在尝试使用 Microsoft Azure Rest API 运行命令:

https://learn.microsoft.com/en-us/rest/api/compute/virtual%20machines%20run%20commands/runcommand

我最终想要传递一个相当复杂的 PowerShell 脚本,但我正在尝试一个简单的“ipconfig”命令来测试连接,但除了 HTTP 202 响应之外我无法得到任何内容,该响应不返回 json 响应数据(这是根据 API )。

登录和 OAuth 步骤正常工作,我可以成功获取需要相同授权范围的虚拟机和其他服务管理数据。

有人成功使用了这个 API,并且知道为什么我只收到 202 响应吗?

最佳答案

这是正常的,当收到202响应时,您需要调用另一个api来检查结果。

在您的情况下,您将获得如下所示的响应 header ,只需调用 location 中的 api(还需要授权承载 token )。

enter image description here

我在 postman 中测试了它,工作正常。

enter image description here

更多详细信息,您可以引用此文档 - Track asynchronous Azure operations ,看看这个 sample .

关于Azure API 运行命令 - 已接受 202 响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56844270/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com