聯繫人列表

最新更新:2023-04-10

通過以下接口可以對短信聯繫人列表進行查詢, 添加, 刪除, 更新操作.

查詢聯繫人列表

返回短信短信聯繫人列表的基本信息

URL

https://sms.api.engagelab.cc/v1/contact_lists
          https://sms.api.engagelab.cc/v1/contact_lists

        
此代碼塊在浮窗中顯示

HTTP請求方式

GET
          GET

        
此代碼塊在浮窗中顯示

Request-Headers

Header 類型 必須 說明
Authorization String true Basic base64(sms_user:sms_key)

參數說明

參數 類型 必須 說明
offset Integer 查詢起始位置,取值區間 [0-],默認為 0
limit Integer 查詢個數, 取值區間 [0-100], 默認為 100
contact_list_name string 聯繫人列表名稱,模糊查詢

請求示例

curl -X GET "https://sms.api.engagelab.cc/v1/contact_lists?contact_list_name=test" --header "Authorization: Basic <<YOUR_SMS_KEY_HERE>>"
          curl -X GET "https://sms.api.engagelab.cc/v1/contact_lists?contact_list_name=test" 
--header "Authorization: Basic <<YOUR_SMS_KEY_HERE>>"

        
此代碼塊在浮窗中顯示

響應說明

字段 說明
contact_list_id 聯繫人列表ID
contact_list_name 聯繫人列表名稱
description 描述
member_count 成員個數
create_time 創建時間
update_time 更新時間

響應示例

{ "result": [{ "contact_List_id": 998, "contact_list_name": "test", "description": "", "member_count": 4, "create_time": "2016-05-10T15:18:38+0800", "update_time": "2016-05-11T10:04:20+0800" }, { "contact_List_id": 999, "contact_list_name": "test2", "description": "", "member_count": 1, "create_time": "2016-06-29T12:54:59+0800", "update_time": "2016-06-29T12:54:59+0800" } ], "count":2 "total": 10 }
          {
        "result": [{
                "contact_List_id": 998,
                "contact_list_name": "test",
                "description": "",
                "member_count": 4,
                "create_time": "2016-05-10T15:18:38+0800",
                "update_time": "2016-05-11T10:04:20+0800"
            },
            {
                "contact_List_id": 999,
                "contact_list_name": "test2",
                "description": "",
                "member_count": 1,
                "create_time": "2016-06-29T12:54:59+0800",
                "update_time": "2016-06-29T12:54:59+0800"
            }
        ],
        "count":2
        "total": 10
    
}

        
此代碼塊在浮窗中顯示

添加聯繫人列表

返回添加成功的聯繫人列表信息

URL

https://sms.api.engagelab.cc/v1/contact_lists
          https://sms.api.engagelab.cc/v1/contact_lists

        
此代碼塊在浮窗中顯示

HTTP請求方式

POST
          POST

        
此代碼塊在浮窗中顯示

Content-type

application/json
          application/json

        
此代碼塊在浮窗中顯示

Request-Headers

Header 類型 必須 說明
Authorization String true Basic base64(sms_user:sms_key)

參數說明

參數 類型 必須 說明
contact_list_name string 聯繫人列表名稱,僅支持數字、字母、下劃線或橫線,最長48字符
description string 描述信息,最長255字符

請求示例

curl -X POST "https://sms.api.engagelab.cc/v1/contact_lists" --header "Authorization: Basic <<YOUR_SMS_KEY_HERE>>" --header "Content-Type: application/json" --data '{ "contact_list_name": "beijing", "description": "test" }'
          curl -X POST "https://sms.api.engagelab.cc/v1/contact_lists" 
--header "Authorization: Basic <<YOUR_SMS_KEY_HERE>>" 
--header "Content-Type: application/json" 
--data '{
    "contact_list_name": "beijing",
    "description": "test"
}'  

        
此代碼塊在浮窗中顯示

響應說明

字段 說明
contact_list_id 聯繫人列表ID
contact_list_name 聯繫人列表名稱
description 列表描述
member_count 成員個數
create_time 創建時間
update_time 更新時間

響應示例

Response-success

HTTP Status: 200

{ "result": { "contact_list_id": 35, "contact_list_name": "beijing", "description": "test", "member_count": 28, "create_time": "2016-08-02T14:06:10+0800", "update_time": "2017-05-19T10:55:24+0800" } }
          {
    "result": {
            "contact_list_id": 35,
            "contact_list_name": "beijing",
            "description": "test",
            "member_count": 28,
            "create_time": "2016-08-02T14:06:10+0800",
            "update_time": "2017-05-19T10:55:24+0800"	
    }
}

        
此代碼塊在浮窗中顯示

