# Retail and Third-Party Logistics (ERP)

Version: 1.1 | Release Date: 7/12/2018

# Point-of-Sale (POS) Web Services

# Get Records of POS Members

Get detail information including customer code/ID of POS Members.


HTTP Request

POST http://[server]/jsf/rfws/erp/poscore/member/getCustomer/


Parameters

All parameters are wrapped inside a JSON object. Please read the sample request for details.

Name Type Description
beId int Required. Business Entity ID
code string Member Code
displayName string Member Display Name
email string Member Email
mobile string Member Mobile
tel string Member Tel.

Result (in JSON Array: "data")

Name Type Description
memCode string Member Code
memName string Member Display Name
cusId int Customer ID
cusCode string Customer Code
mobile string Member Mobile
tel string Member Tel.
email string Member Email

Sample request:

JsonObject data = new JsonObject();
data.addProperty("beId", 203);
data.addProperty("mobile", "98765432");

RequestBody requestBody = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), data.toString());

String url = "http://" + server + "/jsf/rfws/erp/poscore/member/getCustomer/";

Request request = new Request.Builder()
  .url(url)
  .addHeader("client_id", MyValue.clientID)
  .addHeader("authorization", "Bearer " + access_token)
  .addHeader("cache-control", "no-cache")
  .post(requestBody)
  .build();

OkHttpClient client = new OkHttpClient();
Response response = client.newCall(request).execute();

Sample response:

{
  "code": "0",
  "data": [
    {
      "memCode": "KS_M001",
      "memName": "Mr. TM Cheung",
      "cusId": 27394,
      "mobile": "98765432",
      "tel": "32459876",
      "cusCode": "KS_M001",
      "email": "tmchan@mailexpress.com"
    },
    {
      "memCode": "KS_M005",
      "memName": "Mr. Expire Cardo",
      "cusId": 27408,
      "mobile": "98765432",
      "tel": "",
      "cusCode": "KS_M005",
      "email": ""
    }
  ],
  "success": true,
  "message": "Success"
}



# Get Pricing of POS Products

Get selling prices / discounts of products as at specific date, the price is loaded from Auto Pricing / Price List (POS) and Product FM.


HTTP Request

POST http://[server]/jsf/rfws/erp/poscore/product/getProInfoByCus/


Parameters

Name Type Description
beId int Required. Business Entity ID
date date Required. Specified Date, with format as "YYYY-MM-DD"
customers JSONArray JSON Array of Customer Code
products JSONArray JSON Array of Products Code
shopId int POS Shop ID

customers (in JSON Array)

Name Type Description
code string Required. Customer Code

products (in JSON Array)

Name Type Description
code string Required. Product Code

Result (in JSON Array: "data")

Name Type Description
cusCode string Customer Code
pros JSONArray JSON Array of Product info.

pros (In JSON Array)

Name Type Description
id int Product ID
code string Product Code
desc string Product Description
unit JSON JSON String of Unit Info.
price JSON JSON String of Price Info.
series JSON JSON String of Series Info.
amt decimal Amount
retailType string Retail Type: retail / packPro / service

unit (in JSON Object)

Name Type Description
id int Unit ID
code string Unit Code

price (in JSON Object)

Name Type Description
disc decimal Discount
up int Unit Price
type string Price Source: autoPricing / priceList / product

series (in JSON Object)

Name Type Description
id int Series ID
code string Series Code
desc string Series Description

Sample request:

JsonArray cusJsonArray = new JsonArray();
JsonObject cusJsonObj new JsonObject();
cusJsonObj.put("code", "KS_M001");
cusJsonArray.add(cusJsonObj);

JsonArray proJsonArray = new JsonArray();
JsonObject proJsonObj = new JsonObject();
proJsonObj.put("code", "KC_POS_001");
proJsonArray.add(proJsonObj);
proJsonObj = new JsonObject();
proJsonObj.put("code", "KC_PC_001");
proJsonArray.add(proJsonObj);

