Hi
How to pass the below data to restsharp APi body.
var objShippingOrdr = new ModelClass();
objShippingOrdr.OrderNo = txtOrderNo.Text;
objShippingOrdr.PaymentType = ddlPaymentType.SelectedItem.Value;
objShippingOrdr.OrderAmount = Convert.ToDecimal(txtOrderAmount.Text);
objShippingOrdr.consignee.name = txtConsigneeName.Text;
objShippingOrdr.consignee.address = txtConsigneeAddress.Text;
//objShippingOrdr.consignee.address = txtConsigneeAddress.Text;
objShippingOrdr.consignee.city = txtConsigneeCity.Text;
objShippingOrdr.consignee.state = txtConsigneeState.Text;
objShippingOrdr.consignee.pincode = Convert.ToInt32(txtConsigneePinCode.Text);
objShippingOrdr.consignee.phone = Convert.ToInt32(txtConsigneePhone.Text);
objShippingOrdr.pickup.name = txtPickupName.Text;
objShippingOrdr.pickup.address = txtPickupAddress.Text;
objShippingOrdr.pickup.city = txtPickupCity.Text;
objShippingOrdr.pickup.state = txtPickupState.Text;
objShippingOrdr.pickup.pincode = Convert.ToInt32(txtPickupPinCode.Text);
objShippingOrdr.pickup.phone = Convert.ToInt32(txtPickupPhone.Text);
List<OrderDetails> orderDetails = new List<OrderDetails>();
orderDetails.Add(new OrderDetails
{
name = "abc",
qty = 1,
price = 5000
});
orderDetails.Add(new OrderDetails
{
name = "xyz",
qty = 1,
price = 2000
});
var client = new RestClient("https://api.nimbuspost.com/v1/shipments");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", body, ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
Thanks