# Purchase Quotation

# Fetch Purchase Quotation List

# 一、Description

​ Usage: Fetch Purchase Quotation List.

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/search/search
HTTP Method GET
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
stSearch String(Query) Yes vqu
beId long(Query) Yes Business Entity ID
formatId long(Query) No Lookup Query ID, If not specified, the default format is used.
startRow int(Query) No Resultset offset : start index
endRow int(Query) No Resultset offset : end index
quickSearchStr String(Query) No Quick search keyword

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/search/search";
		String param = "&stSearch=vqu&beId=11";

		HttpGet get = new HttpGet(url + "?" + param);
		get.addHeader("authorization", access_token);
		get.addHeader("client_id", ClientID);
		res = client.execute(get);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));
		}
		get.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

​ 4、Response Sample

{
  	"stSearch": "vqu",
    "size": 10,
    "stSearchDisplay": "Purchase Quotation",
    "values": [
        {
            "code": "ITVQU220324A",
            "tDate": "2022-03-04",
            "mainvqu.venId.ven.code": "2000C-014",
            "mainvqu.venId.ven.desc__lang": "Choi Hop Hong Co., Ltd",
            "mainvqu.curId.cur.sym": "HK$",
            "mainvqu.flowTypeId.flowtype.code": "SALE",
            "mainvqu.flowTypeId.flowtype.desc": "Sales Flow",
            "iRev": 1,
            "lastModifyDate": "2022-03-24 12:24:49",
            "mainvqu.lastModifyUid.simpleUser.desc__lang": "Ivan Tan",
            "id": 47,
            "st_desc": "ITVQU220324A",
            "st_id": 47,
            "st_code": "ITVQU220324A"
        }
  	]
}

# Load Purchase Quotation

# 一、Description

​ Usage: Load 【Purchase Quotation】Record

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/root/api/read/vqu
HTTP Method GET
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
menuCode String(Query) Yes vqu
id long(Query) Yes Purchase Quotation ID
param String(Query) No Extra Pamameters: in JSON format

​ 3、Request Sample

		CloseableHttpClient client = HttpClientBuilder.create().build();
		CloseableHttpResponse res = null;
		try {

			String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/root/api/read/vqu";
			String param = "&menuCode=vqu&id=" + id;

			HttpGet get = new HttpGet(url + "?" + param);
			get.addHeader("authorization", access_token);
			get.addHeader("client_id", ClientID);
			res = client.execute(get);
			if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
				JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

				System.out.println(json);
			}

			get.releaseConnection();
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			try {
				if (res != null) {
					res.close();
				}
				if (client != null) {
					client.close();
				}
			} catch (Exception ex) {
				ex.printStackTrace();
			}
		}

​ 4、Response Sample

{
    "data": {
        "mainvqu": [
            {
                "lastModifyUid": 11,
                "useAccess": false,
                "virDeptId": 0,
                "expiredDate": -2209017600000,
                "position_zh-CN": "",
                "sysJson": "",
                "viewCode": "vqu",
                "expDate": 253402185600000,
                "beId": 11,
                "useAccessBl": false,
                "id": 47,
                "doctypeId": 0,
                "locked": false,
                "position_ctw": "",
                "lastModifyDate": 1648095889000,
                "createUid": 11,
                "rev": "1",
                "lastApproveUid": 11,
                "ttlCharge": 0.0,
                "expiredUid": 0,
                "freeQtyPer": 0.0,
                "descOrigin": "VENREF",
                "position_en": "",
                "position_zh-TW": "",
                "venId": 108,
                "i18nField": "{\"position_zh-CN\": \"\"}",
                "manId": 0,
                "ttlAmt": 0.0,
                "position": "",
                "flowTypeId": 1355,
                "status": "Y",
                "weightUnit": "kg",
                "tDate": 1646323200000,
                "code": "ITVQU220324A",
                "cnDeptId": 0,
                "amt": 0.0,
                "iRev": 1,
                "upOrigin": "POLAST",
                "ce01Module": "vqu",
                "curId": 2,
                "expired": false,
                "rate": 0.8,
                "domAmt": 0.0,
                "measUnit": "cbm",
                "printCount": 0,
                "statusModifyDate": 1648095889000,
                "createDate": 1648095889000,
                "useAccessWl": false,
                "position_ccn": "",
                "ttlDisc": 0.0,
                "position_haha1": "",
                "useAccessAutoCalc": false,
                "staffId": 723,
                "domAmtDiff": 0.0
            }
        ],
        "remvqu": [
            {
                "tradeTerm_ccn": "",
                "country": "",
                "tradeTerm_zh-CN": "",
                "shipAd4_haha1": "",
                "remarks_en": "",
                "packing_ccn": "",
                "recipient_ccn": "",
                "tradeTerm": "",
                "shipAd2_zh-TW": "",
                "shipAd1_en": "",
                "payTerm_zh-TW": "",
                "province": "",
                "packing_haha1": "",
                "tel": "",
                "recipient_haha1": "",
                "id": 47,
                "fax": "",
                "remarks_zh-TW": "",
                "shipAd1_zh-CN": "",
                "hId": 47,
                "payTerm": "",
                "payTerm_ccn": "",
                "remarks_ccn": "",
                "tradeTerm_zh-TW": "",
                "shipAd4_ccn": "",
                "zipcode": "",
                "shipAd2_en": "",
                "shipAd1_haha1": "",
                "i18nField": "{\"packing_zh-CN\": \"\", \"payTerm_zh-CN\": \"\", \"remarks_zh-CN\": \"\", \"shipAd1_zh-CN\": \"\", \"shipAd2_zh-CN\": \"\", \"shipAd3_zh-CN\": \"\", \"shipAd4_zh-CN\": \"\", \"recipient_zh-CN\": \"\", \"tradeTerm_zh-CN\": \"\"}",
                "remarks_zh-CN": "",
                "shipAd4_ctw": "",
                "packing_en": "",
                "shipAd3_zh-TW": "",
                "payTerm_zh-CN": "",
                "payTerm_ctw": "",
                "remarks_ctw": "",
                "lTime": "",
                "shipAd1_ccn": "",
                "tradeTerm_en": "",
                "shipCodeId": 0,
                "city": "",
                "shipAd3_ctw": "",
                "recipient_zh-CN": "",
                "payTerm_en": "",
                "iRev": 1,
                "shipAd4_zh-TW": "",
                "packing": "",
                "shipAd2_ccn": "",
                "ce01Module": "vqu",
                "payTerm_haha1": "",
                "shipAd3_en": "",
                "recipient_en": "",
                "packing_zh-TW": "",
                "shipAd3_zh-CN": "",
                "shipAd4_zh-CN": "",
                "shipAd2_ctw": "",
                "shipAd2_haha1": "",
                "shipAd1_ctw": "",
                "remarks_haha1": "",
                "email": "",
                "shipAd3_ccn": "",
                "recipient_zh-TW": "",
                "packing_ctw": "",
                "recipient_ctw": "",
                "tradeTerm_ctw": "",
                "packing_zh-CN": "",
                "telCountry": "",
                "tradeTerm_haha1": "",
                "shipAd1": "",
                "shipAd2": "",
                "shipAd3": "",
                "shipAd4": "",
                "telArea": "",
                "shipAd1_zh-TW": "",
                "shipAd4_en": "",
                "recipient": "",
                "shipAd2_zh-CN": "",
                "shipAd3_haha1": "",
                "remarks": ""
            }
        ],
        "vqut": [
            {
                "sourceId": 0,
                "unit2Id": 24,
                "dualQty": 0.0,
                "qty2": 0.0,
                "itemNo": "     1",
                "qty1": 1.0,
                "beId": 11,
                "bDesc": "",
                "bDesc_zh-TW": "",
                "newLotno": 0,
                "id": 68,
                "up": 10.0,
                "ctn": 0,
                "dDesc_haha1": "",
                "height": 0.0,
                "hId": 47,
                "perCtn": 0.0,
                "freeQtyPer": 0.0,
                "volume": 0.0,
                "dDesc": "",
                "footerKey": "",
                "i18nField": "{\"bDesc_zh-CN\": \"\", \"dDesc_zh-CN\": \"\"}",
                "sourceType": "pro",
                "qty": 1.0,
                "disc": 0.0,
                "packingDesc": "",
                "refCode": "",
                "lotNoId": 0,
                "dDesc_ctw": "",
                "innerQty": 0.0,
                "unit1Id": 24,
                "costAmt": 0.0,
                "amt": 0.0,
                "nw": 0.0,
                "iRev": 1,
                "leadTime": 0,
                "dDesc_zh-CN": "",
                "packingUnitId": 0,
                "bDesc_ctw": "",
                "ce01Module": "vqu",
                "lot": "A",
                "bDesc_haha1": "",
                "dDesc_zh-TW": "",
                "domAmt": 0.0,
                "bDesc_ccn": "",
                "unitId": 24,
                "innerUnitId": 0,
                "dDesc_ccn": "",
                "locId": 0,
                "bDesc_en": "",
                "sourceCliId": 0,
                "length": 0.0,
                "dDesc_en": "",
                "dualUnitId": 6,
                "gw": 0.0,
                "sourceLot": "",
                "proId": 18,
                "width": 0.0,
                "bDesc_zh-CN": ""
            }
        ]
    },
    "messages": [],
    "status": true
}

# Create Purchase Quotation

# 一、Description

​ Usage: create or update 【Purchase Quotation】

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/root/api/save/vqu
HTTP Method PUT
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
menuCode String(Query) Yes vqu
param String(Query) No Extra Pamameters: in JSON format

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/root/api/save/vqu";
		String param = "&menuCode=vqu";

		HttpPut put = new HttpPut(url + "?" + param);
		put.addHeader("authorization", access_token);
		put.addHeader("client_id", ClientID);

		StringEntity entity = new StringEntity(data.toJSONString(), ContentType.APPLICATION_JSON);
		entity.setContentEncoding("UTF-8");
		put.setEntity(entity);

		res = client.execute(put);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

			if (json != null) {
				recordId = json.getLongValue("recordId");
			}

			System.out.println(json);
		}

		put.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

Entity data as JSON format:

{
    "mainvqu": {
        "values": [
            {
                "beId": 11,
                "code": "ITVQU220324A",
                "tDate": "2022-03-04",
                "venId": 108,
                "curId": 2,
                "rate": 0.8,
                "flowTypeId": 1355,
                "staffId": 723
            }
        ]
    },
    "vqut": {
        "values": [
            {
                "sourceType": "pro",
                "proId": 18,
                "unitId": 24,
                "qty": 1,
                "up": 10
            }
        ]
    }
}

​ 4、Response Sample

{
	"recordId": 47,
	"messages": [],
	"status": true
}
{
    "recordId": 0,
    "messages": [
        {
            "msgDetail": "Required field is empty",
            "msgCode": "core_101905"
        }
    ],
    "status": false
}

# Create Purchase Quotation (Auto Completion)

# 一、Description

​ 1. Usage: Create 【Purchase Quotation】

​ 2. This API has the following characteristics:

​ ​ a. Support using code instead of id field

​ ​ b. If field currency has no value specified, the Entity Currency will be used automatically

​ c. If field staff has no value specified, the default staff in the User Options will be used automatically

​ d. If field document date has no value specified, the value is obtained according to the date option in the [Preference Setup (Trade)]

​ ​ e. If field business process has no value specified, according to the default value set in [Business Process Setup (Trade)]

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/erp/bsFlow/save/vqu
HTTP Method POST
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/erp/bsFlow/save/vqu";

		HttpPost post = new HttpPost(url);
		post.addHeader("authorization", access_token);
		post.addHeader("client_id", ClientID);

		StringEntity entity = new StringEntity(data.toJSONString(), ContentType.APPLICATION_JSON);
		entity.setContentEncoding("UTF-8");
		post.setEntity(entity);

		res = client.execute(post);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

			if (json != null) {
				recordId = json.getLongValue("tranId");
			}
			System.out.println(json);
		}

		post.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

Sample data

{
    "beCode": "IT",
    "venCode": "2000C-014",
    "vqut": [
        {
            "proCode": "ITPRO001",
            "unitCode": "个",
            "qty": 1,
            "up": 10
        }
    ]
}

​ 4、Response Sample

{
  "tranId": 48,
  "tranCode": "PQ22030004",
  "message": "",
  "status": true
}

# Delete Purchase Quotation

# 一、Description

​ Usage: Delete Purchase Quotation

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/root/api/delete/vqu
HTTP Method DELETE
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
menuCode String(Query) Yes vqu
id long(Query) Yes Purchase Quotation ID
param String(Query) No Extra Pamameters: in JSON format

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/root/api/delete/vqu";
		String param = "&menuCode=vqu&id=" + id;

		HttpDelete delete = new HttpDelete(url + "?" + param);
		delete.addHeader("authorization", access_token);
		delete.addHeader("client_id", ClientID);

		res = client.execute(delete);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

			System.out.println(json);
		}

		delete.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