JsonObject data = new JsonObject();
data.addProperty("beId", 203);
data.addProperty("date", "2018-06-05");
data.addProperty("customers", cusJsonArray);
data.addProperty("products", proJsonArray);

RequestBody requestBody = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), data.toString());

String url = "http://" + server + "/jsf/rfws/erp/poscore/product/getProInfoByCus/";

Request request = new Request.Builder()
  .url(url)
  .addHeader("client_id", MyValue.clientID)
  .addHeader("authorization", "Bearer " + access_token)
  .addHeader("cache-control", "no-cache")
  .post(requestBody)
  .build();

OkHttpClient client = new OkHttpClient();
Response response = client.newCall(request).execute();

Sample response:

{
  "code": "0",
  "data": [
    {
      "pros": [
        {
          "unit": {
            "code": "PCS",
            "id": 3
          },
          "retailType": "retail",
          "code": "KC_PC_001",
          "price": {
            "disc": 23,
            "up": 369,
            "type": "priceList"
          },
          "series": {
            "code": "KC-SES-001",
            "id": 3,
            "desc": "日常用品"
          },
          "id": 4308,
          "desc": "PC (HX84953)"
        },
        {
          "unit": {
            "code": "PCS",
            "id": 3
          },
          "retailType": "retail",
          "code": "KC_POS_001",
          "price": {
            "disc": 10,
            "up": 33,
            "type": "autoPricing"
          },
          "series": {
            "code": "KC-SES-001",
            "id": 3,
            "desc": "日常用品"
          },
          "id": 4288,
          "desc": "POS 雞肶"
        }
      ],
      "cusCode": "KS_M001"
    }
  ],
  "success": true,
  "message": "Success"
}


# Register New POS Member

Register new POS Member.


HTTP Request

POST http://[server]/jsf/rfws/erp/poscore/member/add/


Parameters

All parameters are wrapped inside a JSON object. Please read the sample request for details.

Name Type Description
beId int Required. Business entity ID
memTypeId int Required. Member Type ID
mainCardNo string Main Card No
cardNameId int Card Title
mobile string Mobile
titleCode string Title Code: mr / mrs / miss
firstName string First Name
lastName string Last Name
displayName string Display Name
dayOfBirth int Day of Birth
monthOfBirth int Month of Birth
age int Age
idNo string ID No.
gender string Gender: male / female
shopId int POS Shop ID

Result

Name Type Description
success int true for success; false for error
messageCode string 0001 for success; other message code implies different message
message string success / reason of failure

Sample request:

JsonObject data = new JsonObject();
data.addProperty("beId", 203);
data.addProperty("lastName", "Chan");
data.addProperty("gender", "male");
data.addProperty("displayName", "Mr. Ben Chan");
data.addProperty("mobile", "23456789");
data.addProperty("titleCode", "mr");
data.addProperty("monthOfBirth", 1);
data.addProperty("firstName", "Ben");
data.addProperty("dayOfBirth", 1);
data.addProperty("cardNameId", 15);
data.addProperty("shopId", 2);
data.addProperty("memTypeId", 10);

RequestBody requestBody = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), data.toString());

String url = "http://" + server + "/jsf/rfws/erp/poscore/member/add/";

Request request = new Request.Builder()
  .url(url)
  .addHeader("client_id", MyValue.clientID)
  .addHeader("authorization", "Bearer " + access_token)
  .addHeader("cache-control", "no-cache")
  .post(requestBody)
  .build();

OkHttpClient client = new OkHttpClient();
Response response = client.newCall(request).execute();

Sample response:

{
    "success": true,
    "messageCode": "0001",
    "message":"Success"
}


# Get Store Value Balance of Member

Get store value balance of member as at a specific date.


HTTP Request

POST http://[server]/jsf/rfws/erp/storeValue/getSVBalance/


Parameters

Name Type Descriptio
beId int Required. Business Entity ID
memId int Required. Member ID
svId int **Required. **Store Value ID
chkDate date As at date, with format "YYYY-MM-DD", default is today

