Published at: 2025-10-30
API Development
1. Integration Platform: How to View / Generate APIs
</img>2. Integration Platform — Push
2.1 Create API
curl --location --request POST 'http://MyDoman/path/create' \
--header 'Content-Type: application/json' \
--header 'token: TOKEN' \
--data-raw '{
"objAPIName": "ERP-side object's APIName",
"masterFieldVal": {
"Key1": "value1",
"Key2": "value2",
"Key3": "value3"
},
"detailFieldVals": {
"detailApiName1": [
{
"Key4": "value4",
"Key5": "value5",
"Key6": "value6"
}
],
"detailApiName2": [
{
"Key4": "value7",
"Key5": "value8",
"Key6": "value9"
}
]
}
}'
{
"code": "error_code",
"message": "error_message",
"data": {
"masterDataId": "dataid",
"detailDataIds": {
"Key10": "value10",
"Key11": "value11",
"Key12": "value12"
}
}
}
2.2 Update API
curl --location --request POST 'http://MyDoman/path/update' \
--header 'Content-Type: application/json' \
--header 'token: TOKEN' \
--data-raw '{
"objAPIName": "ERP-side object's APIName",
"masterFieldVal": {
"Key1": "value1",
"Key2": "value2",
"Key3": "value3"
},
"detailFieldVals": {
"detailApiName1": [
{
"Key4": "value4",
"Key5": "value5",
"Key6": "value6"
}
],
"detailApiName2": [
{
"Key4": "value7",
"Key5": "value8",
"Key6": "value9"
}
]
}
}'
{
"code": "error_code",
"message": "error_message",
"data": {
"masterDataId": "dataid",
"detailDataIds": {
"Key10": "value10",
"Key11": "value11",
"Key12": "value12"
}
}
}
3. Integration Platform — Polling
3.1 Batch Query Request
{
"code": "error_code",
"message": "error_message",
"data": {
"totalNum": "total_records",
"dataList": [
{
"objAPIName": "ERP-side object's APIName",
"masterFieldVal": {
"Key1": "value1",
"Key2": "value2",
"Key3": "value3"
},
"detailFieldVals": {
"detailApiName1": [
{
"Key4": "value4",
"Key5": "value5",
"Key6": "value6"
}
],
"detailApiName2": [
{
"Key4": "value7",
"Key5": "value8",
"Key6": "value9"
}
]
}
}
]
}
}
3.2 Single-item Query Request
{
"code": "error_code",
"message": "error_message",
"data": {
"objAPIName": "ERP-side object's APIName",
"masterFieldVal": {
"Key10": "value10",
"Key11": "value11",
"Key12": "value12"
},
"detailFieldVals": {
"detailApiName1": [
{
"Key13": "value13",
"Key14": "value14",
"Key15": "value15"
}
],
"detailApiName2": [
{
"Key13": "value16",
"Key14": "value17",
"Key15": "value18"
}
]
}
}
}
4. Integration Platform — Receive (Passive)
4.1 Standard-format Push
| Field | Description |
| token | Request authentication string [contact ShareCRM development to obtain] |
| tenantId | ShareCRM tenant ei |
| dataCenterId | Not required for single company; required and must be provided for multi-ledger deployments |
| objectApiName | Actual ERP object name. Find it via Data Synchronization Settings → ERP Object Settings → ERP Object Code |
| version | v1 |
| operationType | 3 = voided/canceled. For other operations this header is not required. |
| id (lowercase id) | Indicates standard-format transmission. If id is non-empty, the platform treats the request as standard format. If id is empty, the platform applies custom adapter logic. Important: if id is non-empty but the body does not match the platform standard structure, parsing errors will occur. |
</img>
</img>{
"objAPIName": "ERP-side object's APIName",
"masterFieldVal": {
"Key1": "value1",
"Key2": "value2",
"Key3": "value3"
},
"detailFieldVals": {
"detailApiName1": [
{
"Key4": "value4",
"Key5": "value5",
"Key6": "value6"
}
],
"detailApiName2": [
{
"Key4": "value7",
"Key5": "value8",
"Key6": "value9"
}
]
}
}
{
"errCode": "s106240000",
"errMsg": "success"
}
4.2 Non-standard-format Push
| Field | Description |
| token | Request authentication string [contact ShareCRM development to obtain] |
| tenantId | ShareCRM tenant ei |
| dataCenterId | Not required for single company; required and must be provided for multi-ledger deployments |
| objectApiName | Actual ERP object name. Find it via Data Synchronization Settings → ERP Object Settings → ERP Object Code |
| version | v1 |
| operationType | 3 = voided/canceled. For other operations this header is not required. |
{
"errCode": "s106240000",
"errMsg": "success"
}
5. Data Mapping Table — Open API Capabilities
Map header=[:] // create header map
Map param1=["ployDetailId":"155bd981457343f291e0edc13776217f", // policy detail id; if the policy is deleted and recreated, update this value
"sourceObjectApiName":"AccountObj", // source object APIName; update if it changes
"destObjectApiName":"BD_Customer.BillHead", // destination object APIName (virtual); update if it changes
"sourceDataId":"sourceDataId123", // source object data id
"destDataId":"destDataId123666", // destination object data id
"sourceDataName":"sourceDataName3666", // source object's name property
"destDataName":"destDataName66", // destination object's name property
"remark":"remark1341"]; // remark
def result1=Fx.proxy.callAPI(“erp.syncData.createSyncDataMapping”,header,param1); // [false, HttpResult(statusCode=200, content={“errCode”:”s106240000”,”errMsg”:”success”}, bytes=null), ] s106240000 indicates success, others indicate failure log.info(result1)
// Update destination data id based on source data id Map param2=[“sourceObjectApiName”:”AccountObj”, “destObjectApiName”:”BD_Customer.BillHead”, “sourceDataId”:”sourceDataId123”, “destDataId”:”destDataId123666”] def result2=Fx.proxy.callAPI(“erp.syncData.updateSyncDataMapping”,header,param2); log.info(result2)
// Query whether source data ids have mapping Map param3=[“sourceObjectApiName”:”AccountObj”, “destObjectApiName”:”BD_Customer.BillHead”, “sourceDataId”:[“sourceDataId123”]] // list of sourceDataIds def result3=Fx.proxy.callAPI(“erp.syncData.getSyncDataMappingBySourceDataId”,header,param3); // Example return: {“data”:{“sourceDataId123”: {“sourceDataId”:”sourceDataId123”,”isCreated”:true,”destDataId”:”destDataId123666”,”sourceDataName”:”sourceDataName1233”,”updateTime”:1611047455451,”lastSyncStatus”:6,”destTenantId”:”81138”,”sourceObjectApiName”:”AccountObj”,”destObjectApiName”:”BD_Customer.BillHead”,”sourceTenantId”:”81138”,”id”:”aa46ed320312476485e932a1ca4b4263”,”lastSyncDataId”:”92c86fb175254e54b990bd86b6ce1145”,”status”:1}},”errCode”:”s106240000”,”errMsg”:”success”} // s106240000 indicates success. The data map keys are sourceDataIds, values are the mapping detail. log.info(result3)</code>
6. Custom Function: Create ERP Field Mapping Table
// channel valid values: ERP_K3CLOUD, ERP_SAP, ERP_U8, OA, STANDARD_CHANNEL
// "dataType":"employee" indicates the mapping entry is for a person
// dataCenterId is the data center id
// fsDataId is the CRM data id. For employees, this is the employee ID (not the CRM user object id).
// erpDataId is the ERP-side data id
// fsDataName is the CRM data name
// erpDataName is the ERP data name
Map data = [“dataCenterId”:”data_center_id”, “channel”:”ERP_K3CLOUD”,”dataType”:”employee”, “fsDataId”:”fsDataId”,”fsDataName”:”fsDataName”,”erpDataId”:”erpDataId”,”erpDataName”:”erpDataName”]; def ret = Fx.proxy.callAPI(“erp.syncData.createErpfieldmapping”, [:], data); Fx.log.info(“ret is : “+ret)</code>