首页 > API文档 > CRM
ERP集成接口
更新时间: 2021-12-08 11:29:02

ERP集成接口

目前支持ERP仓库、ERP库存等对象的数据接口。

1.新增对象数据

请求说明

请求路径:https://open.71360.com/cgi/crm/erp/data
请求方式:post+application/json 方式

参数说明

参数参数类型必须备注
corpAccessTokenString企业应用访问公司合法性凭证
corpIdString企业ID
currentOpenUserIdString当前操作人OpenUserID
dataMap对象数据map
data.object_dataMap对象数据map(和对象描述中字段一一对应)


请求包结构体示例:

{
    "corpAccessToken": "CORP_ACCESS_TOKEN",
    "corpId": "CORP_ID",
    "currentOpenUserId": "FSUID_XXXXXX",
    "data": {
        "object_data": {
          "dataObjectApiName": "ErpWarehouseObj",
            "name": "OpenAPI ERP仓库测试",
            "address": "大冲国际中心22楼",
            "remark": "OpenAPI ERP仓库测试",
            "owner": [
                "FSUID_XXXXXX"
            ]
        }
  }
}

{
    "corpAccessToken": "CORP_ACCESS_TOKEN",
    "corpId": "CORP_ID",
    "currentOpenUserId": "FSUID_XXXXXX",
    "data": {
        "object_data": {
            "dataObjectApiName": "ErpStockObj",
            "erp_warehouse_id": "5afbd4cafa1227058c9ca3e0",
            "product_id": "da8bd9a9cefd48279c84816112e665a0",
            "real_stock": "1000000",
            "available_stock": "9999999"
        }
    }
}

返回说明

参数必须说明
dataId添加成功的数据Id
errorCode返回码
errorMessage对返回码的文本描述内容
errorDescription对返回码的文本描述内容


a)正确的Json返回结果示例:

{
    "dataId": "5a9ce894f125ae9befxxxxxx",
    "errorCode": 0,
    "errorMessage": "OK",
    "errorDescription": "success"
}

b)错误的Json返回示例:

{
    "errorCode": 320002500,
    "errorMessage": "产品关联关系不存在"
}

2.更新对象数据

请求说明

请求路径:https://open.71360.com/cgi/crm/erp/data
请求方式:put+application/json 方式

参数说明

参数参数类型必须备注
corpAccessTokenString企业应用访问公司合法性凭证
corpIdString企业ID
currentOpenUserIdString当前操作人OpenUserID
dataMap对象数据map
data.object_dataMap对象数据map(和对象描述中字段一一对应)


请求包结构体示例:

{
    "corpAccessToken": "CORP_ACCESS_TOKEN",
    "corpId": "CORP_ID",
    "currentOpenUserId": "FSUID_XXXXXX",
    "data": {
        "object_data": {
            "dataObjectApiName": "ErpWarehouseObj",
            "_id": "5afa5827a66535b4fcc5ef59",
            "name":"OpenAPI ERP仓库测试",
            "remark": "OpenAPI ERP仓库测试",
            "owner": [
                "FSUID_XXXXXX"
            ]
        }
  }
}

{
    "corpAccessToken": "CORP_ACCESS_TOKEN",
    "corpId": "CORP_ID",
    "currentOpenUserId": "FSUID_XXXXXX",
    "data": {
        "object_data": {
            "dataObjectApiName": "ErpStockObj",
            "erp_warehouse_id": "5afa91cca66535b84fa7bbb7",
            "product_id": "5e4a78ee6283476c9cdefecc65c16767",
            "real_stock": "9500",
            "available_stock": "666666"
        }
     }
}

返回说明

参数必须说明
errorCode返回码
errorMessage对返回码的文本描述内容


a)正确的Json返回结果示例:

{
    "errorCode": 0,
    "errorMessage": "success"
}

b)错误的Json返回示例:

{
    "errorCode": 20016,
    "errorMessage": "corpAccessToken error"
}

3.查询对象数据

请求说明

请求路径:https://open.71360.com/cgi/crm/erp/data/list
请求方式:post+application/json 方式

参数说明

