⬇️客戶匯入排程
你可以透過指定存在的「客戶匯入範本」新增相關排程,排程將依據指定時間、檔案等資訊進行匯入。而同一時間為避免資料衝突,若有相同時段排程,將依據執行匯入。
Last updated
你可以透過指定存在的「客戶匯入範本」新增相關排程,排程將依據指定時間、檔案等資訊進行匯入。而同一時間為避免資料衝突,若有相同時段排程,將依據執行匯入。
Last updated
POST https://{API_HOST}/api/v1/entity-import-task
curl -X POST
'{"recipe_id":5,"has_header":0,"description":"test upload"}'
-H "Content-Type: application/json"
-F file=@/home/user/import.csv
"https://{API_HOST}/api/v1/entity-import-task"
{
"data": {
"id": 2,
"has_header": false,
"file": "entity-import/1615362223-import.csv",
"size": 50,
"total_amount": 3,
"description": "dddd",
"status": 2,
"current_sheet_index": 1,
"current_row_index": 3,
"job_turns": 1,
"executed_start_at": "2021-03-10 15:43:44",
"executed_end_at": "2021-03-10 15:43:44",
"recipe_id": 1,
"creater_id": 1,
"created_at": "2021-03-10 15:43:43",
"updated_at": "2021-03-10 15:43:44",
"error": null,
"restart_at": null,
"stop_at": null,
"recipe": {
"id": 1,
"name": "ccc",
"description": null,
"headers": [
{
"value": "contacts.first_name"
},
{
"value": "contacts.membership_no",
"text": "Customer Number"
},
{
"value": "phone_numbers.number",
"set_id": 1
},
{
"value": "email_contacts.address",
"set_id": 1
}
],
"unique_columns": [
"phone_numbers.number",
"email_contacts.address"
],
"creater_id": 1,
"created_at": "2021-03-10T07:38:52.000000Z",
"updated_at": "2021-05-19T12:18:49.000000Z",
"importable_type": "App\\Contact"
}
}
}
GET https://{API_HOST}/api/v1/entity-import-task
curl -X GET
-H "Content-Type: application/json"
"https://{API_HOST}/api/v1/entity-import-task?per_page=15&page=1"
"data": [
{
"id": 4,
"has_header": false,
"file": "entity-import/1621426602-import.csv",
"size": 49,
"total_amount": 1,
"description": "null",
"status": 2,
"current_sheet_index": 1,
"current_row_index": 1,
"job_turns": 1,
"executed_start_at": "2021-05-19 20:16:43",
"executed_end_at": "2021-05-19 20:16:44",
"recipe_id": 1,
"creater_id": 1,
"created_at": "2021-05-19 20:16:42",
"updated_at": "2021-05-19 20:16:44",
"error": null,
"restart_at": null,
"stop_at": null,
"recipe": {
"id": 1,
"name": "ccc",
"description": null,
"headers": [
{
"value": "contacts.first_name"
},
{
"value": "contacts.membership_no",
"text": "Customer Number"
},
{
"value": "phone_numbers.number",
"set_id": 1
},
{
"value": "email_contacts.address",
"set_id": 1
}
],
"unique_columns": [
"phone_numbers.number",
"email_contacts.address"
],
"creater_id": 1,
"created_at": "2021-03-10T07:38:52.000000Z",
"updated_at": "2021-05-19T12:18:49.000000Z",
"importable_type": "App\\Contact"
}
},
{
"id": 3,
"has_header": false,
"file": "entity-import/1621426576-import.csv",
"size": 49,
"total_amount": 1,
"description": "null",
"status": 2,
"current_sheet_index": 1,
"current_row_index": 1,
"job_turns": 1,
"executed_start_at": "2021-05-19 20:16:19",
"executed_end_at": "2021-05-19 20:16:19",
"recipe_id": 1,
"creater_id": 1,
"created_at": "2021-05-19 20:16:16",
"updated_at": "2021-05-19 20:16:19",
"error": null,
"restart_at": null,
"stop_at": null,
"recipe": {
"id": 1,
"name": "ccc",
"description": null,
"headers": [
{
"value": "contacts.first_name"
},
{
"value": "contacts.membership_no",
"text": "Customer Number"
},
{
"value": "phone_numbers.number",
"set_id": 1
},
{
"value": "email_contacts.address",
"set_id": 1
}
],
"unique_columns": [
"phone_numbers.number",
"email_contacts.address"
],
"creater_id": 1,
"created_at": "2021-03-10T07:38:52.000000Z",
"updated_at": "2021-05-19T12:18:49.000000Z",
"importable_type": "App\\Contact"
}
},
{
"id": 2,
"has_header": false,
"file": "entity-import/1615362223-import.csv",
"size": 50,
"total_amount": 3,
"description": "dddd",
"status": 2,
"current_sheet_index": 1,
"current_row_index": 3,
"job_turns": 1,
"executed_start_at": "2021-03-10 15:43:44",
"executed_end_at": "2021-03-10 15:43:44",
"recipe_id": 1,
"creater_id": 1,
"created_at": "2021-03-10 15:43:43",
"updated_at": "2021-03-10 15:43:44",
"error": null,
"restart_at": null,
"stop_at": null,
"recipe": {
"id": 1,
"name": "ccc",
"description": null,
"headers": [
{
"value": "contacts.first_name"
},
{
"value": "contacts.membership_no",
"text": "Customer Number"
},
{
"value": "phone_numbers.number",
"set_id": 1
},
{
"value": "email_contacts.address",
"set_id": 1
}
],
"unique_columns": [
"phone_numbers.number",
"email_contacts.address"
],
"creater_id": 1,
"created_at": "2021-03-10T07:38:52.000000Z",
"updated_at": "2021-05-19T12:18:49.000000Z",
"importable_type": "App\\Contact"
}
}
],
"meta": {
"current_page": 1,
"from": 1,
"last_page": 1,
"per_page": 15,
"to": 3,
"total": 3
}
}
GET https://{API_HOST}/api/v1/entity-import-task/{id}
curl -X GET
-H "Content-Type: application/json"
"https://{API_HOST}/api/v1//entity-import-task/{id}"
{
"data": {
"id": 2,
"has_header": false,
"file": "entity-import/1615362223-import.csv",
"size": 50,
"total_amount": 3,
"description": "dddd",
"status": 2,
"current_sheet_index": 1,
"current_row_index": 3,
"job_turns": 1,
"executed_start_at": "2021-03-10 15:43:44",
"executed_end_at": "2021-03-10 15:43:44",
"recipe_id": 1,
"creater_id": 1,
"created_at": "2021-03-10 15:43:43",
"updated_at": "2021-03-10 15:43:44",
"error": null,
"restart_at": null,
"stop_at": null,
"recipe": {
"id": 1,
"name": "ccc",
"description": null,
"headers": [
{
"value": "contacts.first_name"
},
{
"value": "contacts.membership_no",
"text": "Customer Number"
},
{
"value": "phone_numbers.number",
"set_id": 1
},
{
"value": "email_contacts.address",
"set_id": 1
}
],
"unique_columns": [
"phone_numbers.number",
"email_contacts.address"
],
"creater_id": 1,
"created_at": "2021-03-10T07:38:52.000000Z",
"updated_at": "2021-05-19T12:18:49.000000Z",
"importable_type": "App\\Contact"
}
}
}
你可以透過 API 查找排程符合的範本 ID,或是透過系統介面查詢相關資訊。
GET https://{API_HOST}/api/v1/entity-import-recipe?importable_type=App\Contact
curl -X GET
-H "Content-Type: application/json"
"https://{API_HOST}/api/v1/entity-import-recipe?importable_type=App\Contact"
{
"data": [
{
"id": 1,
"name": "ccc",
"importable_type": "App\\Contact",
"description": null,
"headers": [
{
"value": "contacts.first_name"
},
{
"value": "contacts.membership_no",
"text": "Customer Number"
},
{
"value": "phone_numbers.number",
"set_id": 1
},
{
"value": "email_contacts.address",
"set_id": 1
}
],
"unique_columns": [
"phone_numbers.number",
"email_contacts.address"
],
"creater_id": 1,
"creater": {
"id": 1,
"name": "洪 小閎",
"first_name": "洪",
"last_name": "小閎",
"employee_no": "jocoonopa",
"photo_url": null,
"identity_no": "A125202038",
"job_title_id": -1,
"department_id": -1,
"extension_id": -1,
"extension": null,
"profile_id": 1,
"group_id": null,
"group": {
"id": null,
"name": null,
"description": null,
"supervisor_id": null
},
"cti_agent_account": null,
"cti_agent": null,
"cti_agent_id": null,
"created_at": "2021-01-15 10:53:00",
"updated_at": "2021-08-05 02:38:09"
},
"tasks_count": 13
}
],
"meta": {
"current_page": 1,
"from": 1,
"last_page": 1,
"per_page": 15,
"to": 1,
"total": 1
}
}
GET https://{API_HOST}/api/v1/entity-import-recipe/{id}
curl -X GET
-H "Content-Type: application/json"
"https://{API_HOST}/api/v1/entity-import-recipe/1"
{
"data": {
"id": 1,
"name": "ccc",
"importable_type": "App\\Contact",
"description": null,
"headers": [
{
"value": "contacts.first_name"
},
{
"value": "contacts.membership_no",
"text": "Customer Number"
},
{
"value": "phone_numbers.number",
"set_id": 1
},
{
"value": "email_contacts.address",
"set_id": 1
}
],
"unique_columns": [
"phone_numbers.number",
"email_contacts.address"
],
"creater_id": 1,
"creater": {
"id": 1,
"name": "洪 小閎",
"first_name": "洪",
"last_name": "小閎",
"employee_no": "jocoonopa",
"photo_url": null,
"identity_no": "A125202038",
"job_title_id": -1,
"department_id": -1,
"extension_id": -1,
"extension": null,
"profile_id": 1,
"group_id": null,
"group": {
"id": null,
"name": null,
"description": null,
"supervisor_id": null
},
"cti_agent_account": null,
"cti_agent": null,
"cti_agent_id": null,
"created_at": "2021-01-15 10:53:00",
"updated_at": "2021-08-05 02:38:09"
},
"tasks_count": 13
}
}
Parameter
Required
Default
Type
Description
recipe_id
true
NULL
Number
欲使用的匯入範本 id
has_header
false
false
Boolean
是否忽略第一行表頭
description
false
NULL
String
排程說明
file
true
NULL
binary
上傳匯入檔案,最高上傳檔案限制 100MB 以下,支援 csv、xls 格式。
Property
Type
Description
data
Object
Parameter
Required
Default
Type
Description
page
false
1
Number
目前在第幾頁
per_page
false
15
Number
每頁呈現多少筆
Property
Type
Description
data
Array of objects
匯入任務
meta
Object
頁籤物件
Property
Type
Description
data
Object
Parameter
Required
Default
Type
Description
page
false
1
Number
目前在第幾頁
per_page
false
15
Number
每頁呈現多少筆
importable_type
true
null
String
範本類型,這邊請需帶入 App\Contact
Parameter
Description
id
批次匯入範本 ID