首页 > API文档 > CRM
CRM基础接口V2
更新时间: 2021-05-20 09:52:00

CRM基础对象V2接口

目前支持回款、仓库、入库单、库存、发货单、信用等对象的数据接口。

1.新增对象数据

请求说明

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

参数说明

参数 参数类型 必须 备注
corpAccessToken String 企业应用访问公司合法性凭证
corpId String 企业ID
currentOpenUserId String 当前操作人OpenUserID
data Map 对象数据map
data.object_data Map 对象数据map(和对象描述中字段一一对应)
data.details Map 对象明细数据map(和对象描述中字段一一对应)

请求包结构体示例:

{
    "corpAccessToken": "CORP_ACCESS_TOKEN",
    "corpId": "CORP_ID",
    "currentOpenUserId": "FSUID_XXXXXX",
    "data": {
      "object_data": {
          "dataObjectApiName":"PaymentObj",
        "record_type": "default__c",
        "account_id": "2d58af2dbb4d4ecd931e80ef18xxxxxx",
        "payment_amount": 1,
        "payment_time": 1517328000000,
        "payment_term": "post",
        "notification_time": 1516982400000,
        "owner": [
          "FSUID_7B8A3925E40FA68630C0D7E9C3XXXXXX"
        ],
        "attachment": [],
        "remark": "002测试"
      },
      "details": {
        "OrderPaymentObj": [
          {
            "order_id": "974789b4d13040fcbb9d0ae35cxxxxxx",
            "payment_amount": "1",
            "attachment": [],
            "remark": "1111",
            "record_type": "default__c"
          }
        ]
      }
    }
}

{
    "corpAccessToken": "CORP_ACCESS_TOKEN",
    "corpId": "CORP_ID",
    "currentOpenUserId": "FSUID_XXXXXX",
    "data": {
        "object_data": {
            "dataObjectApiName": "GoodsReceivedNoteObj",
            "goods_received_date": 1520438400000,
            "warehouse_id": "5ab9e468830bdbc390daebb7",
            "goods_received_type": "1",
            "remark": "openapi测试add",
            "owner": [
                "FSUID_XXXXXX"
            ]
    },
    "details": {
        "GoodsReceivedNoteProductObj": [
            {
                "product_id": "a86b57c8065140d1ae2922679603ebe5",
                "unit": "只",
                "goods_received_amount": "10009",
                "object_describe_api_name": "GoodsReceivedNoteProductObj"
            },
            {
                "product_id": "c8658c7ac31a4686904bb38752640281",
                "goods_received_amount": "856325",
                "remark": "OpenApi test",
                "object_describe_api_name": "GoodsReceivedNoteProductObj"

            }
        ]
    }
  }
}

返回说明

参数 必须 说明
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/v2/data/update
请求方式:post+application/json 方式

参数说明

参数 参数类型 必须 备注
corpAccessToken String 企业应用访问公司合法性凭证
corpId String 企业ID
currentOpenUserId String 当前操作人OpenUserID
data Map 对象数据map
data.object_data Map 对象数据map(和对象描述中字段一一对应)
data.details Map 对象明细数据map(和对象描述中字段一一对应)

请求包结构体示例:

{
    "corpAccessToken": "CORP_ACCESS_TOKEN",
    "corpId": "CORP_ID",
    "currentOpenUserId": "FSUID_XXXXXX",
    "data":{
        "object_data":{
            "dataObjectApiName":"PaymentObj",
            "remark":"测试更新003",
            "_id":"5a9ce894f125ae9befxxxxxx",
            "record_type":"default__c",
            "object_describe_id":"5a61892fab18973f90xxxxxx",
            "account_id":"2d58af2dbb4d4ecd931e80ef18xxxxxx",
            "payment_time":1517328000000,
            "payment_term":"2",
            "notification_time":1517241600000,
            "attachment":[

            ],
            "version":"2"
        },
        "details":{
            "OrderPaymentObj":[
                {
                    "version":"1",
                    "_id":"5a65ca1396a74c1a3bxxxxxx",
                    "order_id":"974789b4d13040fcbb9d0ae35cxxxxxx",
                    "payment_amount":"200.00",
                    "object_describe_api_name":"OrderPaymentObj",
                    "record_type":"default__c"
                },
                {
                    "version":"1",
                    "_id":"5a65ca1396a74c1a3bxxxxxx",
                    "order_id":"974789b4d13040fcbb9d0ae35cxxxxxx",
                    "payment_amount":"100.00",
                    "object_describe_api_name":"OrderPaymentObj",
                    "record_type":"default__c"
                }
            ]
        }
    }
}