​ 4、Response Sample

{
	"messages": [],
	"status": true
}
{
    "messages": [
        {
            "msgDetail": "Record has been deleted",
            "msgCode": "core_101017"
        }
    ],
    "status": false
}

# Load EBI data:Purchase Quotation List

# 一、Description

​ Usage: Run EBI[Purchase Quotation List],return EBI data

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/ebiWidget/loadReport
HTTP Method GET
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
formatId long(Query) Yes Format ID fetched from another API
beId long(Query) No Business Entity ID,If not specified, query all authorized Business Entity data.
offset int(Query) No Resultset offset : start index
rows int(Query) No Resultset offset : end index

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/ebiWidget/loadReport";
		String param = "&formatId=" + formatId;

		HttpGet get = new HttpGet(url + "?" + param);
		get.addHeader("authorization", access_token);
		get.addHeader("client_id", ClientID);
		res = client.execute(get);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

			System.out.println(json);
		}

		get.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}				

​ 4、Response Sample

{
    "size": 5,
    "rows": [
        {
            "M_A_code": "ITVQU002",
            "M_A_ttlAmt": "0.00",
            "M_A_id": "21",
            "M_A_rate": "1.00000000",
            "M18ReservedCol_dataIndex": 1,
            "VEN_A_code": "V0001",
            "VEN_A_desc__lang": "Test Vendor",
            "STAFF_A_id": "3",
            "M_A_curId_desc__lang": "¥",
            "M_A_tDate": "2019.01.09",
            "STAFF_A_code": "IT001",
            "VEN_A_id": "1"
        }
  	]
}

ebi1

# Load EBI data:Purchase Quotation Report

# 一、Description

​ Usage: Run EBI[Purchase Quotation Report],return EBI data

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/ebiWidget/loadReport
HTTP Method GET
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
formatId long(Query) Yes Format ID fetched from another API
beId long(Query) No Business Entity ID,If not specified, query all authorized Business Entity data.
offset int(Query) No Resultset offset : start index
rows int(Query) No Resultset offset : end index

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/ebiWidget/loadReport";
		String param = "&formatId=" + formatId;

		HttpGet get = new HttpGet(url + "?" + param);
		get.addHeader("authorization", access_token);
		get.addHeader("client_id", ClientID);
		res = client.execute(get);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

			System.out.println(json);
		}

		get.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}				

​ 4、Response Sample

{
  "size": 4,
    "rows": [
        {
            "M_A_code": "ITVQU19100001",
            "M_A_id": "24",
            "M18ReservedCol_dataIndex": 1,
            "F_A_unitId_code": "个",
            "M_A_tDate": "2019.10.15",
            "PRO_A_code": "ITPRO001",
            "PRO_A_id": "18",
            "F_A_qty": "10.0000",
            "F_A_up": "44.0000"
        }
  	]
}

ebi2

# Purchase Order

# Fetch Purchase Order List

# 一、Description

​ Usage: Fetch Purchase Order List.

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/search/search
HTTP Method GET
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
stSearch String(Query) Yes po
beId long(Query) Yes Business Entity ID
formatId long(Query) No Lookup Query ID, If not specified, the default format is used.
startRow int(Query) No Resultset offset : start index
endRow int(Query) No Resultset offset : end index
quickSearchStr String(Query) No Quick search keyword

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/search/search";
		String param = "&stSearch=po&beId=11";

		HttpGet get = new HttpGet(url + "?" + param);
		get.addHeader("authorization", access_token);
		get.addHeader("client_id", ClientID);
		res = client.execute(get);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));
		}
		get.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

​ 4、Response Sample

{
  	"stSearch": "po",
    "size": 26,
    "stSearchDisplay": "Purchase Order",
    "values": [
        {
            "code": "ITPO220324A",
            "tDate": "2022-03-24",
            "mainpo.venId.ven.code": "2000C-014",
            "mainpo.venId.ven.desc__lang": "Choi Hop Hong Co., Ltd",
            "mainpo.curId.cur.sym": "¥",
            "mainpo.flowTypeId.flowtype.code": "PURCHASE",
            "mainpo.flowTypeId.flowtype.desc": "Purchase Flow",
            "iRev": 1,
            "lastModifyDate": "2022-03-24 15:40:46",
            "mainpo.lastModifyUid.simpleUser.desc__lang": "Ivan Tan",
            "id": 10661,
            "st_desc": "ITPO220324A",
            "st_id": 10661,
            "st_code": "ITPO220324A"
        }
  	]
}

# Load Purchase Order

# 一、Description

​ Usage: Load 【Purchase Order】Record

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/root/api/read/po
HTTP Method GET
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
menuCode String(Query) Yes po
id long(Query) Yes Purchase Order ID
param String(Query) No Extra Pamameters: in JSON format

​ 3、Request Sample

		CloseableHttpClient client = HttpClientBuilder.create().build();
		CloseableHttpResponse res = null;
		try {

			String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/root/api/read/po";
			String param = "&menuCode=po&id=" + id;

			HttpGet get = new HttpGet(url + "?" + param);
			get.addHeader("authorization", access_token);
			get.addHeader("client_id", ClientID);
			res = client.execute(get);
			if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
				JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

				System.out.println(json);
			}

			get.releaseConnection();
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			try {
				if (res != null) {
					res.close();
				}
				if (client != null) {
					client.close();
				}
			} catch (Exception ex) {
				ex.printStackTrace();
			}
		}

​ 4、Response Sample

{
    "data": {
        "mainpo": [
            {
                "lastModifyUid": 11,
                "useAccess": false,
                "virDeptId": 0,
                "expiredDate": -2209017600000,
                "invShipedStatus": 0,
                "position_zh-CN": "",
                "sysJson": "",
                "viewCode": "po",
                "beId": 11,
                "dDate": 1648051200000,
                "shipedStatus": 0,
                "useAccessBl": false,
                "id": 10661,
                "doctypeId": 0,
                "locked": false,
                "position_ctw": "",
                "lastModifyDate": 1648107646000,
                "createUid": 11,
                "rev": "1",
                "lastApproveUid": 11,
                "ttlCharge": 0,
                "completed": false,
                "expiredUid": 0,
                "freeQtyPer": 0,
                "descOrigin": "VENREF",
                "position_en": "",
                "position_zh-TW": "",
                "venId": 108,
                "i18nField": "{\"position_zh-CN\": \"\"}",
                "manId": 0,
                "deposit": 0,
                "ttlAmt": 0,
                "multiFlowSrcId": 0,
                "position": "",
                "flowTypeId": 1356,
                "status": "Y",
                "weightUnit": "kg",
                "multiFlowFlowId": 0,
                "tDate": 1648051200000,
                "code": "ITPO220324A",
                "cnDeptId": 0,
                "multiFlowSrcModule": "",
                "amt": 0,
                "iRev": 1,
                "upOrigin": "POLAST",
                "ce01Module": "po",
                "curId": 1,
                "expired": false,
                "rate": 1,
                "domAmt": 0,
                "sumMethod": "no",
                "settlementStatus": 0,
                "measUnit": "cbm",
                "printCount": 0,
                "udfsm3": "",
                "statusModifyDate": 1648107646000,
                "createDate": 1648107646000,
                "shipedASIStatus": 0,
                "depoRate": 0,
                "loadGpCoData": false,
                "cp": 0,
                "useAccessWl": false,
                "billingStatus": 0,
                "position_ccn": "",
                "ttlDisc": 0,
                "multiFlowSrcBeId": 0,
                "position_haha1": "",
                "depositStatus": 0,
                "useAccessAutoCalc": false,
                "staffId": 723,
                "domAmtDiff": 0
            }
        ],
        "pot": [
            {
                "sourceId": 0,
                "unit2Id": 40,
                "shipMark": "",
                "dualQty": 0,
                "prqFooterKey": "",
                "qty2": 0,
                "itemNo": "     1",
                "prqSourceId": 0,
                "qty1": 1,
                "beId": 11,
                "dDate": 1648051200000,
                "bDesc": "",
                "bDesc_zh-TW": "",
                "newLotno": 0,
                "id": 11525,
                "up": 10,
                "ctn": 0,
                "qcRequired": false,
                "dDesc_haha1": "",
                "height": 0,
                "hId": 10661,
                "perCtn": 0,
                "prqResultId": 0,
                "completed": false,
                "freeQtyPer": 0,
                "volume": 0,
                "dDesc": "",
                "footerKey": "",
                "i18nField": "{\"bDesc_zh-CN\": \"\", \"dDesc_zh-CN\": \"\"}",
                "sourceType": "pro",
                "qty": 1,
                "disc": 0,
                "packingDesc": "",
                "refCode": "",
                "lotNoId": 0,
                "dDesc_ctw": "",
                "innerQty": 0,
                "unit1Id": 40,
                "costAmt": 0,
                "pproId": 26,
                "amt": 0,
                "nw": 0,
                "iRev": 1,
                "dDesc_zh-CN": "",
                "qup": 0,
                "packingUnitId": 0,
                "udfsm": 0,
                "bDesc_ctw": "",
                "ce01Module": "po",
                "lot": "A",
                "bDesc_haha1": "",
                "dDesc_zh-TW": "",
                "domAmt": 0,
                "bDesc_ccn": "",
                "unitId": 40,
                "innerUnitId": 0,
                "udfsm2": "",
                "dDesc_ccn": "",
                "locId": 0,
                "bDesc_en": "",
                "sourceCliId": 0,
                "length": 0,
                "dDesc_en": "",
                "dualUnitId": 29,
                "gw": 0,
                "prqSourceType": "pro",
                "sourceLot": "",
                "prqSourceLot": "",
                "proId": 26,
                "width": 0,
                "cuspono": "",
                "bDesc_zh-CN": ""
            }
        ],
        "rempo": [
            {
                "tradeTerm_ccn": "",
                "country": "",
                "shipMark": "",
                "heading_en": "",
                "shipMark_zh-CN": "",
                "tradeTerm_zh-CN": "",
                "shipAd4_haha1": "",
                "remarks_en": "",
                "packing_ccn": "",
                "dest": "",
                "recipient_ccn": "",
                "tradeTerm": "",
                "shipAd2_zh-TW": "",
                "heading_ccn": "",
                "shipAd1_en": "",
                "payTerm_zh-TW": "",
                "province": "",
                "packing_haha1": "",
                "tel": "",
                "shipMark_en": "",
                "recipient_haha1": "",
                "id": 10564,
                "fax": "",
                "remarks_zh-TW": "",
                "shipAd1_zh-CN": "",
                "hId": 10661,
                "payTerm": "",
                "heading_zh-TW": "",
                "payTerm_ccn": "",
                "remarks_ccn": "",
                "heading_ctw": "",
                "tradeTerm_zh-TW": "",
                "shipMark_ccn": "",
                "shipAd4_ccn": "",
                "zipcode": "",
                "shipAd2_en": "",
                "shipAd1_haha1": "",
                "i18nField": "{\"heading_zh-CN\": \"\", \"packing_zh-CN\": \"\", \"payTerm_zh-CN\": \"\", \"remarks_zh-CN\": \"\", \"shipAd1_zh-CN\": \"\", \"shipAd2_zh-CN\": \"\", \"shipAd3_zh-CN\": \"\", \"shipAd4_zh-CN\": \"\", \"shipMark_zh-CN\": \"\", \"recipient_zh-CN\": \"\", \"tradeTerm_zh-CN\": \"\"}",
                "remarks_zh-CN": "",
                "shipAd4_ctw": "",
                "packing_en": "",
                "shipAd3_zh-TW": "",
                "payTerm_zh-CN": "",
                "payTerm_ctw": "",
                "shipMark_zh-TW": "",
                "remarks_ctw": "",
                "shipAd1_ccn": "",
                "tradeTerm_en": "",
                "shipCodeId": 0,
                "city": "",
                "shipMark_ctw": "",
                "shipAd3_ctw": "",
                "recipient_zh-CN": "",
                "payTerm_en": "",
                "iRev": 1,
                "shipAd4_zh-TW": "",
                "packing": "",
                "shipAd2_ccn": "",
                "heading_zh-CN": "",
                "ce01Module": "po",
                "payTerm_haha1": "",
                "shipAd3_en": "",
                "recipient_en": "",
                "packing_zh-TW": "",
                "shipAd3_zh-CN": "",
                "shipAd4_zh-CN": "",
                "shipAd2_ctw": "",
                "shipAd2_haha1": "",
                "shipAd1_ctw": "",
                "remarks_haha1": "",
                "email": "",
                "shipAd3_ccn": "",
                "recipient_zh-TW": "",
                "packing_ctw": "",
                "heading_haha1": "",
                "heading": "",
                "recipient_ctw": "",
                "tradeTerm_ctw": "",
                "packing_zh-CN": "",
                "telCountry": "",
                "tradeTerm_haha1": "",
                "shipAd1": "",
                "shipAd2": "",
                "shipAd3": "",
                "shipAd4": "",
                "telArea": "",
                "shipAd1_zh-TW": "",
                "shipAd4_en": "",
                "recipient": "",
                "shipAd2_zh-CN": "",
                "shipAd3_haha1": "",
                "shipMark_haha1": "",
                "smthId": 0,
                "remarks": ""
            }
        ]
    },
    "messages": [],
    "status": true
}

