I am doing tests in a browser. This mail request involves issuing a team to build the building. While I am logged in, I can click on the Postman Send button, and it works fine. This means that the value does not expire. But if I log out and log into the system, then it won’t work. I would have to create another Postman mail through interceptor.
I want to simulate this post request using C #;
This is what my post looks like in Postman;
Postman Headers

Body parameters in the postman

If you have a mail carrier installed, click here to import the request.
Here is my C # code. I am using a library called RestSharp ;
var client = new RestClient(@"https://tr42.klanlar.org");
var request = new RestRequest("game.php", Method.POST);
request.AddQueryParameter("village", "31413"); // adds to POST or URL querystring based on Method
request.AddQueryParameter("screen", "main"); // adds to POST or URL querystring based on Method
request.AddQueryParameter("ajaxaction", "upgrade_building"); // adds to POST or URL querystring based on Method
request.AddQueryParameter("type", "main"); // adds to POST or URL querystring based on Method
request.AddQueryParameter("h", "98e34aa6"); // adds to POST or URL querystring based on Method
request.AddQueryParameter("", ""); // adds to POST or URL querystring based on Method
request.AddQueryParameter("client_time", "1505659914"); // adds to POST or URL querystring based on Method
request.AddParameter("destroy", "0"); // adds to POST or URL querystring based on Method
request.AddParameter("force", "1"); // adds to POST or URL querystring based on Method
request.AddParameter("id", "wood"); // adds to POST or URL querystring based on Method
request.AddParameter("source", "31413"); // adds to POST or URL querystring based on Method
//var p1 = new Parameter
//{
// ContentType = "application/x-www-form-urlencoded",
// Name = "destroy",
// Value = "0"
//};
//request.AddParameter(p1);
//var p2 = new Parameter
//{
// ContentType = "application/x-www-form-urlencoded",
// Name = "force",
// Value = "1"
//};
//request.AddParameter(p2);
//var p3 = new Parameter
//{
// ContentType = "application/x-www-form-urlencoded",
// Name = "id",
// Value = "wood"
//};
//request.AddParameter(p3);
//var p4 = new Parameter
//{
// ContentType = "application/x-www-form-urlencoded",
// Name = "source",
// Value = "31413"
//};
//request.AddParameter(p4);
request.AddHeader("Accept-Language", "en-US,en;q=0.8,tr;q=0.6,ht;q=0.4");
request.AddHeader("Accept-Encoding", "gzip, deflate, br");
request.AddHeader("Referer", "https://tr42.klanlar.org/game.php?village=31413&screen=main");
//request.AddHeader("Content-Type", "application/x-www-form-urlencoded");
request.AddHeader("Tribalwars-Ajax", "1");
request.AddHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36");
request.AddHeader("X-Requested-With", "XMLHttpRequest");
request.AddHeader("Origin", "https://tr42.klanlar.org");
request.AddHeader("Accept", "application/json, text/javascript, */*; q=0.01");
//request.AddParameter("application/x-www-form-urlencoded", "destroy=&force=&id=&source=");
//request.AddParameter("application/x-www-form-urlencoded", "destroy=0&force=1&id=31413&source=wood", ParameterType.RequestBody);
//request.AddBody("application/x-www-form-urlencoded", "destroy=0&force=1&id=31413&source=wood");
IRestResponse response = client.Execute(request);
var data = response.Content;
, . , , , # .
.. , #.
, :
{ "success": "Komut verildi.", "date_complete": 86, "date_complete_formated": "0:01:26", "building_orders": "
: . RestSharp.
2: , , , .
3: # RestSharp. , Postman. .
var client = new RestClient("https://tr42.klanlar.org/game.php?village=31413&screen=main&ajaxaction=upgrade_building&type=main&h=8951b405&=&client_time=1505062595");
var request = new RestRequest(Method.POST);
request.AddHeader("postman-token", "dab31db4-b243-c317-e585-19da84c11e62");
request.AddHeader("cache-control", "no-cache");
request.AddHeader("accept-language", "en-US,en;q=0.8,tr;q=0.6,ht;q=0.4");
request.AddHeader("accept-encoding", "gzip, deflate, br");
request.AddHeader("referer", "https://tr42.klanlar.org/game.php?village=31413&screen=main");
request.AddHeader("content-type", "application/x-www-form-urlencoded");
request.AddHeader("tribalwars-ajax", "1");
request.AddHeader("user-agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36");
request.AddHeader("x-requested-with", "XMLHttpRequest");
request.AddHeader("origin", "https://tr42.klanlar.org");
request.AddHeader("accept", "application/json, text/javascript, */*; q=0.01");
IRestResponse response = client.Execute(request);
, .