屬性管理

最新更新:2022-12-05

創建屬性

URL

https://email.api.engagelab.cc/v1/marketing/lists/fields
          https://email.api.engagelab.cc/v1/marketing/lists/fields

        
此代碼塊在浮窗中顯示

HTTP 請求方式

POST
          POST

        
此代碼塊在浮窗中顯示

Content-Type

application/json; charset=utf-8
          application/json; charset=utf-8

        
此代碼塊在浮窗中顯示

請求 Headers

Header Type Required Description
Authorization string true Basic base64(api_user:api_key)

Body 參數

Parameter Type Required Description
field_name string true 欄位名稱(最長64個字元,僅由 a-z,A-z,0-9,_ 等組成,且不能為系統定義屬性字串(忽略字母大小寫);包含系統欄位 Email、Name、Phone 在內共可建立50個屬性欄位
field_type integer true 欄位類型(0: text, 1: number, 2: date, 3: birthday, 4: dropdown)
visible boolean true 是否可見 true 或 false
format string false 資料格式:
0 或 .0 或 .00 (field_type=1時);
MM/DD/YYYY或DD/MM/YYYY (field_type=2時);
MM/DD或DD/MM (field_type=3時)
options string[] false dropdown 類型的清單項目內容,field_type 為 dropdown 類型時不能為空,最多10條資料

說明:

  1. 系統屬性:Email、Name、Phone、tag、campaign、segment、domain、createTime、updateTime、unsubscribeTime
  2. field_name不能為系統屬性,改變字母大小寫也不允許創建

請求示例

curl -X POST -H 'Content-Type: application/json; charset=utf-8' -H 'Authorization:Basic YXBpX3VzZXI6YXBpX2tleQ==' -i https://email.api.engagelab.cc/v1/marketing/lists/fields --data '{ "field_name": "xiao", "field_type": 3, "visible": true, "format": "MM/DD" }'
          curl -X POST -H 'Content-Type: application/json; charset=utf-8' -H 'Authorization:Basic YXBpX3VzZXI6YXBpX2tleQ==' -i https://email.api.engagelab.cc/v1/marketing/lists/fields --data '{
  "field_name": "xiao",
  "field_type": 3,
  "visible": true,
  "format": "MM/DD"
}'

        
此代碼塊在浮窗中顯示

響應示例

Response-Success

HttpStatus: 200

{ "result": { "field_id": 11, "field_name": "xiao", "field_type": 3, "visible": true, "format": "MM/DD" } }
          { 
 "result": {
   "field_id": 11,
  "field_name": "xiao",
  "field_type": 3,
  "visible": true,
  "format": "MM/DD"
  }
}

        
此代碼塊在浮窗中顯示

Response-Error

HTTP Status :401

{ "code": 30000, "message": "Authentication failed" }
          
{
  "code": 30000,
  "message": "Authentication failed"
}

        
此代碼塊在浮窗中顯示

刪除屬性

URL

https://email.api.engagelab.cc/v1/marketing/lists/fields/{field_id}
          https://email.api.engagelab.cc/v1/marketing/lists/fields/{field_id}

        
此代碼塊在浮窗中顯示

HTTP 請求方式

DELETE
          DELETE

        
此代碼塊在浮窗中顯示

Content-Type

application/x-www-form-urlencoded;charset=utf-8
          application/x-www-form-urlencoded;charset=utf-8

        
此代碼塊在浮窗中顯示

請求 Headers

Header Type Required Description
Authorization string true Basic base64(api_user:api_key)

請求示例

curl -X DELETE -H 'Authorization:Basic YXBpX3VzZXI6YXBpX2tleQ==' -i https://email.api.engagelab.cc/v1/marketing/lists/fields/569
          curl -X DELETE -H 'Authorization:Basic YXBpX3VzZXI6YXBpX2tleQ==' -i https://email.api.engagelab.cc/v1/marketing/lists/fields/569

        
此代碼塊在浮窗中顯示

響應示例

Response-Success

HttpStatus: 200

{ "count": 1 }
          {
    "count": 1
}

        
此代碼塊在浮窗中顯示

Response-Error

{ "code": 30037, "message": "delete failure" }
          {
  "code": 30037,
  "message": "delete failure"
}

        
此代碼塊在浮窗中顯示

更新屬性

URL

https://email.api.engagelab.cc/v1/marketing/lists/fields/{field_id}
          https://email.api.engagelab.cc/v1/marketing/lists/fields/{field_id}

        
此代碼塊在浮窗中顯示

HTTP 請求方式

PUT
          PUT

        
此代碼塊在浮窗中顯示

Content-Type

application/json; charset=utf-8
          application/json; charset=utf-8

        
此代碼塊在浮窗中顯示

請求 Headers

Header Type Required Description
Authorization string true Basic base64(api_user:api_key)

Body 參數

