1

So I'm being forced to use an API Endpoint that is get but also requires data in the body. I've tried various methods in c# but each time I keep getting the same result. Body Content is not allowed for the GET method.

Does anyone have an idea on how I can create an HTTPClient Request or WebRequest or anything that will allow me to hit their GET method with body parameters?

Xerc
  • 135
  • 2
  • 16
  • 1
    But why? Get should have no body. Why not use POST? – Artur Apr 22 '22 at 20:07
  • @Artur - I didn't create the call nor do I have any choice in the matter. It's a third party company and I'm being forced to use it. If it makes you guys feel any better, their internal staff cannot figure out how to use it. HAHA – Xerc Apr 25 '22 at 14:57

1 Answers1

1

Technically, you're able to use GET request with a body. But in practice, it's VERY note recommended to do that. On this site there is a detailed explanation of what I'm saying. Also, take a look at this stack overflow topic. I don't want to copy good replies that's why I'm just attaching links to good and comprehensive results.

  • Thanks for pointing that out. I've been laboring under the impression that bodies were forbidden on GET requests for ages (largely because POSTMAN forbade them); it's nice to know that the spec has loosened the reigns a bit. – Mike Hofer Apr 22 '22 at 20:21