Hi
In below code i dont want to pass hardcode value but Textbox value
var body = @"{" + "\n" +
@" ""awb"" : ""59617520664""" + "\n" +
@"}";
Thanks
Hi
In below code i dont want to pass hardcode value but Textbox value
var body = @"{" + "\n" +
@" ""awb"" : ""59617520664""" + "\n" +
@"}";
Thanks
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Jignesh KumarRank #91 · 22.9K reputationPosted Dec 25, 2022, 10:36 PM EST
Hi Ramco,
Your string format is not proper, you have added extra " in your string, Please do below changes,
string awb = "59612420664"; var client = new RestClient("https://api.nimbuspost.com/v1/shipments/cancel"); client.Timeout = -1; var request = new RestRequest(Method.POST); request.AddHeader("Content-Type", "application/json"); var body = @"{" + "\n" + @"awb : " + awb + " \n" + @"}";Sachin SinghRank #66 · 26.2K reputationPosted Dec 24, 2022, 12:55 PM EST
test this
var body = String.Format("{{awb :{0} }}",txtbox1.Text);Jignesh KumarRank #91 · 22.9K reputationPosted Dec 25, 2022, 3:54 AM EST
Hello Ramco,
Please replace your hardcoded values with textbox,
var body = @"{" + "\n" + @" ""awb"" : " + txtYourTextBox.Text + "\n" + @"}";Ramco RamcoRank #462 · 5.4K reputationPosted Dec 25, 2022, 9:07 AM EST
Hi
I have written below code but it is giving error - unexpected character \
string awb = "59612420664"; var client = new RestClient("https://api.nimbuspost.com/v1/shipments/cancel"); client.Timeout = -1; var request = new RestRequest(Method.POST); request.AddHeader("Content-Type", "application/json"); var body = @"{" + "\n" + @" ""awb"" : + awb + "\n" + @"}";Thanks
Amit MohantyRank #112 · 20K reputationPosted Dec 25, 2022, 11:36 PM EST
Try this.
var body = "{ \"awb\":\"59617520664\" }"; // OR var body = new { awb = "59617520664" };