Parameter Type Required Description
field_name string true 欄位名稱(最長64個字元,僅由 a-z, A-Z, 0-9, _ 等組成,且不能為系統定義屬性字串(忽略大小寫);包含系統欄位 Email、Name、Phone 在內共可建立50個屬性欄位
field_type integer true 欄位類型(0:text,1:number,2:date,3:birthday,4:dropdown)
visible boolean true 是否可見 true 或 false
format string false 資料格式:
0 或 .0 或 .00 (fieldType=1時);
MM/DD/YYYY或DD/MM/YYYY (fieldType=2時);
MM/DD或DD/MM (fieldType=3時)
options string[] false dropdown 類型的清單項目內容,field_type 為 dropdown 類型時不能為空,最多為10條資料

說明:

  1. 系統屬性:Email、Name、Phone、tag、campaign、segment、domain、createTime、updateTime、unsubscribeTime

請求示例

curl -X PUT -H 'Content-Type: application/json; charset=utf-8' -H 'Authorization:Basic YXBpX3VzZXI6YXBpX2tleQ==' -i https://email.api.engagelab.cc/v1/marketing/lists/fields/839 --data '{ "field_name": "xiao", "field_type": 3, "visible": true, "format": "MM/DD" }'
          curl -X PUT -H 'Content-Type: application/json; charset=utf-8' -H 'Authorization:Basic YXBpX3VzZXI6YXBpX2tleQ==' -i https://email.api.engagelab.cc/v1/marketing/lists/fields/839 --data '{
  "field_name": "xiao",
  "field_type": 3,
  "visible": true,
  "format": "MM/DD"
}'

        
此代碼塊在浮窗中顯示

響應示例

Response-Success

HttpStatus: 200

{ "count": 1 }
          {
  "count": 1
}

        
此代碼塊在浮窗中顯示

Response-Error

{ "code": 30036, "message": "not found" }
          {
    "code": 30036,
    "message": "not found"
}

        
此代碼塊在浮窗中顯示

屬性列表

URL

https://email.api.engagelab.cc/v1/marketing/lists/fields
          https://email.api.engagelab.cc/v1/marketing/lists/fields

        
此代碼塊在浮窗中顯示

HTTP 請求方式

GET
          GET

        
此代碼塊在浮窗中顯示

Content-Type

application/x-www-form-urlencoded;charset=utf-8
          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
field_name string false 字段名稱,模糊查詢

請求示例

curl -X GET -H 'Authorization:Basic YXBpX3VzZXI6YXBpX2tleQ==' -i https://email.api.engagelab.cc/v1/marketing/lists/fields?field_name=Age
          curl -X GET -H 'Authorization:Basic YXBpX3VzZXI6YXBpX2tleQ==' -i https://email.api.engagelab.cc/v1/marketing/lists/fields?field_name=Age

        
此代碼塊在浮窗中顯示

響應說明

Parameter Type Description
result array[object] 屬性列表
field_name string 欄位名稱(最長64個字元,僅由 a-z,A-z,0-9,_ 等組成,且不能為系統定義屬性字串(忽略字母大小寫);包含系統欄位 Email、Name、Phone 在內共可建立50個屬性欄位
field_type integer 欄位類型(0: text, 1: number, 2: date, 3: birthday, 4: dropdown)
visible boolean 是否可見 true 或 false
format string 資料格式:
0 或 .0 或 .00 (fieldType=1時);
MM/DD/YYYY或DD/MM/YYYY (field_type=2時);
MM/DD或DD/MM (field_type=3時)
options string[] dropdown 類型的列表項目內容,field_type 為 dropdown 類型時不能為空,最多為10條資料
field_id integer 屬性對應的idx ,-1則表示系統屬性
total integer 本次查詢符合條件的記錄總數
count integer 本次查詢符合條件的記錄數

響應示例

Response-Success

HttpStatus: 200

{ "result": [ { "field_name": "Email", "field_type": 0, "visible": true, "format": null, "options": null, "field_id": -1 }, { "field_name": "Name", "field_type": 0, "visible": true, "format": null, "options": null, "field_id": -1 }, { "field_name": "Phone", "field_type": 0, "visible": true, "format": null, "options": null, "field_id": -1 }, { "field_name": "Gender", "field_type": 0, "visible": true, "format": null, "options": null, "field_id": 0 }, { "field_name": "Birthday", "field_type": 3, "visible": true, "format": "MM/DD", "options": null, "field_id": 1 }, { "field_name": "Age", "field_type": 1, "visible": true, "format": "0", "options": null, "field_id": 2 }, { "field_name": "remark", "field_type": 0, "visible": true, "format": null, "options": null, "field_id": 3 } ], "total": 7, "count": 7 }
          {
  "result": [
    {
      "field_name": "Email",
      "field_type": 0,
      "visible": true,
      "format": null,
      "options": null,
      "field_id": -1
    },
    {
      "field_name": "Name",
      "field_type": 0,
      "visible": true,
      "format": null,
      "options": null,
      "field_id": -1
    },
    {
      "field_name": "Phone",
      "field_type": 0,
      "visible": true,
      "format": null,
      "options": null,
      "field_id": -1
    },
    {
      "field_name": "Gender",
      "field_type": 0,
      "visible": true,
      "format": null,
      "options": null,
      "field_id": 0
    },
    {
      "field_name": "Birthday",
      "field_type": 3,
      "visible": true,
      "format": "MM/DD",
      "options": null,
      "field_id": 1
    },
    {
      "field_name": "Age",
      "field_type": 1,
      "visible": true,
      "format": "0",
      "options": null,
      "field_id": 2
    },
    {
      "field_name": "remark",
      "field_type": 0,
      "visible": true,
      "format": null,
      "options": null,
      "field_id": 3
    }
  ],
  "total": 7,
  "count": 7
}

        
此代碼塊在浮窗中顯示

Response-Error

HTTP Status :401

{ "code": 30000, "message": "Authentication failed" }
          {
  "code": 30000,
  "message": "Authentication failed"
}

        
此代碼塊在浮窗中顯示
在文档中心打开