⬇️客戶自訂表格匯入排程

你可以透過指定存在的「客戶自訂欄位匯入範本」新增相關排程,排程將依據指定時間、檔案等資訊進行匯入。而同一時間為避免資料衝突,若有相同時段排程,將依據執行匯入。

新增

POST https://{API_HOST}/api/v1/relation-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/relation-import-task"

Request params

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 以下)

Response

Property

Type

Description

{
    "data": {
        "id": 4,
        "has_header": 0,
        "file": "relation-import/1629345399-ct匯入.csv",
        "size": 44,
        "total_amount": 3,
        "description": "dddd",
        "status": 2,
        "current_sheet_index": 1,
        "current_row_index": 3,
        "job_turns": 1,
        "executed_start_at": "2021-08-19 11:56:39",
        "executed_end_at": "2021-08-19 11:56:40",
        "recipe_id": 1,
        "creater_id": 1,
        "error": null,
        "created_at": "2021-08-19T03:56:39.000000Z",
        "updated_at": "2021-08-19T03:56:40.000000Z",
        "restart_at": null,
        "recipe": {
            "id": 1,
            "name": "客戶ct檢測匯入",
            "description": null,
            "headers": [
                {
                    "value": "contacts.membership_no"
                },
                {
                    "id": 11,
                    "type": 0,
                    "value": "cz_relation_information.11",
                    "text": "測量數字",
                    "isMatchField": true,
                    "category_id": 5
                }
            ],
            "unique_columns": [
                "contacts.membership_no"
            ],
            "relation_unique_column": "-1",
            "creater_id": 1,
            "cz_col_category_id": 5,
            "created_at": "2021-08-18T05:56:20.000000Z",
            "updated_at": "2021-08-18T05:56:20.000000Z",
            "importable_type": "App\\Contact",
            "cz_col_category": {
                "id": 5,
                "name": "ct值",
                "description": null,
                "creater_id": null,
                "created_at": "2021-08-18T05:51:16.000000Z",
                "updated_at": "2021-08-18T05:51:16.000000Z",
                "type": 1
            }
        }
    }
}

列表

Http Request

GET https://{API_HOST}/api/v1/relation-import-task

Parameter

Required

Default

Type

Description

page

false

1

Number

目前在第幾頁

per_page

false

15

Number

每頁呈現多少筆

Response

Property

Type

Description

data

Array of objects

meta

Object

Pagination meta

檢視

Http Request

GET https://{API_HOST}/api/v1/relation-import-task/{id}

Response

Property

Type

Description

範本列表

你可以透過 API 查找排程符合的範本 ID,或是透過系統介面查詢相關資訊。

Http Request

GET https://{API_HOST}/api/v1/relation-import-recipe?importable_type=App\Contact

Query Parameters

Parameter

Required

Default

Type

Description

page

false

1

Number

目前在第幾頁

per_page

false

15

Number

每頁呈現多少筆

importable_type

true

NULL

String

範本類型,這邊需帶入 App\Contact

Response

範本檢視

Http Request

GET https://{API_HOST}/api/v1/relation-import-recipe/{id}

URL Parameters

Parameter

Description

id

自訂表格批次匯入範本 id

Response

Last updated