# Create Purchase Order

# 一、Description

​ Usage: create or update 【Purchase Order】

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/root/api/save/po
HTTP Method PUT
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
menuCode String(Query) Yes po
param String(Query) No Extra Pamameters: in JSON format

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/root/api/save/po";
		String param = "&menuCode=po";

		HttpPut put = new HttpPut(url + "?" + param);
		put.addHeader("authorization", access_token);
		put.addHeader("client_id", ClientID);

		StringEntity entity = new StringEntity(data.toJSONString(), ContentType.APPLICATION_JSON);
		entity.setContentEncoding("UTF-8");
		put.setEntity(entity);

		res = client.execute(put);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

			if (json != null) {
				recordId = json.getLongValue("recordId");
			}

			System.out.println(json);
		}

		put.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

Entity data as JSON format:

{
    "mainpo": {
        "values": [
            {
                "beId": 11,
                "code": "ITPO220324A",
                "tDate": "2022-03-24",
                "venId": 108,
                "curId": 1,
                "rate": 1,
                "flowTypeId": 1356,
                "staffId": 723
            }
        ]
    },
    "pot": {
        "values": [
            {
                "sourceType": "pro",
                "proId": 26,
                "unitId": 40,
                "qty": 1,
                "up": 10
            }
        ]
    }
}

​ 4、Response Sample

{
	"recordId": 10661,
	"messages": [],
	"status": true
}
{
    "recordId": 0,
    "messages": [
        {
            "msgDetail": "Required field is empty",
            "msgCode": "core_101905"
        }
    ],
    "status": false
}

# Create Purchase Order (Auto Completion)

# 一、Description

​ 1. Usage: Create 【Purchase Order】

​ 2. This API has the following characteristics:

​ ​ a. Support using code instead of id field

​ ​ b. If field currency has no value specified, the Entity Currency will be used automatically

​ ​ c. If field staff has no value specified, the default staff in the User Options will be used automatically

​ ​ d. If field document date has no value specified, the value is obtained according to the date option in the [Preference Setup (Trade)]

​ ​ e. If field business process has no value specified, according to the default value set in [Business Process Setup (Trade)]

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/erp/bsFlow/save/po
HTTP Method POST
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/erp/bsFlow/save/po";

		HttpPost post = new HttpPost(url);
		post.addHeader("authorization", access_token);
		post.addHeader("client_id", ClientID);

		StringEntity entity = new StringEntity(data.toJSONString(), ContentType.APPLICATION_JSON);
		entity.setContentEncoding("UTF-8");
		post.setEntity(entity);

		res = client.execute(post);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

			if (json != null) {
				recordId = json.getLongValue("tranId");
			}
			System.out.println(json);
		}

		post.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

Sample data

{
    "beCode": "IT",
    "venCode": "VIT001",
    "pot": [
        {
            "proCode": "ITPRO002",
            "unitCode": "PCS",
            "qty": 1,
            "up": 10,
            "amt": 10
        }
    ]
}

​ 4、Response Sample

{
  "tranId": 10662,
  "tranCode": "PO2203010064",
  "message": "",
  "status": true
}

# Delete Purchase Order

# 一、Description

​ Usage: Delete Purchase Order

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/root/api/delete/po
HTTP Method DELETE
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
menuCode String(Query) Yes po
id long(Query) Yes Purchase Order ID
param String(Query) No Extra Pamameters: in JSON format

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/root/api/delete/po";
		String param = "&menuCode=po&id=" + id;

		HttpDelete delete = new HttpDelete(url + "?" + param);
		delete.addHeader("authorization", access_token);
		delete.addHeader("client_id", ClientID);

		res = client.execute(delete);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

			System.out.println(json);
		}

		delete.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

​ 4、Response Sample

{
	"messages": [],
	"status": true
}
{
    "messages": [
        {
            "msgDetail": "Record has been deleted",
            "msgCode": "core_101017"
        }
    ],
    "status": false
}

# Load EBI data:Purchase Order List

# 一、Description

​ Usage: Run EBI[Purchase Order List],return EBI data

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/ebiWidget/loadReport
HTTP Method GET
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
formatId long(Query) Yes Format ID fetched from another API
beId long(Query) No Business Entity ID,If not specified, query all authorized Business Entity data.
offset int(Query) No Resultset offset : start index
rows int(Query) No Resultset offset : end index

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/ebiWidget/loadReport";
		String param = "&formatId=" + formatId;

		HttpGet get = new HttpGet(url + "?" + param);
		get.addHeader("authorization", access_token);
		get.addHeader("client_id", ClientID);
		res = client.execute(get);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

			System.out.println(json);
		}

		get.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}				

​ 4、Response Sample

{
    "size": 26,
    "rows": [
        {
            "PO_A_dDate": "2016.08.22",
            "PO_A_curId": "1",
            "PO_A_id": "2",
            "M18ReservedCol_dataIndex": 1,
            "PO_A_ttlCharge": "0.00",
            "PO_A_code": "ITPO16080001",
            "PO_A_curId_code": "R",
            "PO_A_amt": "4,350.00",
            "PO_A_ttlAmt": "4,350.00",
            "PO_A_tDate": "2016.08.15",
            "PO_A_rate": "1.00000000",
            "VEN_A_code": "V0001",
            "PO_A_ttlDisc": "0.00",
            "VEN_A_id": "1"
        }
    ]
}

ebi1

# Load EBI data:Purchase Order Report

# 一、Description

​ Usage: Run EBI[Purchase Order Report],return EBI data

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/ebiWidget/loadReport
HTTP Method GET
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
formatId long(Query) Yes Format ID fetched from another API
beId long(Query) No Business Entity ID,If not specified, query all authorized Business Entity data.
offset int(Query) No Resultset offset : start index
rows int(Query) No Resultset offset : end index

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/ebiWidget/loadReport";
		String param = "&formatId=" + formatId;

		HttpGet get = new HttpGet(url + "?" + param);
		get.addHeader("authorization", access_token);
		get.addHeader("client_id", ClientID);
		res = client.execute(get);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

			System.out.println(json);
		}

		get.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}				

​ 4、Response Sample

{
    "size": 46,
    "rows": [
        {
            "PO_A_dDate": "2016.08.22",
            "PO_A_tDate": "2016.08.15",
            "PO_A_id": "2",
            "M18ReservedCol_dataIndex": 1,
            "VEN_A_code": "V0001",
            "POT_A_qty": "10.0000",
            "PO_A_code": "ITPO16080001",
            "POT_A_unitId_code": "个",
            "PRO_A_code": "COMPUTER_01",
            "PRO_A_id": "3",
            "VEN_A_id": "1"
        }
    ]
}

ebi2

# Vendor Shipment Note

# Fetch Vendor Shipment Note List

# 一、Description

​ Usage: Fetch Vendor Shipment Note List.

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/search/search
HTTP Method GET
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
stSearch String(Query) Yes asi
beId long(Query) Yes Business Entity ID
formatId long(Query) No Lookup Query ID, If not specified, the default format is used.
startRow int(Query) No Resultset offset : start index
endRow int(Query) No Resultset offset : end index
quickSearchStr String(Query) No Quick search keyword

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/search/search";
		String param = "&stSearch=asi&beId=11";

		HttpGet get = new HttpGet(url + "?" + param);
		get.addHeader("authorization", access_token);
		get.addHeader("client_id", ClientID);
		res = client.execute(get);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));
		}
		get.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

​ 4、Response Sample

{
  	"stSearch": "asi",
    "size": 10,
    "stSearchDisplay": "Vendor Shipment Note",
    "values": [
        {
            "code": "ITVSN220330A",
            "tDate": "2022-03-30",
            "mainasi.flowTypeId.flowtype.code": "PURCHASE",
            "mainasi.flowTypeId.flowtype.desc": "Purchase Flow",
            "iRev": 1,
            "lastModifyDate": "2022-03-30 12:59:52",
            "mainasi.lastModifyUid.simpleUser.desc__lang": "Ivan Tan",
            "id": 51,
            "st_desc": "ITVSN220330A",
            "st_id": 51,
            "st_code": "ITVSN220330A"
        }
  	]
}

# Load Vendor Shipment Note

# 一、Description

​ Usage: Load 【Vendor Shipment Note】Record

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/root/api/read/asi
HTTP Method GET
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
menuCode String(Query) Yes asi
id long(Query) Yes Vendor Shipment Note ID
param String(Query) No Extra Pamameters: in JSON format

​ 3、Request Sample

		CloseableHttpClient client = HttpClientBuilder.create().build();
		CloseableHttpResponse res = null;
		try {

			String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/root/api/read/asi";
			String param = "&menuCode=asi&id=" + id;

			HttpGet get = new HttpGet(url + "?" + param);
			get.addHeader("authorization", access_token);
			get.addHeader("client_id", ClientID);
			res = client.execute(get);
			if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
				JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

				System.out.println(json);
			}

			get.releaseConnection();
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			try {
				if (res != null) {
					res.close();
				}
				if (client != null) {
					client.close();
				}
			} catch (Exception ex) {
				ex.printStackTrace();
			}
		}

​ 4、Response Sample

