📄自訂表格

列出指定客戶自訂表格

GET https://{API_HOST}/api/v1/contact/{contact}/contact-cz-relation
curl -X GET
    -H "Content-Type: application/json:Authorization: Bearer eyJhbGciOiJIUzI1NiI..." https://{API_HOST}/api/v1/contact/1/contact-cz-relation?cz_col_category_id=5

Parameters

Parameter

Required

Default

Type

DESCRIPTION

contact

true

Null

Number

cz_col_category_id

false

Null

Number

自訂欄位分類的 ID

請參考 客戶自定關聯表格 回應格式


{
    "data": [
        {
            "id": 1,
            "relation_id": 1, // CzColCategory (自訂欄位分類) 的 id
            "relation_name": "健康檢查",
            "information": [
                {
                    "id": 1,
                    "value": 70,
                    "col_id": 1,
                    "col_name": "體重"
                },
                {
                    "id": 2,
                    "value": "A",
                    "col_id": 2,
                    "col_name": "血型"
                },
                {
                    "id": 3,
                    "value": [0,1],
                    "col_id": 3,
                    "col_name": "檢查項目"
                }
            ],
            "created_at": "2019-11-24 22:58:21",
            "updated_at": "2019-11-24 22:58:21"
        }
    ],
    "links": {
        "first": "https://firstline.localhost/api/contact/2197607/contact-cz-relation?page=1",
        "last": "https://firstline.localhost/api/contact/2197607/contact-cz-relation?page=1",
        "prev": null,
        "next": null
    },
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 1,
        "path": "https://firstline.localhost/api/contact/2197607/contact-cz-relation",
        "per_page": 15,
        "to": 1,
        "total": 1
    }
}

對指定客戶增加自訂表格紀錄

POST https://{API_HOST}/api/v1/contact/{contact}/cz-col-category/{cz_col_category}/contact-cz-relation

URL Parameters

PARAMETER

REQUIRED

DEFAULT

TYPE

DESCRIPTION

contact

true

NULL

Number

cz_col_category

true

NULL

Number

Form Data

PARAMETER

REQUIRED

DEFAULT

TYPE

DESCRIPTION

cz_cols

false

NULL

Array or Objects

動態欄位,參數型態參考 CzCol 表格說明

Cz_Col

此欄位為包含以下格式之陣列

PARAMETER

REQUIRED

DEFAULT

TYPE

DESCRIPTION

id

true

NULL

Number

動態欄位的 id

value

true

NULL

String

動態欄位的值

Response

請參考 客戶自訂表格客戶自訂表格內容 回應格式


{
    "data": [
        {
            "id": 2,
            "relation_id": 1, // CzColCategory (動態關聯分類) 的 id
            "relation_name": "健康檢查",
            "information": [
                {
                    "id": 4,
                    "value": 65,
                    "col_id": 1,
                    "col_name": "體重"
                },
                {
                    "id": 5,
                    "value": "A",
                    "col_id": 2,
                    "col_name": "血型"
                },
                {
                    "id": 6,
                    "value": [1,2],
                    "col_id": 3,
                    "col_name": "檢查項目"
                }
            ],
            "created_at": "2019-11-25 22:58:21",
            "updated_at": "2019-11-25 22:58:21"
        }
    ],
    "links": {
        "first": "https://firstline.localhost/api/contact/2197607/contact-cz-relation?page=1",
        "last": "https://firstline.localhost/api/contact/2197607/contact-cz-relation?page=1",
        "prev": null,
        "next": null
    },
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 1,
        "path": "https://firstline.localhost/api/contact/2197607/contact-cz-relation",
        "per_page": 15,
        "to": 2,
        "total": 2
    }
}

範例

  • id=1, type=1 (字串), name='體重'

  • id=2, type=6 (單選), name='血型', options (選項)=[{"text": "A型", "value":"A"},{"text": "B型", "value":"B"},{"text": "O型", "value":"O"},{"text": "AB型", "value":"AB"}]

  • id=3, type=7 (多選), name='檢查項目', options (選項)=[{"text": "X光", "value": 0}, {"text": "抽血", "value": 1}, {"text": "量身高", "value": 2}]

