【问题标题】:Invoke-RestMethod -Method Delete Base RequestInvoke-RestMethod -Method 删除基本请求
【发布时间】:2020-09-13 10:19:17
【问题描述】:

我很茫然。我可以运行以下命令,它可以完美运行

Invoke-RestMethod 'https://deerlakes.freshservice.com/api/v2/vendors/13000042524' -Headers $FDHeaders -Method Get

但是我一跑

Invoke-RestMethod 'https://deerlakes.freshservice.com/api/v2/vendors/13000042524' -Headers $FDHeaders -Method Delete

我收到了一个错误的请求

Invoke-RestMethod : 远程服务器返回错误:(400) Bad Request。 在行:19 字符:1 + 调用-RestMethod 'https://deerlakes.freshservice.com/api/v2/vendors/ ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

我可能做错了什么?

【问题讨论】:

  • 400 通常意味着请求期望与您传递的内容不同。这可能是 url 看起来不同的形式,或者是一些丢失/无关的变量 - 您可能需要检查 api 参考以了解如何在该端点上正确调用 delete

标签: powershell


【解决方案1】:

我的问题是他们是与 Freshservice 中的供应商相关的合同,不允许我删除供应商。

【讨论】:

    猜你喜欢
    • 2022-11-05
    • 2015-02-04
    • 1970-01-01
    • 1970-01-01
    • 2014-08-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多