{
    "data": {
        "asit": [
            {
                "lotnoNumAttr17": 0,
                "lotnoNumAttr16": 0,
                "unit2Id": 40,
                "lotnoNumAttr15": 0,
                "lotnoNumAttr14": 0,
                "lotnoNumAttr19": 0,
                "lotnoNumAttr18": 0,
                "qty2": 0,
                "lotnoLookupAttr20": 0,
                "lotnoNumAttr13": 0,
                "lotnoNumAttr12": 0,
                "qty1": -5,
                "lotnoNumAttr11": 0,
                "lotnoNumAttr10": 0,
                "lotnoLookupAttr16": 0,
                "lotnoLookupAttr17": 0,
                "lotnoLookupAttr14": 0,
                "lotnoLookupAttr15": 0,
                "lotnoLookupAttr18": 0,
                "lotnoLookupAttr19": 0,
                "bDesc_zh-TW": "",
                "id": 75,
                "ctn": 0,
                "dDesc_haha1": "",
                "height": 30,
                "perCtn": 20,
                "lotnoNumAttr20": 0,
                "completed": false,
                "lotnoLookupAttr12": 0,
                "lotnoLookupAttr13": 0,
                "lotnoLookupAttr10": 0,
                "freeQtyPer": 0,
                "lotnoLookupAttr11": 0,
                "i18nField": "{\"bDesc_zh-CN\": \"Lot no. can be duplicated\", \"dDesc_zh-CN\": \"\"}",
                "sourceType": "pro",
                "packingDesc": "",
                "innerQty": 0,
                "iRev": 1,
                "poId": 0,
                "bDesc_ctw": "",
                "ce01Module": "asi",
                "lot": "A",
                "lotnoDateAttr3": -2209017600000,
                "lotnoDateAttr4": -2209017600000,
                "lotnoDateAttr1": -2209017600000,
                "lotnoDateAttr2": -2209017600000,
                "lotnoDateAttr7": -2209017600000,
                "lotnoDateAttr8": -2209017600000,
                "lotnoDateAttr5": -2209017600000,
                "bDesc_ccn": "",
                "lotnoDateAttr6": -2209017600000,
                "unitId": 40,
                "lotnoDateAttr9": -2209017600000,
                "bDesc_en": "",
                "lotnoTextAttr1": "",
                "lotnoTextAttr2": "",
                "lotnoTextAttr3": "",
                "lotnoTextAttr4": "",
                "lotnoTextAttr5": "",
                "lotnoTextAttr6": "",
                "lotnoTextAttr7": "",
                "width": 38,
                "lotnoTextAttr8": "",
                "lotnoTextAttr9": "",
                "bDesc_zh-CN": "Lot no. can be duplicated",
                "sourceId": 0,
                "dualQty": -5,
                "itemNo": "     1",
                "poLot": "",
                "beId": 11,
                "bDesc": "Lot no. can be duplicated",
                "up": 6,
                "qcRequired": false,
                "hId": 51,
                "lotnoNumAttr1": 0,
                "lotnoNumAttr2": 0,
                "lotnoNumAttr3": 0,
                "lotnoNumAttr4": 0,
                "volume": 0.066,
                "lotnoExpDate": 253402185600000,
                "dDesc": "",
                "qty": -5,
                "lotnoNumAttr5": 0,
                "lotnoNumAttr6": 0,
                "lotnoNumAttr7": 0,
                "disc": 0,
                "lotnoNumAttr8": 0,
                "lotnoNumAttr9": 0,
                "refCode": "",
                "lotnoTextAttr16": "",
                "lotnoTextAttr15": "",
                "dDesc_ctw": "",
                "lotnoTextAttr18": "",
                "unit1Id": 40,
                "lotnoTextAttr17": "",
                "lotnoTextAttr12": "",
                "lotnoTextAttr11": "",
                "lotnoDateAttr20": -2209017600000,
                "lotnoTextAttr14": "",
                "lotnoTextAttr13": "",
                "nw": 0.135,
                "amt": -30,
                "dDesc_zh-CN": "",
                "lotnoTextAttr19": "",
                "packingUnitId": 3,
                "bDesc_haha1": "",
                "dDesc_zh-TW": "",
                "domAmt": -30,
                "innerUnitId": 3,
                "dDesc_ccn": "",
                "lotnoTextAttr10": "",
                "length": 58,
                "dDesc_en": "",
                "dualUnitId": 29,
                "gw": 0.135,
                "lotnoLookupAttr5": 0,
                "lotnoLookupAttr6": 0,
                "sourceLot": "",
                "lotnoDateAttr18": -2209017600000,
                "lotnoLookupAttr7": 0,
                "lotnoDateAttr19": -2209017600000,
                "lotnoLookupAttr8": 0,
                "lotno": "",
                "lotnoLookupAttr9": 0,
                "proId": 26,
                "lotnoDateAttr12": -2209017600000,
                "lotnoDateAttr13": -2209017600000,
                "lotnoDateAttr10": -2209017600000,
                "lotnoTextAttr20": "",
                "lotnoDateAttr11": -2209017600000,
                "lotnoDateAttr16": -2209017600000,
                "lotnoLookupAttr1": 0,
                "lotnoDateAttr17": -2209017600000,
                "lotnoLookupAttr2": 0,
                "lotnoDateAttr14": -2209017600000,
                "lotnoLookupAttr3": 0,
                "lotnoDateAttr15": -2209017600000,
                "lotnoLookupAttr4": 0
            }
        ],
        "mainasi": [
            {
                "lastModifyUid": 11,
                "useAccess": false,
                "virDeptId": 0,
                "expiredDate": -2209017600000,
                "invShipedStatus": 0,
                "position_zh-CN": "",
                "sysJson": "",
                "viewCode": "asi",
                "venDnNo": "",
                "beId": 11,
                "shipedStatus": 20,
                "useAccessBl": false,
                "id": 51,
                "doctypeId": 0,
                "locked": false,
                "position_ctw": "",
                "lastModifyDate": 1648616392000,
                "createUid": 11,
                "rev": "1",
                "lastApproveUid": 11,
                "ttlCharge": 0,
                "completed": false,
                "expiredUid": 0,
                "freeQtyPer": 0,
                "descOrigin": "VENREF",
                "position_en": "",
                "position_zh-TW": "",
                "i18nField": "{\"position_zh-CN\": \"\"}",
                "manId": 0,
                "ttlAmt": -30,
                "multiFlowSrcId": 0,
                "position": "",
                "flowTypeId": 1356,
                "status": "Y",
                "weightUnit": "kg",
                "multiFlowFlowId": 0,
                "tDate": 1648569600000,
                "code": "ITVSN220330A",
                "cnDeptId": 0,
                "multiFlowSrcModule": "",
                "amt": -30,
                "iRev": 1,
                "upOrigin": "POLAST",
                "ce01Module": "asi",
                "curId": 1,
                "expired": false,
                "asnRefId": 592,
                "rate": 1,
                "domAmt": -30,
                "measUnit": "cbm",
                "printCount": 0,
                "statusModifyDate": 1648616392000,
                "createDate": 1648616392000,
                "asnRefType": "ven",
                "useAccessWl": false,
                "position_ccn": "",
                "ttlDisc": 0,
                "multiFlowSrcBeId": 0,
                "position_haha1": "",
                "useAccessAutoCalc": false,
                "staffId": 723,
                "domAmtDiff": 0
            }
        ],
        "remasi": [
            {
                "tradeTerm_ccn": "",
                "tradeTerm_en": "",
                "shipMark": "",
                "heading_en": "",
                "shipMark_zh-CN": "",
                "tradeTerm_zh-CN": "",
                "shipMark_ctw": "",
                "remarks_en": "",
                "payTerm_en": "",
                "iRev": 1,
                "packing_ccn": "",
                "packing": "",
                "heading_zh-CN": "",
                "ce01Module": "asi",
                "tradeTerm": "",
                "heading_ccn": "",
                "payTerm_haha1": "",
                "packing_zh-TW": "",
                "payTerm_zh-TW": "",
                "packing_haha1": "",
                "remarks_haha1": "",
                "shipMark_en": "",
                "id": 40,
                "remarks_zh-TW": "",
                "hId": 51,
                "packing_ctw": "",
                "heading_haha1": "",
                "payTerm": "",
                "heading_zh-TW": "",
                "payTerm_ccn": "",
                "heading": "",
                "remarks_ccn": "",
                "heading_ctw": "",
                "tradeTerm_ctw": "",
                "packing_zh-CN": "",
                "tradeTerm_zh-TW": "",
                "shipMark_ccn": "",
                "tradeTerm_haha1": "",
                "i18nField": "{\"heading_zh-CN\": \"\", \"packing_zh-CN\": \"\", \"payTerm_zh-CN\": \"\", \"remarks_zh-CN\": \"\", \"shipMark_zh-CN\": \"\", \"tradeTerm_zh-CN\": \"\"}",
                "remarks_zh-CN": "",
                "packing_en": "",
                "shipMark_haha1": "",
                "payTerm_zh-CN": "",
                "payTerm_ctw": "",
                "shipMark_zh-TW": "",
                "remarks": "",
                "remarks_ctw": ""
            }
        ]
    },
    "messages": [],
    "status": true
}

# Create Vendor Shipment Note

# 一、Description

​ Usage: create or update 【Vendor Shipment Note】

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/root/api/save/asi
HTTP Method PUT
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
menuCode String(Query) Yes asi
param String(Query) No Extra Pamameters: in JSON format

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/root/api/save/asi";
		String param = "&menuCode=asi";

		HttpPut put = new HttpPut(url + "?" + param);
		put.addHeader("authorization", access_token);
		put.addHeader("client_id", ClientID);

		StringEntity entity = new StringEntity(data.toJSONString(), ContentType.APPLICATION_JSON);
		entity.setContentEncoding("UTF-8");
		put.setEntity(entity);

		res = client.execute(put);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

			if (json != null) {
				recordId = json.getLongValue("recordId");
			}

			System.out.println(json);
		}

		put.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}				

Entity data as JSON format:

{
    "mainasi": {
        "values": [
            {
                "beId": 11,
                "code": "ITVSN220324A",
                "tDate": "2022-03-24",
                "asnRefId": 592,
                "curId": 1,
                "rate": 1,
                "flowTypeId": 1356,
                "staffId": 723
            }
        ]
    },
    "asit": {
        "values": [
            {
                "sourceType": "pro",
                "proId": 26,
                "unitId": 40,
                "qty": 1,
                "up": 10,
                "amt": 10
            }
        ]
    }
}

​ 4、Response Sample

{
	"recordId": 49,
	"messages": [],
	"status": true
}
{
    "recordId": 0,
    "messages": [
        {
            "msgDetail": "Required field is empty",
            "msgCode": "core_101905"
        }
    ],
    "status": false
}

# Create Vendor Shipment Note (Auto Completion)

# 一、Description

​ 1. Usage: Create 【Vendor Shipment Note】

​ 2. This API has the following characteristics:

​ ​ a. Support using code instead of id field

​ ​ b. If field currency has no value specified, the Entity Currency will be used automatically

​ ​ c. If field staff has no value specified, the default staff in the User Options will be used automatically

​ ​ d. If field document date has no value specified, the value is obtained according to the date option in the [Preference Setup (Trade)]

​ ​ e. If field business process has no value specified, according to the default value set in [Business Process Setup (Trade)]

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/erp/bsFlow/save/asi
HTTP Method POST
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/erp/bsFlow/save/asi";

		HttpPost post = new HttpPost(url);
		post.addHeader("authorization", access_token);
		post.addHeader("client_id", ClientID);

		StringEntity entity = new StringEntity(data.toJSONString(), ContentType.APPLICATION_JSON);
		entity.setContentEncoding("UTF-8");
		post.setEntity(entity);

		res = client.execute(post);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

			if (json != null) {
				recordId = json.getLongValue("tranId");
			}
			System.out.println(json);
		}

		post.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

Sample data

{
    "beCode": "IT",
    "asnRefCode": "VIT001",
    "asit": [
        {
            "proCode": "ITPRO002",
            "unitCode": "PCS",
            "qty": 1,
            "up": 10,
            "amt": 10
        }
    ]
}

​ 4、Response Sample

{
  "tranId": 50,
  "tranCode": "ASI220002",
  "message": "",
  "status": true
}

# Delete Vendor Shipment Note

# 一、Description

​ Usage: Delete Vendor Shipment Note

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/root/api/delete/asi
HTTP Method DELETE
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
menuCode String(Query) Yes asi
id long(Query) Yes Vendor Shipment Note ID
param String(Query) No Extra Pamameters: in JSON format

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/root/api/delete/asi";
		String param = "&menuCode=asi&id=" + id;

		HttpDelete delete = new HttpDelete(url + "?" + param);
		delete.addHeader("authorization", access_token);
		delete.addHeader("client_id", ClientID);

		res = client.execute(delete);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

			System.out.println(json);
		}

		delete.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

​ 4、Response Sample

{
	"messages": [],
	"status": true
}
{
    "messages": [
        {
            "msgDetail": "Record has been deleted",
            "msgCode": "core_101017"
        }
    ],
    "status": false
}

# Load EBI data:Vendor Shipment Note Report

# 一、Description

​ Usage: Run EBI[Vendor Shipment Note Report],return EBI data

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/ebiWidget/loadReport
HTTP Method GET
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
formatId long(Query) Yes Format ID fetched from another API
beId long(Query) No Business Entity ID,If not specified, query all authorized Business Entity data.
offset int(Query) No Resultset offset : start index
rows int(Query) No Resultset offset : end index

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/ebiWidget/loadReport";
		String param = "&formatId=" + formatId;

		HttpGet get = new HttpGet(url + "?" + param);
		get.addHeader("authorization", access_token);
		get.addHeader("client_id", ClientID);
		res = client.execute(get);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

			System.out.println(json);
		}

		get.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}				

​ 4、Response Sample

{
    "size": 11,
    "rows": [
        {
            "ASIT_A_qty": "10.0000",
            "ASI_A_tDate": "2018.12.11",
            "M18ReservedCol_dataIndex": 1,
            "VEN_A_code": "VIT001",
            "ASIT_A_unitId_code": "个",
            "ASI_A_code": "ASI180003",
            "ASI_A_id": "11",
            "PRO_A_code": "ITPRO001",
            "PRO_A_id": "18",
            "VEN_A_id": "592"
        }
    ]
}

ebi1

# Goods Receipt Note

# Fetch Goods Receipt Note List

# 一、Description

​ Usage: Fetch Goods Receipt Note List.

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/search/search
HTTP Method GET
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
stSearch String(Query) Yes an
beId long(Query) Yes Business Entity ID
formatId long(Query) No Lookup Query ID, If not specified, the default format is used.
startRow int(Query) No Resultset offset : start index
endRow int(Query) No Resultset offset : end index
quickSearchStr String(Query) No Quick search keyword

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/search/search";
		String param = "&stSearch=an&beId=11";

		HttpGet get = new HttpGet(url + "?" + param);
		get.addHeader("authorization", access_token);
		get.addHeader("client_id", ClientID);
		res = client.execute(get);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));
		}
		get.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

​ 4、Response Sample

{
  	"stSearch": "an",
    "size": 36,
    "stSearchDisplay": "Goods Receipt Note",
    "values": [
        {
            "code": "ITAN220325A",
            "tDate": "2022-03-25",
            "mainan.venId.ven.code": "2000C-014",
            "mainan.venId.ven.desc__lang": "Choi Hop Hong Co., Ltd",
            "venDnNo": "",
            "mainan.curId.cur.sym": "¥",
            "mainan.flowTypeId.flowtype.code": "PURCHASE",
            "mainan.flowTypeId.flowtype.desc": "Purchase Flow",
            "iRev": 1,
            "lastModifyDate": "2022-03-25 10:51:16",
            "mainan.lastModifyUid.simpleUser.desc__lang": "Ivan Tan",
            "id": 679,
            "st_desc": "ITAN220325A",
            "st_id": 679,
            "st_code": "ITAN220325A"
        }
  	]
}

# Load Goods Receipt Note

# 一、Description

​ Usage: Load 【Goods Receipt Note】Record

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/root/api/read/an
HTTP Method GET
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
menuCode String(Query) Yes an
id long(Query) Yes Goods Receipt Note ID
param String(Query) No Extra Pamameters: in JSON format