{
    "corpAccessToken": "CORP_ACCESS_TOKEN",
    "corpId": "CORP_ID",
    "currentOpenUserId": "FSUID_XXXXXX",
    "data": {
    "object_data": {
        "dataObjectApiName": "GoodsReceivedNoteObj",
        "_id": "5ac1e101830bdb5f9feb192f",
        "remark": "openapi测试update2",
        "owner": [
            "FSUID_XXXXXX"
        ]
    },
    "details": {
         "GoodsReceivedNoteProductObj": [
            {
                "_id": "5ac1e102830bdb5f9feb1934"

            }
        ]
    }
  }
}

返回说明

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

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

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

b)错误的Json返回示例:

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

3.查询对象数据

请求说明

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

参数说明

参数 参数类型 必须 备注
corpAccessToken String 企业应用访问公司合法性凭证
corpId String 企业ID
currentOpenUserId String 当前操作人OpenUserID
data 二级对象 查询条件
data.dataObjectApiName String 对象的api_name
data.search_query_info 三级对象 查询条件列表
data.search_query_info.limit int 获取数据条数,默认20,最大值为1000(自定义对象最大值为100)
data.search_query_info.offset int 偏移量,从0开始、数值必须为limit的整数倍
data.search_query_info.filters List 过滤条件列表
data.search_query_info.filters.field_name String 字段名
data.search_query_info.filters.field_values List 取值范围
data.search_query_info.filters.operator String 支持操作
data.search_query_info.orders List 排序
data.search_query_info.orders.fieldName String 字段名
data.search_query_info.orders.isAsc boolean 如果是ture,按照升序排列,如果是false,则按照倒序排列
data.search_query_info.fieldProjection
 List 返回字段列表

operator参数说明

参数 参数含义 参数 参数含义
EQ = GT >
LT GTE >=
LTE N
LIKE LIKE NLIKE NOT LIKE
IS IS ISN IS NOT
IN IN NIN NOT IN
BETWEEN BETWEEN NBETWEEN NOT BETWEEN
STARTWITH LIKE% ENDWITH %LIKE
NEXISTS NOT EXISTS EXISTS EXISTS
CONTAINS Array 包含

请求包结构体示例:

