获取批量写入任务明细

目的

用来获取之前执行的批量写入任务的详细信息。

请求 URL

https://www.zohoapis.com.cn/crm/bulk/v2/write/{job_id}

job_id - 批量写入任务的唯一ID。

请求方法

GET

范围

scope=ZohoCRM.bulk.CREATE
(或)
scope=ZohoCRM.bulk.ALL

响应结构

属性数据类型描述
status字符串指定批量写入任务的当前状态。例如:"status": "ADDED" 或 "IN PROGRESS" 或 "COMPLETED"。
character_encoding字符串指定批量写入任务的字符编码。系统自动检测字符编码。但是,如果指定,它将优先使用指定的值。
resource 显示属性JSON 对象包含有关所选模块、字段映射和用于此任务的文件ID的详细信息。

resource Properties

属性数据类型描述
status字符串指定该模块的批量写入任务的状态。例如:"status": "ADDED", "IN PROGRESS", "COMPLETED", "SKIPPED", 或 "FAILED"。
type字符串指定要导入的模块类型。这个值是data
module字符串指定导入模块的API名称
field_mappings 显示属性JSON 对象有关field_mappings JSON对象的信息,请参考field_mappings属性表。

field_mappings Properties

属性数据类型描述
api_name字符串指定要从模块导入字段的字段API名称
index整型映射到CRM模块的字段列索引。当您指定一个不存在的索引值时,系统会抛出一个错误。
find_by字符串指定模块中唯一字段或主字段(记录ID)的API名称。系统使用此字段API名称来查找CRM中的现有记录。
default_valueJSON 对象用默认值替换CSV文件中的任何部分或空文件列。
file 显示属性JSON 对象有关文件JSON对象的信息,请参考文件属性表。

file Properties

属性数据类型描述
status字符串指定该文件的批量写入任务的状态。例如:"status": "ADDED", "IN PROGRESS", "COMPLETED", "SKIPPED, 或 "FAILED"。
name字符串指定要下载的CSV文件的名称。
added_count整型指定添加或导入的记录数量。
skipped_count整型指定由于某些问题而跳过的记录数量。CSV文件中的Error列将详细说明为什么在导入期间跳过记录。
updated_count整型指定批量更新期间更新的记录数量
total_count整型指定在批量导入期间插入、更新或跳过的记录总数。
id整型指定批量写入任务的唯一标识符。
resultJSON 对象download_url:表示下载URL,您可以从该URL下载批量写入任务的结果(CSV文件)。
created_byJSON 对象指定发起批量读取任务的用户ID和名称。 示例 - "created_by": { "id": "1000000031045", "name": "Patricia Boyle" },
operation字符串指定执行的批量写入操作的类型。示例:"operation": "insert"。
created_timeISO8601指定初始化批量写入任务的时间段。
备注:

要了解更多关于批量编写入API限制的信息, 点击这里

示例请求


				curl "https://www.zohoapis.com.cn/crm/bulk/v2/write/"111111000002308098"
-X GET
-H "Authorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf"			

添加任务的示例响应


				{
  "status": "ADDED",
  "resource": [
    {
      "status": "INPROGRESS",
      "type": "data",
      "module": "Deals",
      "field_mappings": [
        {
          "api_name": "Deal_Name",
          "index": 1,
          "format": null,
          "find_by": null,
          "default_value": null
        },
        {
          "api_name": "Stage",
          "index": 132,
          "format": null,
          "find_by": null,
          "default_value": null
        }
      ],
      "file": {
        "status": "INPROGRESS"
      }
    }
  ],
  "id": "111111000002308098",
  "created_by": {
    "id": "111111000000035795",
    "name": "Patricia Boyle"
  },
  "operation": "insert",
  "created_time": "2019-01-30T02:21:32-12:00"
}			

进行中任务的示例响应


				{
  "status": "INPROGRESS",
  "character_encoding": "UTF-8",
  "resource": [
    {
      "status": "INPROGRESS",
      "type": "data",
      "module": "Deals",
      "field_mappings": [
        {
          "api_name": "Deal_Name",
          "index": 1,
          "format": null,
          "find_by": null,
          "default_value": null
        },
        {
          "api_name": "Stage",
          "index": 2,
          "format": null,
          "find_by": null,
          "default_value": null
        }
      ],
      "file": {
        "status": "INPROGRESS",
        "name": "Accounts.csv",
        "added_count": 0,
        "skipped_count": 100,
        "updated_count": 0,
        "total_count": 100
      }
    }
  ],
  "id": "111111000002308051",
  "created_by": {
    "id": "111111000000035795",
    "name": "Patricia Boyle"
  },
  "operation": "insert",
  "created_time": "2019-01-30T02:18:15-12:00"
}			

已完成任务的示例响应


				{
  "status": "COMPLETED",
  "character_encoding": "UTF-8",
  "resource": [
    {
      "status": "COMPLETED",
      "type": "data",
      "module": "Deals",
      "field_mappings": [
        {
          "api_name": "Deal_Name",
          "index": 1,
          "format": null,
          "find_by": null,
          "default_value": null
        },
        {
          "api_name": "Stage",
          "index": 2,
          "format": null,
          "find_by": null,
          "default_value": null
        }
      ],
      "file": {
        "status": "COMPLETED",
        "name": "Accounts.csv",
        "added_count": 0,
        "skipped_count": 100,
        "updated_count": 0,
        "total_count": 100
      }
    }
  ],
  "id": "111111000002308051",
  "result": {
    "download_url": "/v2/crm/org6196138/bulk-write/111111000002308051/111111000002308051.zip"
  },
  "created_by": {
    "id": "111111000000035795",
    "name": "Patricia Boyle"
  },
  "operation": "insert",
  "created_time": "2019-01-30T02:18:15-12:00"
}			

已失败任务的示例响应


				{
  "status": "FAILED",
  "resource": [
    {
      "status": "FAILED",
      "message": "File index not found. Stage - 132",
      "type": "data",
      "module": "Deals",
      "field_mappings": [
        {
          "api_name": "Deal_Name",
          "index": 1,
          "format": null,
          "find_by": null,
          "default_value": null
        },
        {
          "api_name": "Stage",
          "index": 132,
          "format": null,
          "find_by": null,
          "default_value": null
        }
      ],
      "file": {
        "status": "FAILED"
      }
    }
  ],
  "id": "111111000002308098",
  "created_by": {
    "id": "111111000000035795",
    "name": "Patricia Boyle"
  },
  "operation": "insert",
  "created_time": "2019-01-30T02:21:32-12:00"
}