​ 3、Request Sample

		CloseableHttpClient client = HttpClientBuilder.create().build();
		CloseableHttpResponse res = null;
		try {

			String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/root/api/read/an";
			String param = "&menuCode=an&id=" + id;

			HttpGet get = new HttpGet(url + "?" + param);
			get.addHeader("authorization", access_token);
			get.addHeader("client_id", ClientID);
			res = client.execute(get);
			if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
				JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

				System.out.println(json);
			}

			get.releaseConnection();
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			try {
				if (res != null) {
					res.close();
				}
				if (client != null) {
					client.close();
				}
			} catch (Exception ex) {
				ex.printStackTrace();
			}
		}

​ 4、Response Sample

{
    "data": {
        "antlot": [
            {
                "lotnoNumAttr17": 0,
                "lotnoNumAttr16": 0,
                "lotnoNumAttr15": 0,
                "lotnoNumAttr14": 0,
                "lotnoNumAttr19": 0,
                "lotnoNumAttr18": 0,
                "lotnoLookupAttr20": 0,
                "lotnoNumAttr13": 0,
                "lotnoNumAttr12": 0,
                "lotnoNumAttr11": 0,
                "lotnoNumAttr10": 0,
                "lotnoLookupAttr16": 0,
                "lotnoLookupAttr17": 0,
                "lotnoLookupAttr14": 0,
                "lotnoLookupAttr15": 0,
                "lotnoLookupAttr18": 0,
                "lotnoLookupAttr19": 0,
                "newLotno": 1,
                "lotnoLot": "A",
                "id": 332,
                "lotnoNumAttr20": 0,
                "lotnoLookupAttr12": 0,
                "lotnoLookupAttr13": 0,
                "lotnoLookupAttr10": 0,
                "lotnoLookupAttr11": 0,
                "iRev": 1,
                "ce01Module": "an",
                "lotnoDateAttr3": -2209017600000,
                "lotnoDateAttr4": -2209017600000,
                "lotnoDateAttr1": -2209017600000,
                "lotnoDateAttr2": -2209017600000,
                "lotnoDateAttr7": -2209017600000,
                "lotnoDateAttr8": -2209017600000,
                "lotnoDateAttr5": -2209017600000,
                "lotnoDateAttr6": -2209017600000,
                "unitId": 40,
                "lotnoDateAttr9": -2209017600000,
                "locId": 7,
                "lotnoTextAttr1": "",
                "udfaaa": "",
                "lotnoTextAttr2": "",
                "lotnoTextAttr3": "",
                "lotnoTextAttr4": "",
                "lotnoTextAttr5": "",
                "lotnoTextAttr6": "",
                "lotnoTextAttr7": "",
                "lotnoTextAttr8": "",
                "lotnoTextAttr9": "",
                "dualQty": 0,
                "itemNo": "",
                "hId": 679,
                "lotnoNumAttr1": 0,
                "lotnoNumAttr2": 0,
                "lotnoNumAttr3": 0,
                "lotnoNumAttr4": 0,
                "lotnoExpDate": 253402271999000,
                "footerKey": "     1",
                "qty": 1,
                "lotnoNumAttr5": 0,
                "lotnoNumAttr6": 0,
                "lotnoNumAttr7": 0,
                "lotnoNumAttr8": 0,
                "lotnoNumAttr9": 0,
                "lotNoId": 5479,
                "lotnoTextAttr16": "",
                "lotnoTextAttr15": "",
                "lotnoTextAttr18": "",
                "lotnoTextAttr17": "",
                "lotnoTextAttr12": "",
                "lotnoTextAttr11": "",
                "lotnoDateAttr20": -2209017600000,
                "lotnoTextAttr14": "",
                "lotnoTextAttr13": "",
                "lotnoTextAttr19": "",
                "lotnoTextAttr10": "",
                "dualUnitId": 29,
                "lotnoLookupAttr5": 0,
                "lotnoLookupAttr6": 0,
                "lotnoLookupAttr7": 0,
                "lotnoDateAttr18": -2209017600000,
                "lotnoLookupAttr8": 0,
                "lotnoDateAttr19": -2209017600000,
                "lotno": "ITAN220325A00",
                "lotnoLookupAttr9": 0,
                "proId": 26,
                "lotnoDateAttr12": -2209017600000,
                "lotnoDateAttr13": -2209017600000,
                "lotnoDateAttr10": -2209017600000,
                "lotnoDateAttr11": -2209017600000,
                "lotnoTextAttr20": "",
                "lotnoLookupAttr1": 0,
                "lotnoDateAttr16": -2209017600000,
                "lotnoLookupAttr2": 0,
                "lotnoDateAttr17": -2209017600000,
                "lotnoLookupAttr3": 0,
                "lotnoDateAttr14": -2209017600000,
                "lotnoLookupAttr4": 0,
                "lotnoDateAttr15": -2209017600000
            }
        ],
        "reman": [
            {
                "hId": 679,
                "i18nField": "{\"remarks_zh-CN\": \"\"}",
                "remarks_zh-CN": "",
                "remarks_ccn": "",
                "remarks_en": "",
                "remarks_haha1": "",
                "iRev": 1,
                "id": 679,
                "remarks_zh-TW": "",
                "remarks": "",
                "remarks_ctw": "",
                "ce01Module": "an"
            }
        ],
        "ant": [
            {
                "sourceId": 10661,
                "unit2Id": 40,
                "scrapQty2": 0,
                "scrapQty1": 0,
                "dualQty": 0,
                "qty2": 0,
                "itemNo": "     1",
                "venDnNo": "",
                "qty1": 1,
                "poLot": "A",
                "beId": 11,
                "passQty1": 0,
                "passQty2": 0,
                "bDesc": "",
                "bDesc_zh-TW": "",
                "newLotno": 0,
                "udfString": "",
                "id": 1006,
                "up": 10,
                "ctn": 0,
                "dDesc_haha1": "",
                "height": 0,
                "isInventory": true,
                "hId": 679,
                "perCtn": 0,
                "reDeliveryId": 10661,
                "completed": false,
                "freeQtyPer": 0,
                "passQty": 0,
                "volume": 0,
                "dDesc": "",
                "footerKey": "     1",
                "i18nField": "{\"bDesc_zh-CN\": \"\", \"dDesc_zh-CN\": \"\"}",
                "sourceType": "po",
                "qty": 1,
                "invup": 10,
                "asnLot": "",
                "disc": 0,
                "asnId": 0,
                "packingDesc": "",
                "refCode": "",
                "lotNoId": 0,
                "dDesc_ctw": "",
                "innerQty": 0,
                "unit1Id": 40,
                "costAmt": 0,
                "reDeliveryType": "po",
                "amt": 10,
                "nw": 0,
                "iRev": 1,
                "dDesc_zh-CN": "",
                "qup": 0,
                "packingUnitId": 0,
                "poId": 10661,
                "bDesc_ctw": "",
                "ce01Module": "an",
                "lot": "A",
                "bDesc_haha1": "",
                "reDeliveryLot": "A",
                "dDesc_zh-TW": "",
                "domAmt": 10,
                "reShipType": "asi",
                "udfCheck": false,
                "bDesc_ccn": "",
                "unitId": 40,
                "innerUnitId": 0,
                "dDesc_ccn": "",
                "locId": 7,
                "bDesc_en": "",
                "reDelivery": false,
                "scrapQty": 0,
                "sourceCliId": 0,
                "length": 0,
                "dDesc_en": "",
                "dualUnitId": 29,
                "gw": 0,
                "sourceLot": "A",
                "proId": 26,
                "width": 0,
                "qcId": 0,
                "bDesc_zh-CN": ""
            }
        ],
        "mainan": [
            {
                "lastModifyUid": 11,
                "useAccess": false,
                "virDeptId": 0,
                "expiredDate": -2209017600000,
                "position_zh-CN": "",
                "sysJson": "",
                "viewCode": "an",
                "venDnNo": "",
                "beId": 11,
                "useAccessBl": false,
                "id": 679,
                "doctypeId": 0,
                "locked": false,
                "position_ctw": "",
                "lastModifyDate": 1648176676000,
                "createUid": 11,
                "rev": "1",
                "lastApproveUid": 0,
                "ttlCharge": 0,
                "completed": false,
                "expiredUid": 0,
                "freeQtyPer": 0,
                "descOrigin": "VENREF",
                "position_en": "",
                "position_zh-TW": "",
                "venId": 108,
                "i18nField": "{\"position_zh-CN\": \"\"}",
                "manId": 0,
                "ttlAmt": 10,
                "multiFlowSrcId": 0,
                "position": "",
                "flowTypeId": 1356,
                "status": "N",
                "weightUnit": "kg",
                "multiFlowFlowId": 0,
                "tDate": 1648137600000,
                "code": "ITAN220325A",
                "cnDeptId": 0,
                "multiFlowSrcModule": "",
                "amt": 10,
                "iRev": 1,
                "upOrigin": "POLAST",
                "ce01Module": "an",
                "curId": 1,
                "expired": false,
                "rate": 1,
                "domAmt": 10,
                "measUnit": "cbm",
                "printCount": 0,
                "statusModifyDate": 1648176676000,
                "locId": 0,
                "createDate": 1648176676000,
                "loadGpCoData": false,
                "useAccessWl": false,
                "position_ccn": "",
                "ttlDisc": 0,
                "multiFlowSrcBeId": 0,
                "position_haha1": "",
                "useAccessAutoCalc": false,
                "staffId": 723,
                "domAmtDiff": 0
            }
        ]
    },
    "messages": [],
    "status": true
}

# Create Goods Receipt Note

# 一、Description

​ Usage: create or update 【Goods Receipt Note】

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/root/api/save/an
HTTP Method PUT
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
menuCode String(Query) Yes an
param String(Query) No Extra Pamameters: in JSON format

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/root/api/save/an";
		String param = "&menuCode=an";

		HttpPut put = new HttpPut(url + "?" + param);
		put.addHeader("authorization", access_token);
		put.addHeader("client_id", ClientID);

		StringEntity entity = new StringEntity(data.toJSONString(), ContentType.APPLICATION_JSON);
		entity.setContentEncoding("UTF-8");
		put.setEntity(entity);

		res = client.execute(put);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

			if (json != null) {
				recordId = json.getLongValue("recordId");
			}

			System.out.println(json);
		}

		put.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}				

Entity data as JSON format:

{
    "mainan": {
        "values": [
            {
                "beId": 11,
                "code": "ITAN220325A",
                "venId": 108,
                "curId": 1,
                "rate": 1,
                "flowTypeId": 1356,
                "staffId": 723
            }
        ]
    },
    "ant": {
        "values": [
            {
                "sourceType": "po",
                "sourceId": 10661,
                "sourceLot": "A",
                "proId": 26,
                "locId": 7,
                "unitId": 40,
                "qty": 1,
                "up": 10,
                "amt": 10
            }
        ]
    }
}

​ 4、Response Sample

{
	"recordId": 679,
	"messages": [],
	"status": true
}
{
    "recordId": 0,
    "messages": [
        {
            "msgDetail": "Required field is empty",
            "msgCode": "core_101905"
        }
    ],
    "status": false
}

# Create Goods Receipt Note (Auto Completion)

# 一、Description

​ 1. Usage: Create 【Goods Receipt Note】

​ 2. This API has the following characteristics:

​ ​ a. Support using code instead of id field

​ ​ b. If field currency has no value specified, the Entity Currency will be used automatically

​ ​ c. If field staff has no value specified, the default staff in the User Options will be used automatically

​ ​ d. If field document date has no value specified, the value is obtained according to the date option in the [Preference Setup (Trade)]

​ ​ e. If field business process has no value specified, according to the default value set in [Business Process Setup (Trade)]

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/erp/bsFlow/save/an
HTTP Method POST
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/erp/bsFlow/save/an";

		HttpPost post = new HttpPost(url);
		post.addHeader("authorization", access_token);
		post.addHeader("client_id", ClientID);

		StringEntity entity = new StringEntity(data.toJSONString(), ContentType.APPLICATION_JSON);
		entity.setContentEncoding("UTF-8");
		post.setEntity(entity);

		res = client.execute(post);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

			if (json != null) {
				recordId = json.getLongValue("tranId");
			}
			System.out.println(json);
		}

		post.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

Sample data

{
    "beCode": "IT",
    "venCode": "VIT001",
    "ant": [
        {
            "proCode": "ITPRO002",
            "unitCode": "PCS",
            "locCode": "SZO",
            "qty": 1,
            "up": 10,
            "amt": 10
        }
    ]
}

​ 4、Response Sample

{
  "tranId": 680,
  "tranCode": "AN0220006",
  "message": "",
  "status": true
}

# Delete Goods Receipt Note

# 一、Description