{
    "corpAccessToken": "CORP_ACCESS_TOKEN",
    "corpId": "CORP_ID",
    "currentOpenUserId": "FSUID_XXXXXX",
    "data": {
        "dataObjectApiName": "PaymentObj",
        "search_query_info": {
            "limit": 5,
            "offset": 0,
            "filters": [
                {
                    "field_name": "owner",
                    "field_values": [
                        "FSUID_7B8A3925E40FA68630C0D7E9C3XXXXXX"
                    ],
                    "operator": "IN"
                }
            ],
            "orders": [
                {
                    "fieldName": "payment_amount",
                    "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": 4,
        "offset": 0,
        "dataList": [
            {
                "payment_time": 1517328000000,
                "remark": "测试更新02",
                "account_id__r": "测试",
                "is_deleted": false,
                "attachment": [],
                "order_data_id": "974789b4d13040fcbb9d0ae35cxxxxxx",
                "total_num": 4,
                "owner_department": "董事会",
                "owner": [
                   "FSUID_0253C6D7FC0E3A2CBB19F336CEXXXXXX"
                ],
                "lock_status": "0",
                "last_modified_time": 1519986766107,
                "create_time": 1519985373616,
                "payment_term": "2",
                "life_status": "normal",
                "payment_amount": "300.00",
                "last_modified_by": [
                   "FSUID_0253C6D7FC0E3A2CBB19F336CEXXXXXX"
                 ],
                "created_by": [
                   "FSUID_7B8A3925E40FA68630C0D7E9C3XXXXXX"
                ],
                "record_type": "default__c",
                "notification_time": 1517241600000,
                "account_id": "2d58af2dbb4d4ecd931e80ef18xxxxxx",
                "name": "20180302-000004",
                "_id": "5a9922dd742c2ff572xxxxxx",
                "order_id": "20180302-000002"
            },
            {
                "payment_time": 1521561600000,
                "account_id__r": "测试",
                "is_deleted": true,
                "attachment": [],
                "order_data_id": "974789b4d13040fcbb9d0ae35cxxxxxx,cff4ca67f38c49639df64f50d3xxxxxx",
                "total_num": 4,
                "owner_department": "董事会",
                "owner": [
                   "FSUID_7B8A3925E40FA68630C0D7E9C3XXXXXX"
                ],
                "lock_status": "0",
                "last_modified_time": 1519984004508,
                "create_time": 1519978401106,
                "life_status": "invalid",
                "payment_amount": "20.00",
                "last_modified_by": [
                   "FSUID_0253C6D7FC0E3A2CBB19F336CEXXXXXX"
                ],
                "created_by": [
                   "FSUID_7B8A3925E40FA68630C0D7E9C3XXXXXX"
                ],
                "record_type": "default__c",
                "account_id": "2d58af2dbb4d4ecd931e80ef18xxxxxx",
                "name": "20180302-000002",
                "_id": "5a9907a1f125ae0a1axxxxxx",
                "order_id": "20180302-000002,20180302-000001"
            }
        ],
        "limit": 5
    },
    "errorCode": 0,
    "errorMessage": "OK",
    "errorDescription": "success"
}

b)错误的Json返回示例:

{
    "errorCode": 10006,
    "errorMessage": "the parameter corpAccessToken is missing or illegal",
    "errorDescription": "缺少参数 或参数 不合法"
}

4.根据Id获取对象数据

请求说明

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

参数说明

参数 参数类型 必须 备注
corpAccessToken String 企业应用访问公司合法性凭证
corpId String 企业ID
currentOpenUserId String 当前操作人OpenUserID
data 二级对象
data.dataObjectApiName String 对象的api_name
data.objectDataId String 数据Id

请求包结构体示例:

{
    "corpAccessToken": "CORP_ACCESS_TOKEN",
    "corpId": "CORP_ID",
    "currentOpenUserId": "FSUID_xxxxxx",
    "data": {
      "objectDataId":"5a9907a1f125ae0a1axxxxxx",
      "dataObjectApiName":"PaymentObj"
    }
}

返回说明

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

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

{
    "data": {
        "payment_time": 1521561600000,
        "account_id__r": "测试",
        "is_deleted": true,
        "attachment": [],
        "order_data_id": "974789b4d13040fcbb9d0ae35cxxxxxx,cff4ca67f38c49639df64f50d3xxxxxx",
        "total_num": 1,
        "owner_department": "董事会",
        "details": {
            "OrderPaymentObj": [
                {
                    "describeId": {},
                    "describeApiName": "OrderPaymentObj",
                    "tenantId": "589979",
                    "package": "CRM",
                    "recordType": "default__c",
                    "name": "20180302-000004",
                    "createdBy": "FSUID_0253C6D7FC0E3A2CBB19F336CEXXXXXX",
                    "lastModifiedBy": "FSUID_7B8A3925E40FA68630C0D7E9C3XXXXXX",
                    "id": {},
                    "deleted": false,
                    "createTime": 1519978401439,
                    "version": 20,
                    "lastModifiedTime": 1519984003628,
                    "containerDocument": {
                        "payment_time": 1521561600000,
                        "remark": "1212",
                        "is_deleted": false,
                        "attachment": [],
                        "payment_id": "5a9907a1f125ae0a1axxxxxx",
                        "total_num": 2,
                        "owner_department": "董事会",
                        "owner": [
                            "FSUID_7B8A3925E40FA68630C0D7E9C3XXXXXX"
                        ],
                        "lock_status": "0",
                        "last_modified_time": 1519984003628,
                        "create_time": 1519978401439,
                        "life_status": "invalid",
                        "payment_amount": "10.00",
                        "last_modified_by": "FSUID_7B8A3925E40FA68630C0D7E9C3XXXXXX",
                        "created_by": "FSUID_0253C6D7FC0E3A2CBB19F336CEXXXXXX",
                        "record_type": "default__c",
                        "account_id": "2d58af2dbb4d4ecd931e80ef18xxxxxx",
                        "name": "20180302-000004",
                        "_id": "5a9907a1f125ae0a1axxxxxx",
                        "order_id": "974789b4d13040fcbb9d0ae35cxxxxxx"
                    }
                },
                {
                    "describeId": {},
                    "describeApiName": "OrderPaymentObj",
                    "tenantId": "589979",
                    "package": "CRM",
                    "recordType": "default__c",
                    "name": "20180302-000005",
                    "createdBy": "FSUID_0253C6D7FC0E3A2CBB19F336CEXXXXXX",
                    "lastModifiedBy": "FSUID_7B8A3925E40FA68630C0D7E9C3XXXXXX",
                    "id": {},
                    "deleted": false,
                    "createTime": 1519978401439,
                    "version": 20,
                    "lastModifiedTime": 1519984003637,
                    "containerDocument": {
                        "payment_time": 1521561600000,
                        "remark": "1212",
                        "is_deleted": false,
                        "attachment": [],
                        "payment_id": "5a9907a1f125ae0a1axxxxxx",
                        "total_num": 2,
                        "owner_department": "董事会",
                        "owner": [
                            "FSUID_7B8A3925E40FA68630C0D7E9C3XXXXXX"
                        ],
                        "lock_status": "0",
                        "last_modified_time": 1519984003637,
                        "create_time": 1519978401439,
                        "life_status": "invalid",
                        "payment_amount": "10.00",
                        "last_modified_by": "FSUID_7B8A3925E40FA68630C0D7E9C3XXXXXX",
                        "created_by": "FSUID_0253C6D7FC0E3A2CBB19F336CEXXXXXX",
                        "record_type": "default__c",
                        "account_id": "2d58af2dbb4d4ecd931e80ef18xxxxxx",
                        "name": "20180302-000005",
                        "_id": "5a9907a1f125ae0a1axxxxxx",
                        "order_id": "cff4ca67f38c49639df64f50d3xxxxxx"
                    }
                }
            ]
        },
        "owner": [
            "FSUID_7B8A3925E40FA68630C0D7E9C3XXXXXX"
        ],
        "lock_status": "0",
        "last_modified_time": 1519984004508,
        "create_time": 1519978401106,
        "life_status": "invalid",
        "payment_amount": "20.00",
        "last_modified_by": [
           "FSUID_0253C6D7FC0E3A2CBB19F336CEXXXXXX"
        ],
        "created_by": [
           "FSUID_7B8A3925E40FA68630C0D7E9C3XXXXXX"
        ],
        "record_type": "default__c",
        "relevant_team": [
            {
                "teamMemberEmployee": [
                    "FSUID_7B8A3925E40FA68630C0D7E9C3XXXXXX"
                ],
                "teamMemberRole": "1",
                "teamMemberPermissionType": "2"
            }
        ],
        "account_id": "2d58af2dbb4d4ecd931e80ef18xxxxxx",
        "name": "20180302-000002",
        "_id": "5a9907a1f125ae0a1axxxxxx",
        "order_id": "20180302-000002,20180302-000001"
    },
    "errorCode": 0,
    "errorMessage": "OK",
    "errorDescription": "success"
}

b)错误的Json返回示例:

{
    "errorCode": 10006,
    "errorMessage": "the parameter corpAccessToken is missing or illegal",
    "errorDescription": "缺少参数 或参数 不合法"
}

5.根据Id作废对象数据

请求说明

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

参数说明

参数 参数类型 必须 备注
corpAccessToken String 企业应用访问公司合法性凭证