任務標籤管理
呼叫位址
| 資料中心 | URL |
|---|---|
| 新加坡 | https://email.api.engagelab.cc |
| 土耳其 | https://emailapi-tr.engagelab.com |
當使用 REST API 時,需要將選定的 base URL 與具體 API 的路徑結合,以獲得完整的呼叫位址。
POST/v1/marketing/campaigns/tags
建立任務標籤
URL
https://email.api.engagelab.cc/v1/marketing/campaigns/tags
HTTP 請求方式
POST
Content-Type
application/json; charset=utf-8
請求 Headers
| Header | Type | Required | Description |
|---|---|---|---|
| Authorization | string | true | Basic base64(api_user:api_key) |
Body 參數
| Parameter | Type | Required | Description |
|---|---|---|---|
| tag_names | array[string] | true | 標籤名稱,最長 64 個字元,僅由 a-z, A-Z, 0-9, _, 中文漢字等組成 |
說明:
1、每個 Organization 最多可建立 100 個標籤。
2、標籤名稱不可重複。
請求範例
curl -X POST -H 'Content-Type: application/json; charset=utf-8' -H 'Authorization:Basic YXBpX3VzZXI6YXBpX2tleQ==' -i https://email.api.engagelab.cc/v1/marketing/campaigns/tags --data '{
"tag_names": ["雙十一促銷", "新用戶"]
}'
回應範例
Response-Success
HttpStatus: 200
{
"count": 2
}
Response-Error
HttpStatus: 401
{
"code": 32603,
"message": "tag name already exist"
}
任務標籤列表
URL
https://email.api.engagelab.cc/v1/marketing/campaigns/tags
HTTP 請求方式
GET
Content-Type
application/x-www-form-urlencoded;charset=utf-8
請求 Headers
| Header | Type | Required | Description |
|---|---|---|---|
| Authorization | string | true | Basic base64(api_user:api_key) |
Query 參數
| Parameter | Type | Required | Description |
|---|---|---|---|
| tag_name | string | false | 標籤名稱(模糊查詢) |
| offset | integer | false | 記錄偏移量,取值區間 [0-],預設為 0 |
| limit | integer | false | 獲取記錄筆數,取值區間 [1-100],預設為 10 |
請求範例
curl -X GET -H 'Authorization:Basic YXBpX3VzZXI6YXBpX2tleQ==' -i https://email.api.engagelab.cc/v1/marketing/campaigns/tags?tag_name=促銷&limit=10&offset=0
回應說明
| Parameter | Type | Description |
|---|---|---|
| tag_id | string | 標籤 ID |
| tag_name | string | 標籤名稱 |
| create_time | string | 建立時間 |
| update_time | string | 更新時間 |
回應範例
Response-Success
HttpStatus: 200
{
"result": [
{
"tag_id": "64a1f2e0c9e1a23456789012",
"tag_name": "雙十一促銷",
"create_time": "2024-01-15T10:30:00+0800",
"update_time": "2024-01-16T14:20:00+0800"
},
{
"tag_id": "64a1f2e0c9e1a23456789013",
"tag_name": "新用戶",
"create_time": "2024-01-14T08:00:00+0800",
"update_time": "2024-01-14T08:00:00+0800"
}
],
"total": 2,
"count": 2
}
Response-Error
HttpStatus: 401
{
"code": 30000,
"message": "Authentication failed"
}
更新任務標籤
URL
https://email.api.engagelab.cc/v1/marketing/campaigns/tags/{tag_id}
HTTP 請求方式
PUT
Content-Type
application/json; charset=utf-8
請求 Headers
| Header | Type | Required | Description |
|---|---|---|---|
| Authorization | string | true | Basic base64(api_user:api_key) |
Path 參數
| Parameter | Type | Required | Description |
|---|---|---|---|
| tag_id | string | true | 標籤 ID |
Body 參數
| Parameter | Type | Required | Description |
|---|---|---|---|
| tag_name | string | true | 標籤名稱,僅支援中文、英文大小寫、數字、下劃線,長度 1-64 字元。 |
請求範例
curl -X PUT -H 'Content-Type: application/json; charset=utf-8' -H 'Authorization:Basic YXBpX3VzZXI6YXBpX2tleQ==' -i https://email.api.engagelab.cc/v1/marketing/campaigns/tags/64a1f2e0c9e1a23456789012 --data '{
"tag_name": "618促銷"
}'
回應範例
Response-Success
HttpStatus: 200
{
"count": 1
}
Response-Error
HttpStatus: 401
{
"code": 32605,
"message": "Campaign tag not found"
}
刪除任務標籤
URL
https://email.api.engagelab.cc/v1/marketing/campaigns/tags
HTTP 請求方式
DELETE
Content-Type
application/x-www-form-urlencoded;charset=utf-8
請求 Headers
| Header | Type | Required | Description |
|---|---|---|---|
| Authorization | string | true | Basic base64(api_user:api_key) |
說明:
1、刪除標籤後,關聯的 campaign 將自動移除該標籤。
請求範例
curl -X DELETE -H 'Authorization:Basic YXBpX3VzZXI6YXBpX2tleQ==' -i https://email.api.engagelab.cc/v1/marketing/campaigns/tags/61c2be010d2b4e6a3836ab1f
回應範例
Response-Success
HttpStatus: 200
{
"count": 2
}
Response-Error
HttpStatus: 401
{
"code": 32606,
"message": "tag_id cannot be empty"
}
任務新增標籤
URL
https://email.api.engagelab.cc/v1/marketing/campaigns/tags/{tag_id}/add
HTTP 請求方式
POST
Content-Type
application/json; charset=utf-8
請求 Headers
| Header | Type | Required | Description |
|---|---|---|---|
| Authorization | string | true | Basic base64(api_user:api_key) |
Body 參數
| Parameter | Type | Required | Description |
|---|---|---|---|
| campaign_ids | array[string] | * | 任務 ID 列表,單次最多 200 個 |
說明:
1、每個 campaign 最多可新增 20 個 tag。
請求範例
curl -X POST -H 'Content-Type: application/json; charset=utf-8' -H 'Authorization:Basic YXBpX3VzZXI6YXBpX2tleQ==' -i https://email.api.engagelab.cc/v1/marketing/campaigns/tags/61c2be010d2b4e6a3836ab1f/add --data '{
"campaign_ids": [
"61c2be010d2b4e6a3836ab1f",
"61c2be010d2b4e6a3836ab1d"
]
}'
回應範例
Response-Success
HttpStatus: 200
{
"total": 3
}
Response-Error
HttpStatus: 401
{
"code": 32605,
"message": "Campaign tag not found"
}
任務移除標籤
URL
https://email.api.engagelab.cc/v1/marketing/campaigns/tags/{tag_id}/remove
HTTP 請求方式
POST
Content-Type
application/json; charset=utf-8
請求 Headers
| Header | Type | Required | Description |
|---|---|---|---|
| Authorization | string | true | Basic base64(api_user:api_key) |
Body 參數
| Parameter | Type | Required | Description |
|---|---|---|---|
| campaign_ids | array[string] | * | 任務 ID 列表,單次最多 200 個 |
請求範例
curl -X POST -H 'Content-Type: application/json; charset=utf-8' -H 'Authorization:Bearer YXBpX3VzZXI6YXBpX2tleQ==' -i https://email.api.engagelab.cc/v1/marketing/campaigns/tags/616683a13a7b531b0336108d/remove --data '{
"campaign_ids": [
"61c2be010d2b4e6a3836ab1f",
"61c2be010d2b4e6a3836ab1d"
]
}'
回應範例
Response-Success
HttpStatus: 200
{
"total": 3
}
Response-Error
HttpStatus: 401
{
"code": 32605,
"message": "Campaign tag not found"
}










