I am trying to make a GET request with a body to a REST API - without success. The API sits on top of Elastisearch, which requires a body for requests. The body contains the filters and requests for specific fields for the request. I have tried multiple different requests in Postman and they work fine. The body is forwarded and the results are filtered as expected.
The API is state run which means i have no control over it what so ever. It refuses any request that is not GET (POST, PUT etc.).
I have tried with RestSharp, but it refuses to make a GET request with a body. Error message is: "Http verb GET does not support body". (i tried to get the C# code from Postman, but it throws the same exception).
I have also tried with HttpClient, HttpWebRequest and WebClient. Same error in all of them. To try a new platform i created a PowerShell script to run from C#, but it throws the same exception.
Is this just impossible to do in C#?
My only option now is to create e.g. a PHP (or other language) script that can query the API succefully, and then access this script from C#. But it seems like quite a workaround only because of the GET/body problem.
Any advice or ressources you could provide or refer me to would be greatly appreciated! Thank you.
Btw. i have seen a lot of posts on Stackoverflow on this problem. Many of them are quite old so i am hoping that perhaps something has changed. Also many of them end up with a solution where you use POST instead of GET - which is not a option for me.