Result (in JSON Object: "data")

Name Type Description
balance string Store Value Balance

Sample request:

JsonObject data = new JsonObject();
data.addProperty("beId", 203);
data.addProperty("memId", 5);
data.addProperty("svId", 28);
data.addProperty("chkDate", "2019-06-28");

RequestBody requestBody = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), data.toString());

String url = "http://" + server + "//jsf/rfws/erp/bonus/getBpBal/";

Request request = new Request.Builder()
  .url(url)
  .addHeader("client_id", MyValue.clientID)
  .addHeader("authorization", "Bearer " + access_token)
  .addHeader("cache-control", "no-cache")
  .post(requestBody)
  .build();

OkHttpClient client = new OkHttpClient();
Response response = client.newCall(request).execute();

Sample response:

{
  "success": true,
  "code": "0",
  "message": "Success",
  "data": {
    "balance": 25
  }
}

# Save Store Value Ledger

Save Store Value Ledger.


HTTP Request

POST http://[server]/jsf/rfws/erp/poscore/storeValue/saveSVLedger/


Parameters

All parameters are wrapped inside a JSON object. Please read the sample request for details.

Name Type Description
beId int Business entity ID, default value for data list.
memId int Member ID, default value for data list.
svId int Stored Value ID, default value for data list.
svfId int Stored Value Voucher ID, default value for data list.
data JSONArray Stored Value Ledger data list.

data list (in JSON Object: "data")

Name Type Description
beId int Business entity ID
memId int Member ID
svId int Stored Value ID
svfId int Stored Value Voucher ID
svLedger decimal **Required. **Stored Value Ledger, can not be 0.
tranType String Source Transaction Type
tranId int Source Transaction
tranCode String Source Transaction Code
tranDate date Source Transaction Date, with format "YYYY-MM-DD".
expDate date Expiry Date, with format "YYYY-MM-DD".
desc String Description.

Result

Name Type Description
status boolean true for success; false for error
message string reason of failure

Sample request:

JSONObject data = new JSONObject();

data.put("beId", "298");
data.put("memId", "196");
data.put("svId", "34");
data.put("svfId", "0");

JSONArray dataArray = new JSONArray();
JSONObject obj = new JSONObject();

obj.put("beId", "298");
obj.put("memId", "196");
obj.put("svId", "34");
obj.put("svfId", "0");
obj.put("svLedger", "30297.3600");

obj.put("tranType", "poscoreSVTransfer");
obj.put("tranId", "1");
obj.put("tranDate", "2019-04-22");
obj.put("tranCode", "TEST");
obj.put("expDate", "9999-12-31");
obj.put("desc", "");
dataArray.put(obj);

data.put("data", dataArray);

String path = PRE_URL + "/jsf/rfws/erp/poscore/storeValue/saveSVLedger";
HttpPost post = new HttpPost(path);
post.setEntity(new StringEntity(data.toString()));
post.addHeader("authorization", AUTHORIZATION);
post.addHeader("client_id", clientID);
post.addHeader("Content-Type", "application/json");

HttpResponse res = client.execute(post);

Sample response:

{
    "success": true,
    "message":"ce01_poscore.dataEmpty"
}



# E-Commerce and Magento Web Services

# Get Records of E-Commerce Members

Get detail information including customer code/id of E-Commerce Members.


HTTP Request

POST http://[server]/jsf/rfws/erp/ecom/member/getCustomer/


Parameters

All parameters are wrapped inside a JSON object. Please read the sample request for details.

Name Type Description
beId int Required. Business Entity ID
name string Member Name
email string Member Email
mobile string Member Mobile

Result (in JSON Array: "data")

Name Type Description
memName string Member Name
cusId int Customer ID
cusCode string Customer Code
mobile string Member Mobile
email string Member Email

Sample request:

JsonObject data = new JsonObject();
data.addProperty("beId", 203);
data.addProperty("name", "Lillie Dach");

RequestBody requestBody = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), data.toString());