​ Usage: Delete Goods Receipt Note

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/root/api/delete/an
HTTP Method DELETE
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
menuCode String(Query) Yes an
id long(Query) Yes Goods Receipt Note ID
param String(Query) No Extra Pamameters: in JSON format

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/root/api/delete/an";
		String param = "&menuCode=an&id=" + id;

		HttpDelete delete = new HttpDelete(url + "?" + param);
		delete.addHeader("authorization", access_token);
		delete.addHeader("client_id", ClientID);

		res = client.execute(delete);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

			System.out.println(json);
		}

		delete.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

​ 4、Response Sample

{
	"messages": [],
	"status": true
}
{
    "messages": [
        {
            "msgDetail": "Record has been deleted",
            "msgCode": "core_101017"
        }
    ],
    "status": false
}

# Load EBI data:Goods Receipt Note List

# 一、Description

​ Usage: Run EBI[Goods Receipt Note List],return EBI data

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/ebiWidget/loadReport
HTTP Method GET
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
formatId long(Query) Yes Format ID fetched from another API
beId long(Query) No Business Entity ID,If not specified, query all authorized Business Entity data.
offset int(Query) No Resultset offset : start index
rows int(Query) No Resultset offset : end index

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/ebiWidget/loadReport";
		String param = "&formatId=" + formatId;

		HttpGet get = new HttpGet(url + "?" + param);
		get.addHeader("authorization", access_token);
		get.addHeader("client_id", ClientID);
		res = client.execute(get);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

			System.out.println(json);
		}

		get.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}				

​ 4、Response Sample

{
    "size": 36,
    "rows": [
        {
            "AN_A_ttlDisc": "0.00",
            "AN_A_curId": "1",
            "AN_A_id": "7",
            "M18ReservedCol_dataIndex": 1,
            "AN_A_curId_code": "R",
            "LOC_A_id": "1",
            "AN_A_tDate": "2016.08.22",
            "AN_A_ttlCharge": "0.00",
            "LOC_A_code": "PHY",
            "AN_A_rate": "1.00000000",
            "AN_A_ttlAmt": "4,350.00",
            "VEN_A_code": "V0001",
            "AN_A_amt": "4,350.00",
            "AN_A_code": "ITGRN16080001",
            "VEN_A_id": "1"
        }
    ]
}

ebi1

# Load EBI data:Goods Receipt Note Report

# 一、Description

​ Usage: Run EBI[Goods Receipt Note Report],return EBI data

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/ebiWidget/loadReport
HTTP Method GET
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
formatId long(Query) Yes Format ID fetched from another API
beId long(Query) No Business Entity ID,If not specified, query all authorized Business Entity data.
offset int(Query) No Resultset offset : start index
rows int(Query) No Resultset offset : end index

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/ebiWidget/loadReport";
		String param = "&formatId=" + formatId;

		HttpGet get = new HttpGet(url + "?" + param);
		get.addHeader("authorization", access_token);
		get.addHeader("client_id", ClientID);
		res = client.execute(get);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

			System.out.println(json);
		}

		get.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}				

​ 4、Response Sample

{
    "size": 56,
    "rows": [
        {
            "MAIN_lotAmt": "4,350.00",
            "AN_A_id": "7",
            "ANT_A_qty": "500.0000",
            "ANT_A_unitId_code": "PCS",
            "M18ReservedCol_dataIndex": 1,
            "MAIN_lotQty": "500.0000",
            "AN_A_code": "ITGRN16080001",
            "PRO_A_code": "PRO004",
            "PRO_A_id": "8",
            "LOTNO_A_lotno": "ITGRN16080001-01"
        }
    ]
}

ebi2

# Purchase Return

# Fetch Purchase Return List

# 一、Description

​ Usage: Fetch Purchase Return List.

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/search/search
HTTP Method GET
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
stSearch String(Query) Yes pret
beId long(Query) Yes Business Entity ID
formatId long(Query) No Lookup Query ID, If not specified, the default format is used.
startRow int(Query) No Resultset offset : start index
endRow int(Query) No Resultset offset : end index
quickSearchStr String(Query) No Quick search keyword

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/search/search";
		String param = "&stSearch=pret&beId=11";

		HttpGet get = new HttpGet(url + "?" + param);
		get.addHeader("authorization", access_token);
		get.addHeader("client_id", ClientID);
		res = client.execute(get);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));
		}
		get.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

​ 4、Response Sample

{
  	"stSearch": "pret",
    "size": 8,
    "stSearchDisplay": "Purchase Return",
    "values": [
        {
            "code": "ITPRET220330A",
            "tDate": "2022-03-30",
            "mainpret.venId.ven.code": "VIT001",
            "mainpret.venId.ven.desc__lang": "Global Shared (Test printing long text stretch with overflow)",
            "mainpret.curId.cur.sym": "¥",
            "mainpret.flowTypeId.flowtype.code": "PURCHASE",
            "mainpret.flowTypeId.flowtype.desc": "Purchase Flow",
            "iRev": 1,
            "lastModifyDate": "2022-03-30 14:24:48",
            "mainpret.lastModifyUid.simpleUser.desc__lang": "Ivan Tan",
            "id": 88,
            "st_desc": "ITPRET220330A",
            "st_id": 88,
            "st_code": "ITPRET220330A"
        }
  	]
}

# Load Purchase Return

# 一、Description

​ Usage: Load 【Purchase Return】Record

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/root/api/read/pret
HTTP Method GET
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
menuCode String(Query) Yes pret
id long(Query) Yes Purchase Return ID
param String(Query) No Extra Pamameters: in JSON format

​ 3、Request Sample

		CloseableHttpClient client = HttpClientBuilder.create().build();
		CloseableHttpResponse res = null;
		try {

			String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/root/api/read/pret";
			String param = "&menuCode=pret&id=" + id;

			HttpGet get = new HttpGet(url + "?" + param);
			get.addHeader("authorization", access_token);
			get.addHeader("client_id", ClientID);
			res = client.execute(get);
			if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
				JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

				System.out.println(json);
			}

			get.releaseConnection();
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			try {
				if (res != null) {
					res.close();
				}
				if (client != null) {
					client.close();
				}
			} catch (Exception ex) {
				ex.printStackTrace();
			}
		}

​ 4、Response Sample

{
    "data": {
        "prettlot": [
            {
                "lotnoNumAttr17": 0,
                "lotnoNumAttr16": 0,
                "lotnoNumAttr15": 0,
                "lotnoNumAttr14": 0,
                "lotnoNumAttr19": 0,
                "lotnoNumAttr18": 0,
                "lotnoLookupAttr20": 0,
                "lotnoNumAttr13": 0,
                "lotnoNumAttr12": 0,
                "lotnoNumAttr11": 0,
                "lotnoNumAttr10": 0,
                "lotnoLookupAttr16": 0,
                "lotnoLookupAttr17": 0,
                "lotnoLookupAttr14": 0,
                "lotnoLookupAttr15": 0,
                "lotnoLookupAttr18": 0,
                "lotnoLookupAttr19": 0,
                "newLotno": 0,
                "lotnoLot": "A",
                "id": 34,
                "lotnoNumAttr20": 0,
                "lotnoLookupAttr12": 0,
                "lotnoLookupAttr13": 0,
                "lotnoLookupAttr10": 0,
                "lotnoLookupAttr11": 0,
                "iRev": 1,
                "ce01Module": "pret",
                "lotnoDateAttr3": -2561356800000,
                "lotnoDateAttr4": -2435126400000,
                "lotnoDateAttr1": -2561356800000,
                "lotnoDateAttr2": -2561356800000,
                "lotnoDateAttr7": -2209017600000,
                "lotnoDateAttr8": -2209017600000,
                "lotnoDateAttr5": -2209017600000,
                "lotnoDateAttr6": -2209017600000,
                "unitId": 40,
                "lotnoDateAttr9": -2209017600000,
                "locId": 7,
                "lotnoTextAttr1": "",
                "lotnoTextAttr2": "",
                "lotnoTextAttr3": "",
                "lotnoTextAttr4": "",
                "lotnoTextAttr5": "",
                "lotnoTextAttr6": "",
                "lotnoTextAttr7": "",
                "lotnoTextAttr8": "",
                "lotnoTextAttr9": "",
                "dualQty": 1,
                "itemNo": "",
                "hId": 88,
                "lotnoNumAttr1": 0,
                "lotnoNumAttr2": 0,
                "lotnoNumAttr3": 0,
                "lotnoNumAttr4": 0,
                "lotnoExpDate": 253144540800000,
                "footerKey": "     1",
                "qty": 1,
                "lotnoNumAttr5": 0,
                "lotnoNumAttr6": 0,
                "lotnoNumAttr7": 0,
                "lotnoNumAttr8": 0,
                "lotnoNumAttr9": 0,
                "lotNoId": 625,
                "lotnoTextAttr16": "",
                "lotnoTextAttr15": "",
                "lotnoTextAttr18": "",
                "lotnoTextAttr17": "",
                "lotnoTextAttr12": "",
                "lotnoTextAttr11": "",
                "lotnoDateAttr20": -2209017600000,
                "lotnoTextAttr14": "",
                "lotnoTextAttr13": "",
                "lotnoTextAttr19": "",
                "lotnoTextAttr10": "",
                "dualUnitId": 29,
                "lotnoLookupAttr5": 0,
                "lotnoLookupAttr6": 0,
                "lotnoLookupAttr7": 0,
                "lotnoDateAttr18": -2209017600000,
                "lotnoLookupAttr8": 0,
                "lotnoDateAttr19": -2209017600000,
                "lotno": "XXXXXXXXXXXOS0160069-01",
                "lotnoLookupAttr9": 0,
                "proId": 26,
                "lotnoDateAttr12": -2209017600000,
                "lotnoDateAttr13": -2209017600000,
                "lotnoDateAttr10": -2209017600000,
                "lotnoDateAttr11": -2209017600000,
                "lotnoTextAttr20": "",
                "lotnoLookupAttr1": 0,
                "lotnoDateAttr16": -2209017600000,
                "lotnoLookupAttr2": 0,
                "lotnoDateAttr17": -2209017600000,
                "lotnoLookupAttr3": 0,
                "lotnoDateAttr14": -2209017600000,
                "lotnoLookupAttr4": 3,
                "lotnoDateAttr15": -2209017600000
            }
        ],
        "mainpret": [
            {
                "lastModifyUid": 11,
                "useAccess": false,
                "virDeptId": 0,
                "expiredDate": -2209017600000,
                "position_zh-CN": "",
                "sysJson": "",
                "viewCode": "pret",
                "beId": 11,
                "useAccessBl": false,
                "id": 88,
                "doctypeId": 0,
                "locked": false,
                "position_ctw": "",
                "lastModifyDate": 1648621488000,
                "createUid": 11,
                "rev": "1",
                "lastApproveUid": 11,
                "ttlCharge": 0,
                "completed": false,
                "expiredUid": 0,
                "freeQtyPer": 0,
                "descOrigin": "POLAST",
                "position_en": "",
                "position_zh-TW": "",
                "venId": 592,
                "i18nField": "{\"position_zh-CN\": \"\"}",
                "manId": 0,
                "ttlAmt": 6,
                "multiFlowSrcId": 0,
                "position": "",
                "flowTypeId": 1356,
                "status": "Y",
                "multiFlowFlowId": 0,
                "tDate": 1648569600000,
                "code": "ITPRET220330A",
                "cnDeptId": 29,
                "multiFlowSrcModule": "",
                "amt": 6,
                "iRev": 1,
                "upOrigin": "POLAST",
                "ce01Module": "pret",
                "curId": 1,
                "expired": false,
                "rate": 1,
                "domAmt": 6,
                "printCount": 0,
                "statusModifyDate": 1648621488000,
                "locId": 7,
                "createDate": 1648621488000,
                "loadGpCoData": false,
                "useAccessWl": false,
                "position_ccn": "",
                "ttlDisc": 0,
                "multiFlowSrcBeId": 0,
                "position_haha1": "",
                "useAccessAutoCalc": false,
                "staffId": 723,
                "domAmtDiff": 0
            }
        ],
        "prett": [
            {
                "sourceId": 51,
                "unit2Id": 40,
                "dualQty": 1,
                "qty2": 0,
                "itemNo": "     1",
                "qty1": 1,
                "poLot": "",
                "beId": 11,
                "bDesc": "Lot no. can be duplicated",
                "bDesc_zh-TW": "",
                "newLotno": 0,
                "id": 178,
                "up": 6,
                "dDesc_haha1": "",
                "isInventory": true,
                "hId": 88,
                "reDeliveryId": 0,
                "completed": false,
                "freeQtyPer": 0,
                "dDesc": "",
                "footerKey": "     1",
                "i18nField": "{\"bDesc_zh-CN\": \"Lot no. can be duplicated\", \"dDesc_zh-CN\": \"\"}",
                "sourceType": "asi",
                "qty": 1,
                "invup": 6,
                "asnLot": "A",
                "disc": 0,
                "asnId": 51,
                "refCode": "",
                "lotNoId": 0,
                "dDesc_ctw": "",
                "unit1Id": 40,
                "costAmt": 0,
                "reDeliveryType": "",
                "amt": 6,
                "iRev": 1,
                "dDesc_zh-CN": "",
                "poId": 0,
                "bDesc_ctw": "",
                "ce01Module": "pret",
                "lot": "A",
                "bDesc_haha1": "",
                "reDeliveryLot": "",
                "dDesc_zh-TW": "",
                "domAmt": 6,
                "reShipType": "asi",
                "bDesc_ccn": "",
                "unitId": 40,
                "dDesc_ccn": "",
                "locId": 7,
                "bDesc_en": "",
                "reDelivery": false,
                "sourceCliId": 0,
                "dDesc_en": "",
                "dualUnitId": 29,
                "sourceLot": "A",
                "proId": 26,
                "qcId": 0,
                "bDesc_zh-CN": "Lot no. can be duplicated"
            }
        ],
        "rempret": [
            {
                "hId": 88,
                "heading_haha1": "",
                "heading_en": "",
                "heading_zh-TW": "",
                "heading": "",
                "remarks_ccn": "",
                "remarks_en": "",
                "heading_ctw": "",
                "iRev": 1,
                "heading_zh-CN": "",
                "ce01Module": "pret",
                "heading_ccn": "",
                "i18nField": "{\"heading_zh-CN\": \"\", \"remarks_zh-CN\": \"\"}",
                "remarks_zh-CN": "",
                "remarks_haha1": "",
                "id": 88,
                "remarks_zh-TW": "",
                "remarks": "",
                "remarks_ctw": ""
            }
        ]
    },
    "messages": [],
    "status": true
}

