属性管理

最新更新: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"
}

        
此代码块在浮窗中显示
在文档中心打开