String url = "http://" + server + "/jsf/rfws/erp/ecom/member/getCustomer/";

Request request = new Request.Builder()
  .url(url)
  .addHeader("client_id", MyValue.clientID)
  .addHeader("authorization", "Bearer " + access_token)
  .addHeader("cache-control", "no-cache")
  .post(requestBody)
  .build();

OkHttpClient client = new OkHttpClient();
Response response = client.newCall(request).execute();

Sample response:

{
  "code": "0",
  "data": [
    {
      "memName": "Lillie Dach",
      "cusId": 27406,
      "mobile": "",
      "cusCode": "CUS180005",
      "email": "Lillie.Dach@data-generator.com"
    }
  ],
  "success": true,
  "message": "Success"
}


# Get Records of Magento Members

Get detail information including customer code/id of Magento Members.


HTTP Request

POST http://[server]/jsf/rfws/eshop/getCustomer/


Parameters

All parameters are wrapped inside a JSON object. Please read the sample request for details.

Name Type Description
beId int Required. Business Entity ID
firstName string Member First Name
lastName string Member Last Name
email string Member Email

Result (in JSON Array: "data")

Name Type Description
memId int Member ID
cusId int Customer ID
cusCode string Customer Code
firstName string Member First Name
lastName string Member Last Name
email string Member Email

Sample request:

JsonObject data = new JsonObject();
data.addProperty("beId", 203);
data.addProperty("lastName", "Alan");

RequestBody requestBody = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), data.toString());

String url = "http://" + server + "/jsf/rfws/eshop/getCustomer/";

Request request = new Request.Builder()
  .url(url)
  .addHeader("client_id", MyValue.clientID)
  .addHeader("authorization", "Bearer " + access_token)
  .addHeader("cache-control", "no-cache")
  .post(requestBody)
  .build();

OkHttpClient client = new OkHttpClient();
Response response = client.newCall(request).execute();

Sample response:

{
  "code": "0",
  "data": [
    {
      "firstName": "Alan",
      "lastName": "Alan",
      "cusId": 27099,
      "cusCode": "CUS170004",
      "email": "alan.wk.wong@mac.hk",
      "memId": 1
    }
  ],
  "success": true,
  "message": "Success"
}



# Third-party Logistics (LSP) Web Services

# Get List of Picking Lists

Get a list of picking lists in a specific business entity.


HTTP Request

POST http://[server]/jsf/rfws/erp/lsp/pickinglist/getList/


Parameters

All parameters are wrapped inside a JSON object. Please read the sample request for details.

Name Type Description
beId int Required. Business Entity ID
locId int Location ID
notYetScannedOnly boolean If true, result set will only return those picking list with at least one row of footer that is not yet scanned (scanned = 0).

Result (in JSON Array: "data")

Name Type Description
id int Picking List ID
code string Picking List Code
genDate date Generation date of the picking list
lastScanDate date Last scan date of the picking list
plStatus string Picking List status: open / pending / done
scanBy int JSON String of User info.
be json JSON String of Product info.

scanBy (in JSON Object)

Name Type Description
id int User ID
code string User Code
desc string User Description
avatar string URL of the user photo

be (in JSON Object)

Name Type Description
id int Business Entity ID
code string Business Entity Code
desc string Business Entity Description

Sample request:

JsonObject data = new JsonObject();
data.addProperty("beId", 173);

RequestBody requestBody = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), data.toString());

String url = "http://" + server + "/jsf/rfws/erp/lsp/pickinglist/getList/";

Request request = new Request.Builder()
  .url(url)
  .addHeader("client_id", MyValue.clientID)
  .addHeader("authorization", "Bearer " + access_token)
  .addHeader("cache-control", "no-cache")
  .post(requestBody)
  .build();

OkHttpClient client = new OkHttpClient();
Response response = client.newCall(request).execute();

Sample response:

{
    "data": [
        {
            "code": "PL20170065",
            "genDate": "2017-11-09 00:00:00",
            "lastScanDate": "1900-01-01 00:00:00",
            "scanBy": {
                  "code": "",
                  "id": 0,
                  "desc": "",
              	  "avatar": ""
            },
            "id": 51,
            "plStatus": "open",
            "be": {
                  "code": "KC_TEST_PICKING_LIST",
                  "id": 216,
                  "desc": "Test Picking List Company"
              }
        },
        {
            "code": "PL20170057",
            "genDate": "2017-11-09 00:00:00",
            "lastScanDate": "1900-01-01 00:00:00",
            "scanBy": {
                  "code": "",
                  "id": 0,
                  "desc": "",
              	  "avatar": ""
            },
            "id": 49,
            "plStatus": "open"",
            "be": {
                  "code": "KC_TEST_PICKING_LIST",
                  "id": 216,
                  "desc": "Test Picking List Company"
              }
        },
       {
            "code": "PL20170039",
            "genDate": "2017-10-13 00:00:00",
            "lastScanDate": "1900-01-01 00:00:00",
            "plStatus": "open",
            "scanBy": 0,
            "id": 33",
            "be": {
                  "code": "KC_TEST_PICKING_LIST",
                  "id": 216,
                  "desc": "Test Picking List Company"
              }
        }
    ],
    "success": true,
    "messageCode": "0001",
    "message": "Success"
}


# Get Detail of a Picking List

Get a specific picking list in a specific business entity.


HTTP Request

POST http://[server]/jsf/rfws/erp/lsp/pickinglist/get/


Parameters

All parameters are wrapped inside a JSON object. Please read the sample request for details.

Name Type Description
id int Required. Picking List ID
beId int Required. Business Entity ID

Result (in JSON Object: "data")

Name Type Description
id int Picking List ID
code string Picking List Code
plStatus string Picking List status: open / pending / done
lsp json JSON String of Logistic Service Provider info.
products json JSON Array of Product info.
parcels json JSON Array of Parcel info.

lsp (in JSON Object)

Name Type Description
id int Logistic Service Provider ID
code string Logistic Service Provider Code
desc string Logistic Service Provider Description

products (in JSON Array)

Name Type Description
id int Product ID
code string Product Code
desc string Product Description
finalQty decimal Quantity of the product to be delivered
scanned decimal Scanned Quantity of the product
adjQty decimal Adjusted Quantity of the product
photos JSON List of Photos which the print attribute is checked in Product FM
toBePicked decimal Quantity of the product to be picked
useLotno boolean Indicate if the product uses lot No.
baseUnit JSON JSON String of Base Unit info.
lotNos JSON JSON Array of Lot No. info.

baseUnit (in JSON Object)

Name Type Description
id int Unit ID
code string Unit Code

lotNos (in JSON Array)

Name Type Description
id int Lot No. ID
code string Lot No. Code
scanned decimal Scanned Quantity of the Lot No.
qty decimal Final Quantity of the Lot No.

parcels (in JSON Array)

Name Type Description
widthCm decimal Width of parcel
heightCm decimal Height of parcel
lengthCm decimal Length of parcel
ttlVolumeCBM decimal Total Volume
ttlWeightKG decimal Total Weight
ttlQty decimal Total Quantity
parcel JSON JSON String of Parcel info.

parcel (in JSON Object)

Name Type Description
id int Parcel ID
code string Parcel Code
desc string Parcel Description

Sample request:

JsonObject data = new JsonObject();
data.addProperty("beId", 173);
data.addProperty("id", 33);

RequestBody requestBody = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), data.toString());

String url = "http://" + server + "/jsf/rfws/erp/lsp/pickinglist/get/";

Request request = new Request.Builder()
  .url(url)
  .addHeader("client_id", MyValue.clientID)
  .addHeader("authorization", "Bearer " + access_token)
  .addHeader("cache-control", "no-cache")
  .post(requestBody)
  .build();

OkHttpClient client = new OkHttpClient();
Response response = client.newCall(request).execute();

Sample response:

{
    "data": {
        "code": "PL20180115",
        "lsp": {
            "code": "4PX_H3",
            "id": 18,
            "desc": "4PX Hong Kong"
        },
        "plStatus": "open",
        "id": 89,
        "parcels": [
            {
                "parcel": {
                    "code": "4PX_H3_P",
                    "id": 14,
                    "desc": "4PX Parcel "
                },
                "widthCm": 2,
                "heightCm": 3,
                "ttlVolumeCBM": 0.000006,
                "lengthCm": 1,
                "ttlWeightKG": 1,
                "ttlQty": 1
            }
        ],
        "products": [
            {
                "baseUnit": {
                    "code": "PCS",
                    "id": 3
                },
                "code": "IPAD 5",
                "finalQty": 10,
                "scanned": 0,
                "adjQty": 10,
                "id": 3982,
                "useLotno" : true,
                "lotNos": [
                    {
                        "code": "OS018015300000000000",
                        "scanned": 1,
                        "qty": 4,
                        "id": 1542
                    }
                ],
                "photos": [],
                "toBePicked": 10,
                "desc": "iPad 5"
            }
        ]
    },
    "success": true,
    "messageCode": "0001",
    "message": "Success"
}


# Save Picking List

Save a picking list in a specific business entity.


HTTP Request

POST http://[server]/jsf/rfws/erp/lsp/pickinglist/save/


Parameters

All parameters are wrapped inside a JSON object. Please read the sample request for details.

If Parcels or Products is not provided, the footer will remain unchanged.

Name Type Description
beId int Required. Business Entity ID
id int Required. Picking List ID
action string pending / done / clear
lspId int Logistic Provider ID
parcels JSON JSON Array of Parcel info. (Optional)
products JSON JSON Array of Product info. (Optional)

parcels (in JSON Array)

Name Type Description
widthCm decimal Required. Width of parcel
heightCm decimal Required. Height of parcel
lengthCm decimal Required. Length of parcel
ttlVolumeCBM decimal Required. Total Volume
ttlWeightKG decimal Required. Total Weight
parcel JSON Required. JSON String of Parcel info.

parcel (in JSON Object)

Name Type Description
id int Required. Parcel ID

products (in JSON Array)

Name Type Description
id int Required. Product ID
finalQty decimal Required. Quantity of the product to be delivered
scanned decimal Required. Scanned Quantity of the product
baseUnit JSON Required. JSON String of Base Unit info.
lotNos JSON Required. JSON Array of Lot No. info.

baseUnit (in JSON Object)

Name Type Description
id int Required. Unit ID

lotNos (in JSON Array)

Name Type Description
id int Required. Lot No. ID
code string Lot No. Code
scanned decimal Required. Scanned Quantity of the Lot No.
qty decimal Required. Final Quantity of the Lot No.

Result

Name Type Description
success int true for success; false for error
messageCode string 0001 for success; other message code implies different message
message string success / reason of failure

Sample request:

RequestBody requestBody = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), data.toString());

String url = "http://" + server + "/jsf/rfws/erp/lsp/pickinglist/save/";

Request request = new Request.Builder()
  .url(url)
  .addHeader("client_id", MyValue.clientID)
  .addHeader("authorization", "Bearer " + access_token)
  .addHeader("cache-control", "no-cache")
  .post(requestBody)
  .build();

OkHttpClient client = new OkHttpClient();
Response response = client.newCall(request).execute();

Sample response:

{
    "success": true,
    "messageCode": "0001",
    "message":"Success"
}


# Get Parcel List

Get a parcel list in a specific business entity.


HTTP Request

POST http://[server]/jsf/rfws/erp/lsp/serviceProvider/getParcelList/


Parameters

All parameters are wrapped inside a JSON object. Please read the sample request for details.

Name Type Description
beId int Required. Business Entity ID
lspId int Logistic Service Provider ID

Result (in JSON Array: "data")

