I have a problem with sending request with parameters. I have example of sending the request in PHP, but I can't figure out, how should it look like in RestSharp:
As you can see, in the example parameters are added to private key (which I have also done) and then also there's this CURLOPT_POSTFIELDS where params are added too. I tried doing it by AddParameter, AddBody, AddJsonBody and nothing works. When I have parameters concatenated to private key, response is always empty, if I remove it, I get the response, but my parameters are ignored.
string data = "{\"Paging\":{\"per_page\":\"" + 10 + "\"}}";
RestClient client = new RestClient("api");
string header = "WMS " + publicKey + ":" + GetMd5Hash(privateKey + data);
IRestRequest request = new RestRequest("products", Method.GET);
request.AddHeader("Content-Type", "application/json; charset=utf-8");
request.AddHeader("Authorization", header);
request.AddHeader("Content-Length", data.Length.ToString());
//request.RequestFormat = RestSharp.DataFormat.Json;
request.AddParameter("Paging", new { per_page = 10 });
IRestResponse response = client.Execute(request);
Encoding encoding = Encoding.GetEncoding("utf-8");
var result = encoding.GetString(response.RawBytes);
I was able to track the php request with fiddler and raw request looked like that:
GET api HTTP/1.1 Host: api Pragma: no-cache Accept: */* Authorization: WMS md5 Content-type: application/json Content-Length: 27 {"Paging":{"per_page":"8"}}
And mine looks like that:
GET api HTTP/1.1 Authorization: WMS md5 Content-Type: application/json Accept: */* User-Agent: RestSharp/105.2.3.0 Host: api Accept-Encoding: gzip, deflate Connection: Keep-Alive
The parameter isn't shown in it, don't know why. I tried every parameter type. Aside from that my header "Content-Length" is not visible either.