Type
|
Url
|
Headers
|
SandBox
|
https://gstsandbox.charteredinfo.com/aspapi/v1.0/<actionname>
|
1. aspid
2. password
3. gstin
|
Production
|
https://einvapi.charteredinfo.com/aspapi/v1.0/<actionname>
|
1. aspid
2. password
3. gstin
|
Demo Url for Print
|
https://einvapi.charteredinfo.com/aspapi/v1.0/printewb?showdemo
|
1. aspid
2. password
3. Gstin
|
Parms: Either in Header or Query Parameters
Body: Json result from GetEwayBill API.
Invocation: The Response content of successful PrintEwb API call shall be read as binary (byte[]) and stored in .pdf file.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Since Above API is Post API, We had also created one DEMO GET Method which pick-ups body from fixed json file (instead of reading the same from posted body)
Sample url for DEMO is given above:
Implementation Help
Below code is for ASPs who are using Url Based APIs only..... For ASPs using .Net lib refer code from Intigration of .Net lib
Note: Below code snipet is for .Net C# (using RestClient as http client)
API Method
|
Action
|
Printing e-Way Bill
|
printewb
|
Printing Detailed e-Way Bill
|
printdetailewb
|
printing consolidated e-Way Bill
|
printcewb
|
RestClient client = new RestClient(Constants.GspApiBaseUrl + "/" + Action);
RestRequest request = new RestRequest(Method.POST);
//Adding required Header
request.AddHeader("aspid", EwbApiSetting.AspUserId);
request.AddHeader("password", EwbApiSetting.AspPassword);
request.AddHeader("Gstin", EwbApiLoginDetails.EwbGstin);
request.AddBody(ewbDetail); // ewbDetail is the responce object of GetEwayBillDetail Api
// Downloading the responce in byte[] - make sure response as read as binary and not text
byte[] response = client.DownloadData(request);
try
{
//This methods checks and creates directory if does not exists
string pdfFolderPath = @"MyeWaybillDoc\"; //Providing Path
string pdfPath = pdfFolderPath + ewbDetail.ewbNo.ToString() + ".pdf";
//Writing the responce in Byte
File.WriteAllBytes(pdfPath, response);
if (displayPdf == true)
Process.Start(pdfPath); //Code to display .pdf file
}