Name Type Description
id int Parcel ID
code string Parcel Code
desc string Parcel Description
length decimal Length of Parcel
width decimal Width of Parcel
height decimal Height of Parcel
lsp json JSON String of Logistic Service Provider info.

lsp (in JSON Object)

Name Type Description
id int Logistic Service Provider ID
code String Logistic Service Provider Code
desc String Logistic Service Provider Description

Sample request:

JsonObject data = new JsonObject();
data.addProperty("lspId", 17);

RequestBody requestBody = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), data.toString());

String url = "http://" + server + "/jsf/rfws/erp/lsp/serviceProvider/getParcelList/";

Request request = new Request.Builder()
  .url(url)
  .addHeader("client_id", MyValue.clientID)
  .addHeader("authorization", "Bearer " + access_token)
  .addHeader("cache-control", "no-cache")
  .post(requestBody)
  .build();

OkHttpClient client = new OkHttpClient();
Response response = client.newCall(request).execute();

Sample response:

{
    "data": [
        {
            "code": "BIG",
            "length": 30,
            "width": 40,
            "lsp": {
                "code": "SF",
                "id": 5,
                "desc": "S.F. Express"
            },
            "id": 1,
            "desc": "Big size",
            "height": 20
        },
        {
            "code": "KC_ZTO_OBJ",
            "length": 1,
            "width": 2,
            "lsp": {
                "code": "ZTO",
                "id": 7,
                "desc": "中通"
            },
            "id": 3,
            "desc": "中通貨",
            "height": 3
        }
    ],
    "success": true,
    "messageCode": "0001",
    "message": "Success"
}


# Courier Tracking

Get courier tracking information of a delivery note in a specific business entity.


HTTP Request

POST http://[server]/jsf/rfws/erp/lsp/service/getTrackStatus/


Parameters

All parameters are wrapped inside a JSON object. Please read the sample request for details.

Name Type Description
beId int Required. Business Entity ID
dnCode string Delivery Note No. in M18
trackCode string Tracking No. provided by courier

Only need to provide either dnCode or trackCode.


Result (in JSON Object: "data")

Name Type Description
dnCode string Delivery Note No.
trackCode string Courier Tracking No.
state string State
tracks json JSON Array of Courier Tracking info.

tracks (in JSON Array)

Name Type Description
date date Date
status String Status
remarks String Remarks

Sample request:

JsonObject data = new JsonObject();
data.addProperty("dnCode", "DN201806300125");

RequestBody requestBody = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), data.toString());

String url = "http://" + server + "/jsf/rfws/erp/lsp/serviceProvider/getTrackStatus/";

Request request = new Request.Builder()
  .url(url)
  .addHeader("client_id", MyValue.clientID)
  .addHeader("authorization", "Bearer " + access_token)
  .addHeader("cache-control", "no-cache")
  .post(requestBody)
  .build();

OkHttpClient client = new OkHttpClient();
Response response = client.newCall(request).execute();


# Download Courier Label

Download courier label of a delivery note in a specific business entity.


HTTP Request

POST http://[server]/jsf/rfws/erp/lsp/service/printLabel/


Parameters

All parameters are wrapped inside a JSON object. Please read the sample request for details.

Name Type Description
beId int Required. Business Entity ID
dnCode string Delivery Note No. in M18
trackCode string Tracking No. provided by courier

Only need to provide either dnCode or trackCode.


Result

HTML response code = 200 and a pdf or html of the courier label will be downloaded.


Sample request:

JsonObject data = new JsonObject();
data.addProperty("dnCode", "DN201806300125");

RequestBody requestBody = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), data.toString());

String url = "http://" + server + "/jsf/rfws/erp/lsp/serviceProvider/printLabel/";

Request request = new Request.Builder()
  .url(url)
  .addHeader("client_id", MyValue.clientID)
  .addHeader("authorization", "Bearer " + access_token)
  .addHeader("cache-control", "no-cache")
  .post(requestBody)
  .build();

OkHttpClient client = new OkHttpClient();
Response response = client.newCall(request).execute();