Calculate Tariff

Overview

Service Unique Name CalculateTariff
Request Method POST
Content Type application/x-www-form-urlencoded; charset=utf-8

Description

Calculate tariff API is used to calculate the tariff of a waybill on the basis of rate contract which is saved in customer contract rate master.

Request Header

AccessKey : logixerp

Request Body

VALID JSON STRING
{
"calculateTariffRequestData":
{
"customerCode":"1007",
"sourceCity":"Smouha",
"sourceState":"",
"sourcePincode":"",
"sourceCountry":"EG",
"destinationCity":"Smouha",
"destinationState":"",
"destinationPincode":"",
"destinationCountry":"EG",
"service":"PUD",
"packages":"1",
"actualWeight":"3",
"length":"",
"width":"",
"height":"",
"codAmount":"",
"invoiceValue":""
}
}

Request Details

Parameter Data Type Required/Optional Description
SecureKey int Required It is a Unique key for accessing the API. For secure key email to support team.
customerCode String Required Customer code should be same as available in the ERP.
sourceCity String Required Consignor City should be match with the code as available in the ERP. Refer to the annexure City List for the correct values.
sourceState String Optional Consignor state is that under which consignor city comes in.
sourcePincode String Optional Consignor city Zipcode is that under which pickup location comes in.
sourceCountry String Optional Consignor country is that from where the shipment will get pickup.
destinationCity String Required Consignee city name should be matched with the city name in the ERP.
destinationState String Optional Consignee state is that where the shipment will deliver.
destinationPincode String Optional Consignee zipcode is that under which delivery location comes in.
destinationCountry String Optional Consignee Country is that where the shipment will deliver.
service String Required There are so many services in system and charges apply for shipment on the basis of services. Service Code should be same as available in the ERP
packages String Required Count of packages which are sending under a particular waybill.
actualWeight String Required Actual weight is the weight of the package which is going to be booked.
length String Optional Length of package.
width String Optional Width of package.
height String Optional Height of package
codAmount Double Type Optional COD Amount is that you are charging any amount for pickup.
invoiceValue Double Type Optional Invoice Value is the value of package. It is used for the insurance purpose.

Response Format

ON SUCCESS
{
"message":"Tariff calculated successfully",
"messageType" : "Success"
"taxAmount":0,
"totalAmount":214,
"waybillChargesMappingList":
[
{
"amount":214,
"chargeType":
{
"name":"SHIPPING FEE"
}
}
]
}

ON ERROR
{
"message":"ERROR_MESSAGE",
"messageType":"Error"
}

Error Message String

Error Messages Description
Invalid Organization Key Secure Key is wrong or missing.
Service not found Service code is not given in the request.
Source city not found City name is not given.
Actual Weight missing Actual weight is not given.
Either Number of package missing or zero Package count is not given or it is given zero.
Destination country code not valid Consignee country code is given wrong or invalid.
Source country code not valid Consignor country code is given wrong or invalid.
Destination city not found Consignee city code is given wrong or missing or invalid.

Sample Code

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;

import java.net.URL;

public class CalculateTariff {

private static final String ACCESS_KEY = "logixerp";
private static final String API_URL = "https://api.logixplatform.com/Rachna/webservice/v2/CalculateTariff?secureKey=";
private static final int SECURE_KEY = SECURE KEY;
private static final String ACCESS_URL = API_URL+SECURE_KEY;

public static void main(String[] args) throws IOException {
URL obj = new URL(ACCESS_URL);
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("AccessKey", ACCESS_KEY);
con.setRequestProperty("Content-Type", "application/json; charset=utf-8");
con.setRequestProperty("Accept", "application/json");

con.setDoOutput(true);

String jsonInputString = "{\"calculateTariffRequestData\":\r\n" +
"{\r\n" +
"\"customerCode\":\"HERO\",\r\n" +
"\"sourceCity\":\"Smouha\",\r\n" +
"\"sourceState\":\"\",\r\n" +
"\"sourcePincode\":\"\",\r\n" +
"\"sourceCountry\":\"EG\",\r\n" +
"\"destinationCity\":\"Smouha\",\r\n" +
"\"destinationState\":\"\",\r\n" +
"\"destinationPincode\":\"\",\r\n" +
"\"destinationCountry\":\"EG\",\r\n" +
"\"service\":\"FTL\",\r\n" +
"\"packages\":\"1\",\r\n" +
"\"actualWeight\":\"3\",\r\n" +
"\"length\":\"\",\r\n" +
"\"width\":\"\",\r\n" +
"\"height\":\"\"\r\n" +
"}\r\n"+

"}";

try(OutputStream os = con.getOutputStream()) {
byte[] input = jsonInputString.getBytes("utf-8");
os.write(input, 0, input.length);
}

try(BufferedReader br = new BufferedReader(
new InputStreamReader(con.getInputStream(), "utf-8"))) {
StringBuilder response = new StringBuilder();
String responseLine = null;
while ((responseLine = br.readLine()) != null) {
response.append(responseLine.trim());
}
System.out.println(response.toString());
}
}
}
import requests
import json

access_url = "https://api.logixplatform.com/Rachna/webservice/v2/CalculateTariff"

params = {'SecureKey':'secure_key'}
data = {
"customerCode":"HERO",
"sourceCity":"Smouha",
"sourceState":"",
"sourcePincode":"",
"sourceCountry":"EG",
"destinationCity":"Smouha",
"destinationState":"",
"destinationPincode":"",
"destinationCountry":"EG",
"service":"FTL",
"packages":"1",
"actualWeight":"3",
"length":"",
"width":"",
"height":"",
"codAmount":"",
"invoiceValue":""

}

payload = {"calculateTariffRequestData":data}

headers = {'Content-Type': 'application/json', 'AccessKey':'logixerp'}

try:
r = requests.post(access_url, params=params, headers=headers, data=json.dumps(payload))
print (r.text)
except requests.exceptions.RequestException as err:
print (err)
please wait...