# Create Purchase Return

# 一、Description

​ Usage: create or update 【Purchase Return】

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/root/api/save/pret
HTTP Method PUT
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
menuCode String(Query) Yes pret
param String(Query) No Extra Pamameters: in JSON format

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/root/api/save/pret";
		String param = "&menuCode=pret";

		HttpPut put = new HttpPut(url + "?" + param);
		put.addHeader("authorization", access_token);
		put.addHeader("client_id", ClientID);

		StringEntity entity = new StringEntity(data.toJSONString(), ContentType.APPLICATION_JSON);
		entity.setContentEncoding("UTF-8");
		put.setEntity(entity);

		res = client.execute(put);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

			if (json != null) {
				recordId = json.getLongValue("recordId");
			}

			System.out.println(json);
		}

		put.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}				

Entity data as JSON format:

 {
    "mainpret": {
        "values": [
            {
                "beId": 11,
                "code": "ITPRET220325A",
                "venId": 108,
                "curId": 1,
                "rate": 1,
                "flowTypeId": 1356,
                "staffId": 723
            }
        ]
    },
    "prett": {
        "values": [
            {
                "sourceType": "pro",
                "proId": 26,
                "locId": 7,
                "unitId": 40,
                "qty": 1
            }
        ]
    }
}

​ 4、Response Sample

{
	"recordId": 86,
	"messages": [],
	"status": true
}
{
    "recordId": 0,
    "messages": [
        {
            "msgDetail": "Required field is empty",
            "msgCode": "core_101905"
        }
    ],
    "status": false
}

# Create Purchase Return (Auto Completion)

# 一、Description

​ 1. Usage: Create 【Purchase Return】

​ 2. This API has the following characteristics:

​ ​ a. Support using code instead of id field

​ ​ b. If field currency has no value specified, the Entity Currency will be used automatically

​ ​ c. If field staff has no value specified, the default staff in the User Options will be used automatically

​ ​ d. If field document date has no value specified, the value is obtained according to the date option in the [Preference Setup (Trade)]

​ ​ e. If field business process has no value specified, according to the default value set in [Business Process Setup (Trade)]

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/erp/bsFlow/save/pret
HTTP Method POST
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/erp/bsFlow/save/pret";

		HttpPost post = new HttpPost(url);
		post.addHeader("authorization", access_token);
		post.addHeader("client_id", ClientID);

		StringEntity entity = new StringEntity(data.toJSONString(), ContentType.APPLICATION_JSON);
		entity.setContentEncoding("UTF-8");
		post.setEntity(entity);

		res = client.execute(post);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

			if (json != null) {
				recordId = json.getLongValue("tranId");
			}
			System.out.println(json);
		}

		post.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

Sample data

{
    "beCode": "IT",
    "venCode": "VIT001",
    "prett": [
        {
            "proCode": "ITPRO002",
            "unitCode": "PCS",
            "locCode": "SZO",
            "qty": 1
        }
    ]
}

​ 4、Response Sample

{
  "tranId": 87,
  "tranCode": "PRE220001",
  "message": "",
  "status": true
}

# Delete Purchase Return

# 一、Description

​ Usage: Delete Purchase Return

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/root/api/delete/pret
HTTP Method DELETE
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
menuCode String(Query) Yes pret
id long(Query) Yes Purchase Return ID
param String(Query) No Extra Pamameters: in JSON format

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/root/api/delete/pret";
		String param = "&menuCode=pret&id=" + id;

		HttpDelete delete = new HttpDelete(url + "?" + param);
		delete.addHeader("authorization", access_token);
		delete.addHeader("client_id", ClientID);

		res = client.execute(delete);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

			System.out.println(json);
		}

		delete.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

​ 4、Response Sample

{
	"messages": [],
	"status": true
}
{
    "messages": [
        {
            "msgDetail": "Record has been deleted",
            "msgCode": "core_101017"
        }
    ],
    "status": false
}

# Load EBI data:Purchase Return List

# 一、Description

​ Usage: Run EBI[Purchase Return List],return EBI data

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/ebiWidget/loadReport
HTTP Method GET
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
formatId long(Query) Yes Format ID fetched from another API
beId long(Query) No Business Entity ID,If not specified, query all authorized Business Entity data.
offset int(Query) No Resultset offset : start index
rows int(Query) No Resultset offset : end index

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/ebiWidget/loadReport";
		String param = "&formatId=" + formatId;

		HttpGet get = new HttpGet(url + "?" + param);
		get.addHeader("authorization", access_token);
		get.addHeader("client_id", ClientID);
		res = client.execute(get);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

			System.out.println(json);
		}

		get.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}				

​ 4、Response Sample

{
    "size": 8,
    "rows": [
        {
            "M_A_code": "ITPR16080001",
            "M_A_ttlDisc": "0.00",
            "M_A_amt": "87.00",
            "M18ReservedCol_dataIndex": 1,
            "M_A_tDate": "2016.08.23",
            "M_A_curId": "1",
            "M_A_ttlAmt": "87.00",
            "M_A_id": "4",
            "M_A_rate": "1.00000000",
            "VEN_A_code": "V0001",
            "M_A_curId_code": "R",
            "VEN_A_id": "1",
            "M_A_ttlCharge": "0.00"
        }
    ]
}

ebi1

# Load EBI data:Purchase Return Report

# 一、Description

​ Usage: Run EBI[Purchase Return Report],return EBI data

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/ebiWidget/loadReport
HTTP Method GET
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
formatId long(Query) Yes Format ID fetched from another API
beId long(Query) No Business Entity ID,If not specified, query all authorized Business Entity data.
offset int(Query) No Resultset offset : start index
rows int(Query) No Resultset offset : end index

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/ebiWidget/loadReport";
		String param = "&formatId=" + formatId;

		HttpGet get = new HttpGet(url + "?" + param);
		get.addHeader("authorization", access_token);
		get.addHeader("client_id", ClientID);
		res = client.execute(get);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

			System.out.println(json);
		}

		get.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}				

​ 4、Response Sample

{
    "size": 7,
    "rows": [
        {
            "PRETT_A_sourceType": "Product / Material",
            "MAIN_multiFlowSrcId": "0",
            "M18ReservedCol_dataIndex": 1,
            "PRET_A_id": "5",
            "PRETT_A_qty": "10.0000",
            "MAIN_multiFlowSrcCode": "",
            "LOC_A_id": "1",
            "PRETT_A_unitId_code": "PCS",
            "LOT_A_lotno": "ITGRN16080001-01",
            "PRET_A_code": "ITPR16080002",
            "PRO_A_id": "8",
            "LOC_A_code": "PHY",
            "MAIN_multiFlowSrcModule": "",
            "PRO_A_code": "PRO004"
        }
    ]
}

ebi2

# Purchase Invoice

# Fetch Purchase Invoice List

# 一、Description

​ Usage: Fetch Purchase Invoice List.

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/search/search
HTTP Method GET
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
stSearch String(Query) Yes pi
beId long(Query) Yes Business Entity ID
formatId long(Query) No Lookup Query ID, If not specified, the default format is used.
startRow int(Query) No Resultset offset : start index
endRow int(Query) No Resultset offset : end index
quickSearchStr String(Query) No Quick search keyword

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/search/search";
		String param = "&stSearch=pi&beId=11";

		HttpGet get = new HttpGet(url + "?" + param);
		get.addHeader("authorization", access_token);
		get.addHeader("client_id", ClientID);
		res = client.execute(get);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));
		}
		get.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

​ 4、Response Sample

{
  	"stSearch": "pi",
    "size": 6,
    "stSearchDisplay": "Purchase Invoice",
    "values": [
        {
            "code": "ITPI220328A",
            "tDate": "2022-03-28",
            "maintap.venId.ven.code": "2000C-014",
            "maintap.venId.ven.desc__lang": "Choi Hop Hong Co., Ltd",
            "venInvNo": "",
            "maintap.curId.cur.sym": "¥",
            "maintap.flowTypeId.flowtype.code": "PURCHASE",
            "maintap.flowTypeId.flowtype.desc": "Purchase Flow",
            "iRev": 1,
            "lastModifyDate": "2022-03-28 16:31:35",
            "maintap.lastModifyUid.simpleUser.desc__lang": "Ivan Tan",
            "id": 962,
            "st_desc": "ITPI220328A",
            "st_id": 962,
            "st_code": "ITPI220328A"
        }
  	]
}

# Load Purchase Invoice

# 一、Description

​ Usage: Load 【Purchase Invoice】Record

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/root/api/read/pi
HTTP Method GET
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
menuCode String(Query) Yes pi
id long(Query) Yes Purchase Invoice ID
param String(Query) No Extra Pamameters: in JSON format

​ 3、Request Sample

		CloseableHttpClient client = HttpClientBuilder.create().build();
		CloseableHttpResponse res = null;
		try {

			String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/root/api/read/pi";
			String param = "&menuCode=pi&id=" + id;

			HttpGet get = new HttpGet(url + "?" + param);
			get.addHeader("authorization", access_token);
			get.addHeader("client_id", ClientID);
			res = client.execute(get);
			if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
				JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

				System.out.println(json);
			}

			get.releaseConnection();
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			try {
				if (res != null) {
					res.close();
				}
				if (client != null) {
					client.close();
				}
			} catch (Exception ex) {
				ex.printStackTrace();
			}
		}

​ 4、Response Sample