Response-error

HTTP Status :401

{ "code": 30000, "message": "Unauthorized." }
          {
    
    "code": 30000,
    "message": "Unauthorized."
}

        
此代碼塊在浮窗中顯示

Response-error

HTTP Status :400

// 失敗的返回結果示例 { "code": 35004, "message": "contact_list_name cannot be empty" }
          // 失敗的返回結果示例
{
    "code": 35004,
        "message": "contact_list_name cannot be empty"
}

        
此代碼塊在浮窗中顯示

更新聯繫人列表

返回更新成功的聯繫人列表的基本信息

URL

https://sms.api.engagelab.cc/v1/contact_lists/{contact_list_id}
          https://sms.api.engagelab.cc/v1/contact_lists/{contact_list_id}

        
此代碼塊在浮窗中顯示

HTTP請求方式

PUT
          PUT

        
此代碼塊在浮窗中顯示

Content-type

application/json
          application/json

        
此代碼塊在浮窗中顯示

Request-Headers

Header 類型 必須 說明
Authorization String true Basic base64(sms_user:sms_key)

參數說明

參數 類型 必須 說明
contact_list_name string 联系人列表名称,仅支持数字、字母、下划线或横线,最长48字符
description string 描述信息,最长255字符

注意: 1.更新列表的 contact_list_name 和 description時,才會更新列表時間,更新成員時不更新列表更新時間。

請求示例

curl -X PUT "https://sms.api.engagelab.cc/v1/contact_lists/1234" --header "Authorization: Basic <<YOUR_SMS_KEY_HERE>>" --header "Content-Type: application/json" --data '{ "contact_list_name": "shanghai", "description": "222" }'
          curl -X PUT "https://sms.api.engagelab.cc/v1/contact_lists/1234"
--header "Authorization: Basic <<YOUR_SMS_KEY_HERE>>" 
--header "Content-Type: application/json" 
--data '{
    "contact_list_name": "shanghai",
    "description": "222"
}'  

        
此代碼塊在浮窗中顯示

響應說明

字段 說明
count 成功修改的個數

響應示例

Response-success

HTTP Status: 200

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

        
此代碼塊在浮窗中顯示

Response-error

HTTP Status :401

{ "code": 30000, "message": "Unauthorized." }
          {
    
    "code": 30000,
    "message": "Unauthorized."
}

        
此代碼塊在浮窗中顯示

Response-error

HTTP Status :400

// 失敗的返回結果示例 { "code": 35004, "message": "contact_list_name cannot be empty" }
          // 失敗的返回結果示例
{
    "code": 35004,
        "message": "contact_list_name cannot be empty"
}

        
此代碼塊在浮窗中顯示

刪除聯繫人列表

返回是否提交成功的基本信息

URL

https://sms.api.engagelab.cc/v1/contact_lists/{contact_list_id}
          https://sms.api.engagelab.cc/v1/contact_lists/{contact_list_id}

        
此代碼塊在浮窗中顯示

HTTP請求方式

DELETE
          DELETE

        
此代碼塊在浮窗中顯示

Content-type

application/x-www-form-urlencoded
          application/x-www-form-urlencoded

        
此代碼塊在浮窗中顯示

Request-Headers

Header 類型 必須 說明
Authorization String true Basic base64(sms_user:sms_key)

請求示例

curl -X DELETE "https://sms.api.engagelab.cc/v1/contact_lists/1234" --header "Authorization: Basic <<YOUR_SMS_KEY_HERE>>"
          curl -X DELETE "https://sms.api.engagelab.cc/v1/contact_lists/1234" 
--header "Authorization: Basic <<YOUR_SMS_KEY_HERE>>"

        
此代碼塊在浮窗中顯示

響應示例

字段 說明
count 成功刪除的個數

響應示例

Response-success

HTTP Status: 200

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

        
此代碼塊在浮窗中顯示

Response-error

HTTP Status :401

{ "code": 30000, "message": "Unauthorized." }
          {
    
    "code": 30000,
    "message": "Unauthorized."
}

        
此代碼塊在浮窗中顯示

Response-error

HTTP Status :400

// 失敗的返回結果示例 { "code": 35002, "message": "The contact_list_id does not exist" }
          // 失敗的返回結果示例
{
    "code": 35002,
        "message": "The contact_list_id does not exist"
}

        
此代碼塊在浮窗中顯示

通過以下接口可以對短信聯繫人列表的成員進行查詢, 添加, 刪除, 更新操作.

查詢聯繫人列表成員

返回短信聯繫人列表成員的基本信息

URL