參數範例如下:(注意不論是單選還是多選,都是丟 value,若誤丟 text 會導致前端顯示出現問題)

{
    "cz_cols": [
        {
            "id":1,
            "value":65
        },
        {
            "id":2,
            "value":"A"
        },
        {
            "id":3,
            "value":[1,2]
        }
    ]
}

Form Data cz_cols

[
    {"id":1, "value":"65"}, // 1: 體重
    {"id":2, "value":"A"}, // 2: 血型
    {"id":3, "value": [1, 2]} // 3. 檢查項目: 抽血+量身高
]

對指定客戶更新自訂表格紀錄

PUT https://{API_HOST}/api/v1/contact/{contact}/contact-cz-relation/{contact_cz_relation}

URL Parameters

PARAMETER

REQUIRED

DEFAULT

TYPE

DESCRIPTION

contact

true

NULL

Number

contact_cz_relation

true

NULL

Number

Form Data

PARAMETER

REQUIRED

DEFAULT

TYPE

DESCRIPTION

cz_cols

false

NULL

Array

動態欄位,參數型態參考 CzCol 表格說明

Cz_Col

此欄位為包含以下格式之陣列

PARAMETER

REQUIRED

DEFAULT

TYPE

DESCRIPTION

id

true

NULL

Number

動態欄位的 id

value

true

NULL

String

動態欄位的值

Response

請參考 客戶動態關聯表格 回應格式


{
    "data": {
        "id": 1,
        "relation_id": 1, // CzColCategory 的 id
        "relation_name": "寶寶資料",
        "information": [
            {
                "id": 4,
                "value": 55,
                "col_id": 1,
                "col_name": "體重"
            },
            {
                "id": 5,
                "value": "A",
                "col_id": 2,
                "col_name": "血型"
            },
            {
                "id": 6,
                "value": [1,2],
                "col_id": 3,
                "col_name": "檢查項目"
            }
        ]
    }
}

範例

  • id=1, type=1 (字串), name='體重'

  • id=2, type=6 (單選), name='血型', options (選項)=[{"text": "A型", "value":"A"},{"text": "B型", "value":"B"},{"text": "O型", "value":"O"},{"text": "AB型", "value":"AB"}]

  • id=3, type=7 (多選), name='從事運動', options (選項)=[{"text": "籃球", "value": 0}, {"text": "跑步", "value": 1}, {"text": "游泳", "value": 2}]

參數範例如下: (注意不論是單選還是多選,都是丟 value,若誤丟 text 會導致前端顯示出現問題)


{
    "cz_cols": [
        {
            "id": 1, // 體重欄位的 id
            "value": 55
        }
    ]
}

Form Data cz_cols

[
    {"id":1, "value":"70"}, // 1: 體重
    {"id":2, "value":"AB"}, // 2: 血型
    {"id":3, "value": [1, 2]} // 3. 運動: 跑步+游泳
]

對指定客戶刪除自訂表格紀錄

DELETE https://{API_HOST}/api/v1/contact/{contact}/contact-cz-relation/{contact_cz_relation}
curl -X DELETE
    -H "Content-Type: application/json:Authorization: Bearer eyJhbGciOiJIUzI1NiI..." https://{API_HOST}/api/v1/contact/1/contact-cz-relation/1

URL Parameters

PARAMETER

REQUIRED

DEFAULT

TYPE

DESCRIPTION

contact

true

NULL

Number

contact_cz_relation

true

NULL

Number

回應 204 http status

對指定客戶刪除指定分類的自訂表格紀錄

DELETE https://{API_HOST}/api/v1/contact/{contact}/cz-col-category/{cz_col_category}
curl -X DELETE
    -H "Content-Type: application/json:Authorization: Bearer eyJhbGciOiJIUzI1NiI..." https://{API_HOST}/api/v1/contact/1/cz-col-category/1

URL Parameters

PARAMETER

REQUIRED

DEFAULT

TYPE

DESCRIPTION

contact

true

NULL

Number

cz_col_category

true

NULL

Number

回應 204 http status

Last updated