0
votes

I'm at a loss. I can run the following and it works flawlessly

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

But as soon as I run

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

I get a bad request

Invoke-RestMethod : The remote server returned an error: (400) Bad Request. At line:19 char:1 + Invoke-RestMethod 'https://deerlakes.freshservice.com/api/v2/vendors/ ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

What could I possibly be doing wrong?

1
400 normally means the request is expecting something different to what you are passing. This could be in the form of the url looking different, or some missing/extranious variables - you might need to check the api reference for how to properly call delete on that endpointBassie

1 Answers

0
votes

My problem was that their was a contract associated with the vendor in Freshservice that wouldn't allow me to delete the vendor.