https://sms.api.engagelab.cc/v1/contact_lists/{contact_list_id}/members
          https://sms.api.engagelab.cc/v1/contact_lists/{contact_list_id}/members

        
此代碼塊在浮窗中顯示

HTTP請求方式

GET
          GET

        
此代碼塊在浮窗中顯示

Request-Headers

Header 類型 必須 說明
Authorization String true Basic base64(sms_user:sms_key)

參數說明

參數 類型 必須 說明
offset Integer 查詢起始位置,取值區間 [0-],默認為 0
limit Integer 查詢個數,取值區間 [0-100],默認為 100
phone string 成員電話,支持模糊查詢
member_ids string 成員ID多個用;號分隔,最多100個

請求示例

curl -X GET "https://sms.api.engagelab.cc/v1/contact_lists/1025/members?phone=15652496875" --header "Authorization: Basic <<YOUR_SMS_KEY_HERE>>"
          curl -X GET "https://sms.api.engagelab.cc/v1/contact_lists/1025/members?phone=15652496875" 
--header "Authorization: Basic <<YOUR_SMS_KEY_HERE>>"

        
此代碼塊在浮窗中顯示

響應說明

字段 說明
member_id 成員ID
phone 成員電話
name 成員名稱
vars 變量
create_time 創建時間
update_time 更新時間

響應示例

{ "result": [ { "member_id": 440164, "phone": "18********", "name": "", "vars": "{'beizhu':'hello'}", "create_time": "2016-10-18T15:13:27+0800", "update_time": "2016-10-18T15:13:27+0800", }, { "member_id": 440964, "phone": "13********", "name": "", "vars": "{'beizhu':'ss'}", "create_time": "2016-10-18T15:13:27+0800", "update_time": "2016-10-18T15:13:27+0800", } ], "total": 2, "count": 2 }
          {
    "result": [
          {
                "member_id": 440164,
                "phone": "18********",
                "name": "",
                "vars": "{'beizhu':'hello'}",
                "create_time": "2016-10-18T15:13:27+0800",
                "update_time": "2016-10-18T15:13:27+0800",
            },
            {
                "member_id": 440964,
                "phone": "13********",
                "name": "",
                "vars": "{'beizhu':'ss'}",
                "create_time": "2016-10-18T15:13:27+0800",
                "update_time": "2016-10-18T15:13:27+0800",
            }
        ],
        "total": 2,
        "count": 2
}

        
此代碼塊在浮窗中顯示

添加聯繫人列表成員

添加聯繫人列表成員

URL

https://sms.api.engagelab.cc/v1/contact_lists/{contact_list_id}/members
          https://sms.api.engagelab.cc/v1/contact_lists/{contact_list_id}/members

        
此代碼塊在浮窗中顯示

HTTP請求方式

POST
          POST   

        
此代碼塊在浮窗中顯示

Content-type

application/json
          application/json

        
此代碼塊在浮窗中顯示

Request-Headers

Header 類型 必須 說明
Authorization String true Basic base64(sms_user:sms_key)

參數說明

參數 類型 必須 說明
members Array [object] 聯繫人列表成員,最多1000個成員
phone string 成員電話,國際手機號格式
name string 成員名稱,最長48字符
vars object 變量,最大不超過1KB

注意:

  1. 添加 vars 變量,注意 key 不需要 帶上 '%',key長度不得超過32個字符
  2. vars 變量中, key 為 name 的變量會被參數 name 覆蓋

請求示例

curl -X POST "https://sms.api.engagelab.cc/v1/contact_lists/1024/members" --header "Authorization: Basic <<YOUR_SMS_KEY_HERE>>" --header "Content-Type: application/json" --data '{ "members": [ { "phone": "+86158452369825", "name": "aaa", "vars": {"sex":"male","code":"1"} }, { "phone": "+8618754265414", "name": "aaa", "vars": {"sex":"female","code":"2"} } ] }'
          curl -X POST "https://sms.api.engagelab.cc/v1/contact_lists/1024/members"
--header "Authorization: Basic <<YOUR_SMS_KEY_HERE>>" 
--header "Content-Type: application/json" 
--data '{
    "members": [
        {
            "phone": "+86158452369825",
            "name": "aaa",
            "vars": {"sex":"male","code":"1"}
        },
        {
            "phone": "+8618754265414",
            "name": "aaa",
            "vars": {"sex":"female","code":"2"}
        }
    ]
}'  

        
此代碼塊在浮窗中顯示

響應說明

字段 說明
count 添加成功的成員數
invalid 添加失敗的成員

響應示例

Response-success

HTTP Status: 200

