Hi
How to pass textbox values instead of hardcode in below code
var request = new RestRequest(Method.POST);
request.AddHeader("content-type", "application/json");
var body = @"{" + "\n" +
@" ""email"" : ""[email protected]""," + "\n" +
@" ""password"" : ""Tmp023""" + "\n" +
@"}";
Thanks

Vishal JoshiRank #377 · 6.7K reputationPosted Dec 21, 2022, 2:01 AM EST
Hello
You can try like below code for the RestAPI call from C#.
var request = new RestRequest(Method.POST); request.AddHeader("content-type", "application/json"); BodyClass objBody =new BodyClass() { email= txtEmail.Text, txtPassword= txtPassword.Text, }; body = JsonConvert.SerializeObject(objBody ); request.AddParameter("application/json", body, ParameterType.RequestBody);Thank You
Sachin SinghRank #66 · 26.2K reputationPosted Dec 21, 2022, 1:31 AM EST
"+txtEmail.Text+" not working?