参数参数类型必须备注
corpAccessTokenString企业应用访问公司合法性凭证
corpIdString企业ID
currentOpenUserIdString当前操作人OpenUserID
data二级对象查询条件
data.dataObjectApiNameString对象的api_name
data.search_template_idString
data.search_query_info三级对象查询条件列表
data.search_query_info.limitint获取数据条数,默认20,最大值为1000(自定义对象最大值为100)
data.search_query_info.offsetint偏移量,从0开始、数值必须为limit的整数倍
data.search_query_info.filtersList过滤条件列表
data.search_query_info.filters.field_nameString字段名
data.search_query_info.filters.field_valuesList取值范围
data.search_query_info.filters.operatorString支持操作
data.search_query_info.ordersList排序
data.search_query_info.orders.fieldNameString字段名
data.search_query_info.orders.isAscboolean如果是ture,按照升序排列,如果是false,则按照倒序排列
data.search_query_info.fieldProjectionList返回字段列表


operator参数说明

参数参数含义参数参数含义
EQ=GT>
LT<GTE>=
LTE<=N<>
LIKELIKENLIKENOT LIKE
ISISISNIS NOT
ININNINNOT IN
BETWEENBETWEENNBETWEENNOT BETWEEN
STARTWITHLIKE%ENDWITH%LIKE
NEXISTSNOT EXISTSEXISTSEXISTS
CONTAINSArray 包含


请求包结构体示例:

{
    "corpAccessToken": "CORP_ACCESS_TOKEN",
    "corpId": "CORP_ID",
    "currentOpenUserId": "FSUID_XXXXXX",
    "data": {
        "dataObjectApiName": "ErpStockObj",
        "search_template_id": "",
        "search_query_info": {
            "limit": 5,
            "offset": 0,
            "filters": [
                {
                    "field_name": "owner",
                    "field_values": [
                        "FSUID_7B8A3925E40FA68630C0D7E9C3XXXXXX"
                    ],
                    "operator": "IN"
                }
            ],
            "orders": [
                {
                    "fieldName": "create_time",
                    "isAsc": false
                }
            ],
            "fieldProjection":["_id","name"]
        }
    }
}

返回说明

参数必须说明
data查询结果
data.total总记录数
data.offset获取数据条数,默认20,最大值为1000(自定义对象最大值为100)
data.limit偏移量,从0开始、数值必须为limit的整数倍
data.dataList数据列表
errorCode返回码
errorMessage对返回码的文本描述内容
errorDescription对返回码的文本描述内容


a)正确的Json返回结果示例:

{
    "data": {
        "total": 6,
        "offset": 0,
        "dataList": [
            {
                "product_status": "已上架",
                "row_num": 1,
                "product_id__r": "iphone",
                "erp_warehouse_id__r": "OpenAPI ERP仓库测试",
                "specs": "",
                "is_deleted": false,
                "created_by__r": {
                    "post": "",
                    "name": "chenzs",
                    "id": "1000",
                    "email": ""
                },
                "total_num": 6,
                "product_id": "5e4a78ee6283476c9cdefecc65c16767",
                "is_give_away": "",
                "owner__r": {
                    "post": "",
                    "name": "chenzs",
                    "id": "1000",
                    "email": ""
                },
                "owner": [
                    "FSUID_7B8A3925E40FA68630C0D7E9C3XXXXXX"
                ],
                "erp_warehouse_id": "5afa91cca66535b84fa7bbb7",
                "lock_status": "0",
                "last_modified_time": 1526523242072,
                "create_time": 1526523054023,
                "life_status": "normal",
                "last_modified_by": [
                   "FSUID_7B8A3925E40FA68630C0D7E9C3XXXXXX"
                ],
                "created_by": [
                   "FSUID_7B8A3925E40FA68630C0D7E9C3XXXXXX"
                ],
                "record_type": "default__c",
                "last_modified_by__r": {
                    "post": "",
                    "name": "chenzs",
                    "id": "1000",
                    "email": ""
                },
                "unit": "个",
                "name": "SK2018-05-17_9",
                "real_stock": "99999999.0000000001",
                "_id": "5afce4aefa12273c88c7d0b3",
                "category": "数码产品",
                "available_stock": "0.0000000000"
            },
            {
                "product_status": "已上架",
                "row_num": 2,
                "product_id__r": "mac",
                "erp_warehouse_id__r": "OpenAPI ERP仓库测试",
                "specs": "",
                "is_deleted": false,
                "created_by__r": {
                    "post": "",
                    "name": "chenzs",
                    "id": "1000",
                    "email": ""
                },
                "total_num": 6,
                "product_id": "da8bd9a9cefd48279c84816112e665a0",
                "is_give_away": "",
                "owner__r": {
                    "post": "",
                    "name": "chenzs",
                    "id": "1000",
                    "email": ""
                },
                "owner": [
                    "FSUID_7B8A3925E40FA68630C0D7E9C3XXXXXX"
                ],
                "erp_warehouse_id": "5afbd4cafa1227058c9ca3e0",
                "lock_status": "0",
                "last_modified_time": 1526453496559,
                "create_time": 1526453496559,
                "life_status": "normal",
                "last_modified_by": [
                    "FSUID_7B8A3925E40FA68630C0D7E9C3XXXXXX"
                ],
                "created_by": [
                    "FSUID_7B8A3925E40FA68630C0D7E9C3XXXXXX"
                ],
                "record_type": "default__c",
                "last_modified_by__r": {
                    "post": "",
                    "name": "chenzs",
                    "id": "1000",
                    "email": ""
                },
                "unit": "个",
                "name": "SK2018-05-16_8",
                "real_stock": "1000000.0000000000",
                "_id": "5afbd4f8fa1227058c9ca3e4",
                "category": "数码产品",
                "available_stock": "9999999.0000000000"
            },
            {
                "product_status": "已上架",
                "row_num": 3,
                "product_id__r": "mac",
                "erp_warehouse_id__r": "ERP仓库测试",
                "specs": "",
                "is_deleted": true,
                "created_by__r": {
                    "post": "",
                    "name": "chenzs",
                    "id": "1000",
                    "email": ""
                },
                "life_status_before_invalid": "normal",
                "total_num": 6,
                "product_id": "da8bd9a9cefd48279c84816112e665a0",
                "is_give_away": "",
                "owner__r": {
                    "post": "",
                    "name": "chenzs",
                    "id": "1000",
                    "email": ""
                },
                "owner": [
                    "FSUID_7B8A3925E40FA68630C0D7E9C3XXXXXX"
                ],
                "erp_warehouse_id": "5afa57f4a66535b4fcc5ef55",
                "lock_status": "0",
                "last_modified_time": 1526455862786,
                "create_time": 1526453008661,
                "life_status": "invalid",
                "last_modified_by": [
                    "FSUID_7B8A3925E40FA68630C0D7E9C3XXXXXX"
                ],
                "created_by": [
                    "FSUID_7B8A3925E40FA68630C0D7E9C3XXXXXX"
                ],
                "record_type": "default__c",
                "last_modified_by__r": {
                    "post": "",
                    "name": "chenzs",
                    "id": "1000",
                    "email": ""
                },
                "unit": "个",
                "name": "SK2018-05-16_7",
                "real_stock": "1000000.0000000000",
                "_id": "5afbd310fa1227058c9ca3da",
                "category": "数码产品",
                "available_stock": "9999999.0000000000"
            },
            {
                "product_status": "已上架",
                "row_num": 4,
                "product_id__r": "mac",
                "erp_warehouse_id__r": "OpenAPI ERP仓库测试",
                "specs": "",
                "is_deleted": false,
                "created_by__r": {
                    "post": "",
                    "name": "chenzs",
                    "id": "1000",
                    "email": ""
                },
                "total_num": 6,
                "product_id": "da8bd9a9cefd48279c84816112e665a0",
                "is_give_away": "",
                "owner__r": {
                    "post": "",
                    "name": "chenzs",
                    "id": "1000",
                    "email": ""
                },
                "owner": [
                    "FSUID_7B8A3925E40FA68630C0D7E9C3XXXXXX"
                ],
                "erp_warehouse_id": "5afa91d0a66535b84fa7bbbb",
                "lock_status": "0",
                "last_modified_time": 1526453828086,
                "create_time": 1526452584686,
                "life_status": "normal",
                "last_modified_by": [
                    "FSUID_7B8A3925E40FA68630C0D7E9C3XXXXXX"
                ],
                "created_by": [
                    "FSUID_7B8A3925E40FA68630C0D7E9C3XXXXXX"
                ],
                "record_type": "default__c",
                "last_modified_by__r": {
                    "post": "",
                    "name": "chenzs",
                    "id": "1000",
                    "email": ""
                },
                "unit": "个",
                "name": "SK2018-05-16_6",
                "real_stock": "6500.0000000000",
                "_id": "5afbd168fa1227058c9ca3d4",
                "category": "数码产品",
                "available_stock": "600000.0000000000"
            },
            {
                "product_status": "已上架",
                "row_num": 5,
                "product_id__r": "iphone",
                "erp_warehouse_id__r": "OpenAPI ERP仓库测试",
                "specs": "",
                "is_deleted": false,
                "created_by__r": {
                    "post": "",
                    "name": "chenzs",
                    "id": "1000",
                    "email": ""
                },
                "total_num": 6,
                "product_id": "5e4a78ee6283476c9cdefecc65c16767",
                "is_give_away": "",
                "owner_department": "a",
                "owner__r": {
                    "post": "",
                    "name": "liqiulin",
                    "id": "1001",
                    "email": ""
                },
                "owner": [
                    "FSUID_6DC3C1AB6064160A65D30FA9AD0CBD2D"
                ],
                "erp_warehouse_id": "5afa91d0a66535b84fa7bbbb",
                "lock_status": "0",
                "last_modified_time": 1526452348552,
                "create_time": 1526452348552,
                "life_status": "normal",
                "last_modified_by": [
                    "FSUID_7B8A3925E40FA68630C0D7E9C3XXXXXX"
                ],
                "created_by": [
                    "FSUID_7B8A3925E40FA68630C0D7E9C3XXXXXX"
                ],
                "record_type": "default__c",
                "last_modified_by__r": {
                    "post": "",
                    "name": "chenzs",
                    "id": "1000",
                    "email": ""
                },
                "unit": "个",
                "name": "SK2018-05-16_5",
                "real_stock": "65.0000000000",
                "_id": "5afbd07cfa1227058c9ca3ce",
                "category": "数码产品",
                "available_stock": "60.0000000000"
            },
            {
                "product_status": "已上架",
                "row_num": 6,
                "product_id__r": "iphone",
                "erp_warehouse_id__r": "OpenAPI ERP仓库测试",
                "specs": "",
                "is_deleted": true,
                "created_by__r": {
                    "post": "",
                    "name": "chenzs",
                    "id": "1000",
                    "email": ""
                },
                "life_status_before_invalid": "normal",
                "total_num": 6,
                "product_id": "5e4a78ee6283476c9cdefecc65c16767",
                "is_give_away": "",
                "owner__r": {
                    "post": "",
                    "name": "chenzs",
                    "id": "1000",
                    "email": ""
                },
                "owner": [
                    "FSUID_FDF84639CBA36509A61AB2323A011F88"
                ],
                "erp_warehouse_id": "5afa91cca66535b84fa7bbb7",
                "lock_status": "0",
                "last_modified_time": 1526460000925,
                "create_time": 1526439280693,
                "life_status": "invalid",
                "last_modified_by": [
                    "FSUID_7B8A3925E40FA68630C0D7E9C3XXXXXX"
                ],
                "created_by": [
                    "FSUID_7B8A3925E40FA68630C0D7E9C3XXXXXX"
                ],
                "record_type": "default__c",
                "last_modified_by__r": {
                    "post": "",
                    "name": "chenzs",
                    "id": "1000",
                    "email": ""
                },
                "unit": "个",
                "name": "SK2018-05-16_4",
                "real_stock": "9500.0000000000",
                "_id": "5afb9d70fa1227058c9ca3c8",
                "category": "数码产品",
                "available_stock": "666666.0000000000"
            }
        ],
        "limit": 10
    },