Type
|
Url
|
Headers
|
SandBox
|
https://gstsandbox.charteredinfo.com/ewaybillapi/dec/v1.03/ewayapi?action=CANEWB
|
1. aspid
2. password
3. gstin
4. username
5. authtoken
|
Production
|
https://einvapi.charteredinfo.com/v1.03/dec/ewayapi?action=CANEWB
|
1. aspid
2. password
3. gstin
4. username
5. authtoken
|
string action = "CANEWB";
ReqPlCancelEWB reqPlCancelEWB = new ReqPlCancelEWB();
reqPlCancelEWB.ewbNo = 211223256570;
reqPlCancelEWB.cancelRsnCode = 2;
reqPlCancelEWB.cancelRmrk = "Cancelled the order";
RestClient client = new RestClient("https://gstsandbox.charteredinfo.com/ewaybillapi/dec/v1.03/ewayapi?action=CANEWB");
RestRequest request = new RestRequest(Method.POST);
//request.AddHeader("Gstin", "************");
//request.AddHeader("user_name", "************");
request.AddHeader("gstin", "************");
request.AddHeader("username", "************");
request.AddHeader("authtoken", "jSNGkXqh8RshEAf91CAFMMdcp");
request.AddHeader("aspid", "************");
request.AddHeader("password", "************");
request.AddHeader("Content-Type", "application/json; charset=utf-8");
request.RequestFormat = DataFormat.Json;
//ReqPlGenIRN reqPlGenIRN = new ReqPlGenIRN();
string strJson = JsonConvert.SerializeObject(reqPlCancelEWB);
//request.AddBody(reqPlGenIRN);
request.AddParameter("application/json", strJson, ParameterType.RequestBody);
IRestResponse response = await client.ExecuteTaskAsync(request);
//RespPl respPl = new RespPl();
//respPl = JsonConvert.DeserializeObject<RespPl>(response.Content);
RespPlCancelEWB resp = new RespPlCancelEWB();
resp = JsonConvert.DeserializeObject<RespPlCancelEWB>(response.Content);