{ "result": { "count": 1, "invalid": ["130****"] } }
          {
   "result": {
        "count": 1,
        "invalid": ["130****"]
    }
}

        
此代碼塊在浮窗中顯示

Response-error

HTTP Status :401

{ "code": 30000, "message": "Unauthorized." }
          {
    
    "code": 30000,
    "message": "Unauthorized."
}

        
此代碼塊在浮窗中顯示

Response-error

HTTP Status :400

// 失败的返回结果示例 { "code": 35002, "message": "The contact_list_id does not exist" }
          // 失败的返回结果示例
{
    "code": 35002,
        "message": "The contact_list_id does not exist"
}

        
此代碼塊在浮窗中顯示

更新联系人列表成员

更新联系人列表成员

URL

https://sms.api.engagelab.cc/v1/contact_lists/{contact_member_id}}/members/{member_id}
          https://sms.api.engagelab.cc/v1/contact_lists/{contact_member_id}}/members/{member_id}

        
此代碼塊在浮窗中顯示

HTTP請求方式

PUT
          PUT 

        
此代碼塊在浮窗中顯示

Content-type

application/json
          application/json

        
此代碼塊在浮窗中顯示

Request-Headers

Header 類型 必須 說明
Authorization String true Basic base64(sms_user:sms_key)

參數說明

參數 類型 必須 說明
member Object 联系人列表成员
phone string 成员电话,国际号码格式
name string 成员名称,最长48字符
vars object 变量,最大不超过1KB,key长度不超过32个字符

請求示例

curl -X POST "https://sms.api.engagelab.cc/v1/contact_lists/1024/members/251224" --header "Authorization: Basic <<YOUR_SMS_KEY_HERE>>" --header "Content-Type: application/json" --data '{ "member": { "phone": "158452369825", "name": "aaa", "vars": {"sex":"male","code":"1"} } }'
          curl -X POST "https://sms.api.engagelab.cc/v1/contact_lists/1024/members/251224"
--header "Authorization: Basic <<YOUR_SMS_KEY_HERE>>" 
--header "Content-Type: application/json" 
--data '{
    "member": 
        {
            "phone": "158452369825",
            "name": "aaa",
            "vars": {"sex":"male","code":"1"}
        }
    
}'  

        
此代碼塊在浮窗中顯示

響應說明

字段 說明
count 成功更新記錄數

響應示例

Response-success

HTTP Status: 200

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

        
此代碼塊在浮窗中顯示

Response-error

HTTP Status :401

{ "code": 30000, "message": "Unauthorized." }
          {
    
    "code": 30000,
    "message": "Unauthorized."
}

        
此代碼塊在浮窗中顯示

Response-error

HTTP Status :400

// 失败的返回结果示例 { "code": 35002, "message": "The contact_list_id does not exist" }
          // 失败的返回结果示例
{
    "code": 35002,
        "message": "The contact_list_id does not exist"
}

        
此代碼塊在浮窗中顯示

刪除聯繫人列表成員

返回是否刪除成功

URL

https://sms.api.engagelab.cc/v1/contact_lists/{contact_list_id}/members/{member_id}
          https://sms.api.engagelab.cc/v1/contact_lists/{contact_list_id}/members/{member_id}

        
此代碼塊在浮窗中顯示

HTTP請求方式

DElETE
          DElETE

        
此代碼塊在浮窗中顯示

Content-type

application/x-www-form-urlencoded
          application/x-www-form-urlencoded

        
此代碼塊在浮窗中顯示

Request-Headers

Header 類型 必須 說明
Authorization String true Basic base64(sms_user:sms_key)

請求示例

curl -X DELETE "https://sms.api.engagelab.cc/v1/contact_lists/11/members/1234" --header "Authorization: Basic <<YOUR_SMS_KEY_HERE>>"
          curl -X DELETE "https://sms.api.engagelab.cc/v1/contact_lists/11/members/1234" 
--header "Authorization: Basic <<YOUR_SMS_KEY_HERE>>"

        
此代碼塊在浮窗中顯示

響應說明

字段 說明
count 成功刪除記錄數

響應示例

Response-success

HTTP Status: 200

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

        
此代碼塊在浮窗中顯示

Response-error

HTTP Status :401

{ "code": 30000, "message": "Unauthorized." }
          {
    
    "code": 30000,
    "message": "Unauthorized."
}

        
此代碼塊在浮窗中顯示

Response-error

HTTP Status :400

// 失敗的返回結果示例 { "code": 35002, "message": "The contact_list_id does not exist" }
          // 失敗的返回結果示例
{
    "code": 35002,
        "message": "The contact_list_id does not exist"
}

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