{
    "data": {
        "maintap": [
            {
                "useAccess": false,
                "virDeptId": 0,
                "accDesc_ccn": "",
                "installNo": 0,
                "expiredDate": -2209017600000,
                "AI1": 0,
                "AI2": 0,
                "sysJson": "",
                "AI3": 0,
                "AI4": 0,
                "viewCode": "pi",
                "accDesc": "",
                "AI5": 0,
                "AI6": 0,
                "AI7": 0,
                "AI8": 0,
                "AI9": 0,
                "useAccessBl": false,
                "id": 962,
                "position_ctw": "",
                "lastModifyDate": 1648456295000,
                "createUid": 11,
                "accDesc_ctw": "",
                "method": "cod",
                "acCompletedDate": -2209017600000,
                "completed": false,
                "freeQtyPer": 0,
                "descOrigin": "VENREF",
                "i18nField": "{\"accDesc_zh-CN\": \"\", \"position_zh-CN\": \"\"}",
                "dayOfMonth": 0,
                "accDesc_en": "",
                "manId": 0,
                "multiFlowSrcId": 0,
                "flowTypeId": 1356,
                "status": "Y",
                "weightUnit": "kg",
                "multiFlowFlowId": 0,
                "cnDeptId": 0,
                "jlTypeId": 0,
                "iRev": 1,
                "upOrigin": "POLAST",
                "aInvMonth": 0,
                "AI19": 0,
                "ce01Module": "pi",
                "AI17": 0,
                "AI18": 0,
                "AI15": 0,
                "AI16": 0,
                "AI13": 0,
                "AI14": 0,
                "AI11": 0,
                "AI12": 0,
                "AI10": 0,
                "statusModifyDate": 1648456295000,
                "locId": 0,
                "createDate": 1648456295000,
                "loadNeed": true,
                "cp": 0,
                "useAccessWl": false,
                "AI28": 0,
                "AI29": 0,
                "AI26": 0,
                "AI27": 0,
                "AI24": 0,
                "AI25": 0,
                "AI22": 0,
                "multiFlowSrcBeId": 0,
                "AI23": 0,
                "position_haha1": "",
                "AI20": 0,
                "AI21": 0,
                "useAccessAutoCalc": false,
                "domAmtDiff": 0,
                "cpDate": 1648396800000,
                "lastModifyUid": 11,
                "position_zh-CN": "",
                "accDesc_haha1": "",
                "eDiscRate": 0,
                "beId": 11,
                "comRate": 0,
                "AI30": 0,
                "locked": false,
                "showEarlyPayDisc": false,
                "fromModule": "",
                "rev": "1",
                "batchNo": "",
                "lastApproveUid": 11,
                "ttlCharge": 0,
                "acCompleted": false,
                "expiredUid": 0,
                "completedDate": -2209017600000,
                "position_en": "",
                "position_zh-TW": "",
                "venId": 108,
                "monthEndDate": 0,
                "ttlAmt": 10,
                "position": "",
                "venInvNo": "",
                "hpSetting": "dayAfterInv",
                "tDate": 1648396800000,
                "code": "ITPI220328A",
                "multiFlowSrcModule": "",
                "amt": 10,
                "accDesc_zh-TW": "",
                "depoAmt": 0,
                "curId": 1,
                "expired": false,
                "rate": 1,
                "domAmt": 10,
                "measUnit": "cbm",
                "printCount": 0,
                "domDepoAmt": 0,
                "accDesc_zh-CN": "",
                "loadGpCoData": false,
                "position_ccn": "",
                "ttlDisc": 0,
                "attachmentCount": 0,
                "staffId": 723
            }
        ],
        "remtap": [
            {
                "tradeTerm_ccn": "",
                "tradeTerm_en": "",
                "shipMark": "",
                "heading_en": "",
                "shipMark_zh-CN": "",
                "tradeTerm_zh-CN": "",
                "shipMark_ctw": "",
                "remarks_en": "",
                "payTerm_en": "",
                "iRev": 1,
                "heading_zh-CN": "",
                "ce01Module": "pi",
                "tradeTerm": "",
                "heading_ccn": "",
                "payTerm_haha1": "",
                "payTerm_zh-TW": "",
                "remarks_haha1": "",
                "shipMark_en": "",
                "id": 962,
                "remarks_zh-TW": "",
                "particular_ccn": "",
                "hId": 962,
                "heading_haha1": "",
                "payTerm": "",
                "particular_en": "",
                "heading_zh-TW": "",
                "payTerm_ccn": "",
                "heading": "",
                "particular_haha1": "",
                "remarks_ccn": "",
                "particular_zh-TW": "",
                "heading_ctw": "",
                "tradeTerm_ctw": "",
                "particular": "",
                "tradeTerm_zh-TW": "",
                "shipMark_ccn": "",
                "tradeTerm_haha1": "",
                "particular_zh-CN": "",
                "i18nField": "{\"heading_zh-CN\": \"\", \"payTerm_zh-CN\": \"\", \"remarks_zh-CN\": \"\", \"shipMark_zh-CN\": \"\", \"tradeTerm_zh-CN\": \"\", \"particular_zh-CN\": \"\"}",
                "remarks_zh-CN": "",
                "particular_ctw": "",
                "shipMark_haha1": "",
                "payTerm_zh-CN": "",
                "payTerm_ctw": "",
                "shipMark_zh-TW": "",
                "remarks": "",
                "remarks_ctw": ""
            }
        ],
        "apt": [
            {
                "unit2Id": 40,
                "qty2": 0,
                "AI1": 0,
                "AI2": 0,
                "AI3": 0,
                "AI4": 0,
                "AI5": 0,
                "qty1": 1,
                "AI6": 0,
                "AI7": 0,
                "AI8": 0,
                "AI9": 0,
                "bDesc_zh-TW": "",
                "newLotno": 0,
                "id": 1431,
                "ctn": 0,
                "dDesc_haha1": "",
                "height": 0,
                "perCtn": 0,
                "completed": false,
                "freeQtyPer": 0,
                "passQty": 0,
                "i18nField": "{\"bDesc_zh-CN\": \"\", \"dDesc_zh-CN\": \"\"}",
                "sourceType": "pro",
                "asnLot": "",
                "asnId": 0,
                "packingDesc": "",
                "innerQty": 0,
                "costAmt": 0,
                "iRev": 1,
                "poId": 0,
                "AI19": 0,
                "bDesc_ctw": "",
                "ce01Module": "pi",
                "lot": "A",
                "AI17": 0,
                "AI18": 0,
                "AI15": 0,
                "AI16": 0,
                "AI13": 0,
                "reShipType": "asi",
                "AI14": 0,
                "AI11": 0,
                "bDesc_ccn": "",
                "AI12": 0,
                "unitId": 40,
                "AI10": 0,
                "locId": 0,
                "bDesc_en": "",
                "scrapQty": 0,
                "sourceCliId": 0,
                "AI28": 0,
                "AI29": 0,
                "AI26": 0,
                "AI27": 0,
                "AI24": 0,
                "AI25": 0,
                "AI22": 0,
                "AI23": 0,
                "width": 0,
                "AI20": 0,
                "AI21": 0,
                "bDesc_zh-CN": "",
                "sourceId": 0,
                "scrapQty2": 0,
                "scrapQty1": 0,
                "dualQty": 0,
                "itemNo": "     1",
                "venDnNo": "",
                "poLot": "",
                "beId": 11,
                "passQty1": 0,
                "passQty2": 0,
                "bDesc": "",
                "up": 10,
                "AI30": 0,
                "isInventory": false,
                "hId": 962,
                "reDeliveryId": 0,
                "volume": 0,
                "dDesc": "",
                "footerKey": "",
                "qty": 1,
                "invup": 10,
                "disc": 0,
                "refCode": "",
                "lotNoId": 0,
                "dDesc_ctw": "",
                "unit1Id": 40,
                "reDeliveryType": "",
                "amt": 10,
                "nw": 0,
                "dDesc_zh-CN": "",
                "qup": 0,
                "packingUnitId": 0,
                "bDesc_haha1": "",
                "reDeliveryLot": "",
                "dDesc_zh-TW": "",
                "domAmt": 10,
                "innerUnitId": 0,
                "dDesc_ccn": "",
                "reDelivery": false,
                "length": 0,
                "dDesc_en": "",
                "dualUnitId": 29,
                "gw": 0,
                "sourceLot": "",
                "proId": 26,
                "qcId": 0
            }
        ]
    },
    "messages": [],
    "status": true
}

# Create Purchase Invoice

# 一、Description

​ Usage: create or update 【Purchase Invoice】

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/root/api/save/pi
HTTP Method PUT
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
menuCode String(Query) Yes pi
param String(Query) No Extra Pamameters: in JSON format

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/root/api/save/pi";
		String param = "&menuCode=pi";

		HttpPut put = new HttpPut(url + "?" + param);
		put.addHeader("authorization", access_token);
		put.addHeader("client_id", ClientID);

		StringEntity entity = new StringEntity(data.toJSONString(), ContentType.APPLICATION_JSON);
		entity.setContentEncoding("UTF-8");
		put.setEntity(entity);

		res = client.execute(put);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

			if (json != null) {
				recordId = json.getLongValue("recordId");
			}

			System.out.println(json);
		}

		put.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}				

Entity data as JSON format:

{
    "maintap": {
        "values": [
            {
                "beId": 11,
                "code": "ITPI220328A",
                "venId": 108,
                "curId": 1,
                "rate": 1,
                "flowTypeId": 1356,
                "staffId": 723
            }
        ]
    },
    "apt": {
        "values": [
            {
                "sourceType": "pro",
                "proId": 26,
                "unitId": 40,
                "qty": 1,
                "up": 10,
                "amt": 10
            }
        ]
    }
}

​ 4、Response Sample

{
	"recordId": 962,
	"messages": [],
	"status": true
}
{
    "recordId": 0,
    "messages": [
        {
            "msgDetail": "Required field is empty",
            "msgCode": "core_101905"
        }
    ],
    "status": false
}

# Create Purchase Invoice (Auto Completion)

# 一、Description

​ 1. Usage: Create 【Purchase Invoice】

​ 2. This API has the following characteristics:

​ ​ a. Support using code instead of id field

​ ​ b. If field currency has no value specified, the Entity Currency will be used automatically

​ ​ c. If field staff has no value specified, the default staff in the User Options will be used automatically

​ ​ d. If field document date has no value specified, the value is obtained according to the date option in the [Preference Setup (Trade)]

​ ​ e. If field business process has no value specified, according to the default value set in [Business Process Setup (Trade)]

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/erp/bsFlow/save/pi
HTTP Method POST
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/erp/bsFlow/save/pi";

		HttpPost post = new HttpPost(url);
		post.addHeader("authorization", access_token);
		post.addHeader("client_id", ClientID);

		StringEntity entity = new StringEntity(data.toJSONString(), ContentType.APPLICATION_JSON);
		entity.setContentEncoding("UTF-8");
		post.setEntity(entity);

		res = client.execute(post);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

			if (json != null) {
				recordId = json.getLongValue("tranId");
			}
			System.out.println(json);
		}

		post.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

Sample data

{
    "beCode": "IT",
    "venCode": "VIT001",
    "apt": [
        {
            "proCode": "ITPRO002",
            "unitCode": "PCS",
            "qty": 1
        }
    ]
}

​ 4、Response Sample

{
  "tranId": 963,
  "tranCode": "PI0220206",
  "message": "",
  "status": true
}

# Delete Purchase Invoice

# 一、Description

​ Usage: Delete Purchase Invoice

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/root/api/delete/pi
HTTP Method DELETE
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
menuCode String(Query) Yes pi
id long(Query) Yes Purchase Invoice ID
param String(Query) No Extra Pamameters: in JSON format

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/root/api/delete/pi";
		String param = "&menuCode=pi&id=" + id;

		HttpDelete delete = new HttpDelete(url + "?" + param);
		delete.addHeader("authorization", access_token);
		delete.addHeader("client_id", ClientID);

		res = client.execute(delete);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

			System.out.println(json);
		}

		delete.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

​ 4、Response Sample

{
	"messages": [],
	"status": true
}
{
    "messages": [
        {
            "msgDetail": "Record has been deleted",
            "msgCode": "core_101017"
        }
    ],
    "status": false
}

# Load EBI data:Purchase Invoice List

# 一、Description

​ Usage: Run EBI[Purchase Invoice List],return EBI data

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/ebiWidget/loadReport
HTTP Method GET
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
formatId long(Query) Yes Format ID fetched from another API
beId long(Query) No Business Entity ID,If not specified, query all authorized Business Entity data.
offset int(Query) No Resultset offset : start index
rows int(Query) No Resultset offset : end index

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/ebiWidget/loadReport";
		String param = "&formatId=" + formatId;

		HttpGet get = new HttpGet(url + "?" + param);
		get.addHeader("authorization", access_token);
		get.addHeader("client_id", ClientID);
		res = client.execute(get);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

			System.out.println(json);
		}

		get.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}				

​ 4、Response Sample

{
    "size": 6,
    "rows": [
        {
            "M_A_code": "ITPI17060001",
            "M_A_ttlAmt": "500.00",
            "M_A_amt": "490.00",
            "M_A_id": "60",
            "M_A_rate": "1.00000000",
            "M18ReservedCol_dataIndex": 1,
            "VEN_A_code": "V0001",
            "M_A_curId_code": "R",
            "M_A_depoAmt": "0.00",
            "M_A_tDate": "2017.06.23",
            "M_A_curId": "1",
            "VEN_A_id": "1"
        }
    ]
}

ebi1

# Load EBI data:Purchase Invoice Report

# 一、Description

​ Usage: Run EBI[Purchase Invoice Report],return EBI data

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/ebiWidget/loadReport
HTTP Method GET
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
formatId long(Query) Yes Format ID fetched from another API
beId long(Query) No Business Entity ID,If not specified, query all authorized Business Entity data.
offset int(Query) No Resultset offset : start index
rows int(Query) No Resultset offset : end index

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/ebiWidget/loadReport";
		String param = "&formatId=" + formatId;

		HttpGet get = new HttpGet(url + "?" + param);
		get.addHeader("authorization", access_token);
		get.addHeader("client_id", ClientID);
		res = client.execute(get);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

			System.out.println(json);
		}

		get.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}				

​ 4、Response Sample

{
    "size": 7,
    "rows": [
        {
            "APT_A_unitId_code": "PCS",
            "M_A_code": "ITPI17060001",
            "M_A_id": "60",
            "M18ReservedCol_dataIndex": 1,
            "APT_A_amt": "500.00",
            "APT_A_qty": "5.0000",
            "M_A_tDate": "2017.06.23",
            "APT_A_up": "100.0000",
            "PRO_A_code": "ITPRO002",
            "PRO_A_id": "26"
        }
    ]
}

ebi2