😀客戶
搜尋
GET https://{API_HOST}/api/v1/contact
根據下方的 Query Parameters 參數進行過濾篩選。
curl -X GET
-H "Content-Type: application/json"
https://{API_HOST}/api/v1/contact?xxxx
Query Parameters
欄位
page
1
Number
目前在第幾頁
per_page
15
Number
每頁呈現多少筆
id
NULL
Array
客戶ID,陣列方式傳入
gender
NULL
Number
1: 女性、0: 男性
birth_at__start
NULL
Date
出生日開始日期
birth_at__end
NULL
Date
出生日結束日期
name
NULL
String
對姓名開頭進行模糊搜尋
cz_cols
NULL
Array
自訂欄位,參數型態參考下方 cz_cols 表格說明
phone_number
NULL
String
電話號碼
NULL
String
電子郵件地址
created_at__start
NULL
DateTime
建立開始時間
created_at__end
NULL
DateTime
建立結束時間
birth_months
NULL
Array
壽星月份,如 [1, 3, 4]
表示查詢 1、3、4月的壽星
identity_no
NULL
String
身分證字號
membership_no
NULL
String
會員編號
updated_at__start
NULL
DateTime
最後更新開始時間
updated_at__end
NULL
DateTime
最後更新結束時間
cz_cols(自訂欄位)
此欄位為包含以下格式之陣列
PARAMETER
REQUIRED
DEFAULT
TYPE
DESCRIPTION
id
true
NULL
Number
動態欄位的 id
op
true
NULL
String
比較方式: '>', '<', '=', '>=', '<=', '<>', 'in', 'not_in', 'is_null', 'is_not_null'
val
NULL
String
動態欄位的搜尋值
[
/* 代表搜尋客戶中自訂欄位 ID 為 1 且大於 10 的客戶*/
{
"id":1,
"op":">",
"val": 10
},
{
"id":1,
"op":"=",
"val": 20
}
]
Response
{
"data": [
{
"id": 1,
"name": "Angelita D'Amore",
"first_name": "Angelita",
"last_name": "D'Amore",
"membership_no": "8771639",
"identity_no": "418099",
"gender": 0,
"birth_at": "1985-08-27",
"profile_id": 1,
"profile": {
"id": 1,
"phones": []
},
"email_contacts": []
}
],
"meta": {
"current_page": 1,
"from": 1,
"last_page": 10,
"per_page": 1,
"to": 1,
"total": 10
}
}
取得
GET https://{API_DOMAIN}/api/v1/contact/{contact}
URL Parameters
PARAMETER
REQUIRED
DEFAULT
TYPE
DESCRIPTION
contact
True
NULL
Number
客戶的 ID
curl -X get
-H "Content-Type: application/json"
https://{API_HOST}/api/v1/contact/1
Response
請參考客戶回應格式。
PROPERTY
TYPE
DESCRIPTION
{
"data": {
"id": 1,
"name": "Angelita D'Amore",
"first_name": "Angelita",
"last_name": "D'Amore",
"membership_no": "8771639",
"identity_no": "418099",
"gender": 0,
"birth_at": "1985-08-27",
"profile_id": 1,
"profile": {
"id": 1,
"phones": []
},
"email_contacts": [],
"cz_cols": [
{
"id": 1,
"value": "19999",
"category_id": 1
},
{
"id": 4,
"value": "51",
"category_id": 1
},
{
"id": 5,
"value": null,
"category_id": 1
}
]
}
}
新增
POST https://{API_HOST}/api/v1/contact
根據下方的 Query Parameters 表單的參數進行建立。
curl -X POST
-H "Content-Type: application/json"
'{"first_name":"abc","last_name":"cde"}'
https://{API_HOST}/api/v1/contact?xxxx
Query Parameters
PARAMETER
REQUIRED
DEFAULT
TYPE
DESCRIPTION
membership_no
false
NULL
String
會員編號
identity_no
false
NULL
String
身分證
gender
false
NULL
Number
性別 0: 女 1: 男
first_name
true
NULL
String
姓
last_name
false
NULL
String
名
birth_at
false
NULL
Date
出生日期
cz_cols
false
NULL
Array
自訂欄位,參數型態參考下方 CzCol 表格說明
company_ids
false
NULL
Array
公司系統編號
Response
請參考客戶回應格式
{
"data": {
"id": 2,
"name": "abc cde",
"first_name": "abc",
"last_name": "cde",
"membership_no": null,
"identity_no": null,
"gender": null,
"birth_at": null,
"profile_id": 1,
"profile": {
"id": 1,
"phones": []
},
"cz_cols": [
{
id: 4,
value: "123456"
},
{
id: 7,
value: "apple"
}
],
}
}
更新
PUT https://{API_HOST}/api/v1/contact/{id}
URL Parameters
PARAMETER
DESCRIPTION
id
客戶的 ID
curl -X PUT
-H "Content-Type: application/json"
'{"first_name":"First","last_name":"Line"}'
https://{API_HOST}/api/v1/contact/2
Query Parameters
PARAMETER
REQUIRED
DEFAULT
TYPE
DESCRIPTION
membership_no
false
NULL
String
會員編號
identity_no
false
NULL
String
身分證
gender
false
NULL
Number
性別 0: 女 1: 男
first_name
false
NULL
String
姓
last_name
false
NULL
String
名
birth_at
false
NULL
Date
出生日期
cz_cols
false
NULL
Array
自訂欄位,參數型態參考下方 CzCol 表格說明
tag_ids
false
NULL
Array
客戶標籤,傳入客戶標籤 ID
company_ids
false
NULL
Array
公司系統編號
Response
請參考客戶回應格式
{
"data": {
"id": 2,
"name": "First Line",
"first_name": "First",
"last_name": "Line",
"membership_no": null,
"identity_no": null,
"gender": null,
"birth_at": null,
"profile_id": 1,
"profile": {
"id": 1,
"phones": []
},
"cz_cols": [
{
id: 4,
value: "123456"
},
{
id: 7,
value: "apple"
},
{
id: 18,
value: ["A", "B", "C"]
}
],
"tag_id": [4, 6]
}
}
刪除
DELETE https://{API_HOST}/api/v1/contact/{id}
URL Parameters
PARAMETER
DESCRIPTION
id
客戶的系統編號 #ID
curl -X DELETE
-H "Content-Type: application/json"
https://{API_HOST}/api/v1/contact/2
通用資料
性別 gender
名稱
值
男
0
女
1
自訂欄位 cz_cols
此欄位為包含以下格式陣列。
PARAMETER
REQUIRED
DEFAULT
TYPE
DESCRIPTION
id
true
NULL
Number
自訂欄位的 ID
value
true
NULL
String
自訂欄位的值
範例
假設目前有 3 個自訂欄位,分別為
系統編號為 1,名稱為體重。
系統編號為 4,名稱為血型。
系統編號為 18,名稱為購買項目。
則參數範例如下:
[
// 數字
{
"id":1,
"value": 60
},
// 文字或單選。
{
"id":4,
"value": "AB型"
},
//多選
{
id: 18,
value: ["A", "B", "C"]
}
]
而回應的 JSON 格式如下:
{
"data": {
"id": 2,
"name": "abc cde",
"first_name": "abc",
"last_name": "cde",
"membership_no": null,
"identity_no": null,
"gender": null,
"birth_at": null,
"profile_id": 1,
"profile": {
"id": 1,
"phones": []
},
"cz_cols": [{ "id": 2 ...}],
}
}
Last updated