7 推播介面#
7.1 取得推播證書#
GET /push/certificate
請求頭#
| 參數名稱 | 資料類型 | 必填 | 描述 |
|---|---|---|---|
| access-token | string | false | Token |
| app_id | string | true | 應用程式ID |
| group_id | int64 | false | 僅當access-token為管理員token時,可以設定此欄位,表示以此群ID的管理員身份來呼叫此介面 |
| user_id | int64 | false | 僅當access-token為管理員token時,可以設定此欄位,表示以此使用者ID的身份來呼叫此介面 |
請求參數(Query Param)#
| 參數名稱 | 資料類型 | 必填 | 描述 |
|---|---|---|---|
| environment | int32 | false | 運行環境, 0 - 開發環境, 1 - 生產環境 , 預設值:1 |
| provider | int32 | true | 證書提供方, 1-APNS,2-華為,3-小米,4-魅族,5-VIVO,6-OPPO,7-FCM,8-榮耀 |
響應體#
● 200 響應資料格式:JSON
| 參數名稱 | 類型 | 描述 |
|---|---|---|
| code | int32 | 回傳碼,200是成功 |
| data | object | 結果資料 |
| ⇥ app_id | string | APP ID |
| ⇥ app_key | string | APP KEY |
| ⇥ app_secret | string | APP SECRET |
| ⇥ certificate | string | 證書 |
| ⇥ name | string | 證書名稱 |
| message | string | 錯誤信息,如果成功,該項為null |
介面描述#
7.2 發推播通知#
POST /push/notify
請求頭#
| 參數名稱 | 資料類型 | 必填 | 描述 |
|---|---|---|---|
| access-token | string | false | Token |
| app_id | string | true | 應用程式ID |
| group_id | int64 | false | 僅當access-token為管理員token時,可以設定此欄位,表示以此群ID的管理員身份來呼叫此介面 |
| user_id | int64 | false | 僅當access-token為管理員token時,可以設定此欄位,表示以此使用者ID的身份來呼叫此介面 |
請求體(Request Body)#
| 參數名稱 | 資料類型 | 必填 | 預設值 | 描述 |
|---|---|---|---|---|
| audience | object | false | 推播目標, 不可為空。類型為字串或JSONObject: "all", 表示發給所有設備 {"tag":["tag1","tag2"]} 表示發給標籤為tag1或tag2的設備 {"alias":["alias1","alias2"]} 表示發給別名為alias1或alias2的設備 {"user_id":[111,222]} 表示發給使用者ID為111或222的設備 {"push_token":["push_token1","push_token2"]} 表示發給PushToken為push_token1或push_token2的設備 使用標籤/別名/使用者ID/pushToken推播時,列表長度不能超過500 | |
| setting | object | false | 推播設定,可為空 | |
| ⇥ request_id | string | false | 請求ID,用於請求去重,如果請求ID以前出現過,則不推播。可為空,為空則不去重。 | |
| ⇥ distribution_strategy | string | false | 通知下發策略: combined - 表示先使用藍鶯通道下發,藍鶯不線上,則使用廠商通道下發;mxpush_only - 表示只使用藍鶯通道下發; ospush_only - 表示只使用廠商通道下發。 可為空,為空則預設為combined | |
| ⇥ ospush_sequence | array[string] | false | 廠商推播順序:ups - 國內廠商(小米/華為/魅族/oppo/vivo); fcm - FCM推播;huawei - 華為推播;xiaomi - 小米推播; oppo - OPPO推播; vivo - VIVO推播, meizu - 魅族推播。可為空,為空則預設為[ups,fcm] | |
| message | object | false | 推播訊息體, 不可為空 | |
| ⇥ type | string | false | 訊息類型:text - 文本,image - 圖片, cmd - 透傳訊息。可為空,為空則預設為text | |
| ⇥ title | string | false | 標題。可為空 | |
| ⇥ body | string | false | 內容。可為空 | |
| ⇥ attachment_url | string | false | 附件地址: 圖片/音訊/視訊的URL地址。可為空。如果是圖片地址,需要以jpg/jpeg/png結尾,圖片大小需小於1M,推薦876*324px | |
| ⇥ big_text | string | false | 大文本: 如果設定此欄位,並且廠商支持推播大文本,則使用此欄位推播大文本,否則使用body欄位的文本推播普通文本 | |
| ⇥ badge | string | false | 應用程式角標: 如果為數字,則修改角標為此數字;如果以+開頭,表示增加此數字到角標,如"+1", 表示角標數加1;如果為空,預設為"+1" | |
| ⇥ ext | object | false | 擴展欄位:可為空,類型為JSONObject, 例如: {"key1":123, "key2":"value2"} | |
| ⇥ show_begin_time | int64 | false | 定時展示的開始時間戳(秒), 為空時表示立即展示 | |
| ⇥ show_end_time | int64 | false | 定時展示的結束時間戳(秒),可為空 | |
| ⇥ ios | object | false | android額外參數,可為空 | |
| ⇥⇥ sound | string | false | 通知提示聲音, 可為空 | |
| ⇥⇥ content_available | boolean | false | 對應APNs的content-available,可為空 | |
| ⇥⇥ mutable_content | boolean | false | 對應APNs的mutable-content, 可為空 | |
| ⇥⇥ category | string | false | 對應APNs Payload中的category, 可為空 | |
| ⇥⇥ thread_id | string | false | 對應APNs的thread-id,可為空,通過該屬性來對通知進行分組,相同thread-id 的通知歸為一組 | |
| ⇥⇥ subtitle | string | false | 對應APNs的subtitle,可為空 | |
| ⇥⇥ apns_collapse_id | string | false | 對應APNs的apns-collapse-id,可為空,通知攜帶apns-collapse-id 參數,將會覆蓋通知中心裡攜帶相同apns-collapse-id的通知。 | |
| ⇥ android | object | false | ios額外參數,可為空 | |
| ⇥⇥ sound | string | false | 通知提示聲音,可為空 | |
| ⇥⇥ channel_id | string | false | 通知欄通道,可為空 | |
| ⇥⇥ click_action | string | false | 點擊通知的後續動作: intent 打開應用程式特定頁面; open_app 打開應用程式首頁。可為空 | |
| ⇥⇥ intent | string | false | 點擊通知打開應用程式特定頁面: 可為空,click_action為intent時不可為空。示例:intent:#Intent;component=包名/activity全路徑;S.parm1=value1;S.parm2=value2;end | |
| ⇥ huawei | object | false | huawei廠商額外參數 | |
| ⇥⇥ sound | string | false | 通知提示聲音,可為空 | |
| ⇥⇥ channel_id | string | false | 通知欄通道,可為空 | |
| ⇥⇥ click_action | string | false | 點擊通知的後續動作: intent 打開應用程式特定頁面; open_app 打開應用程式首頁。可為空 | |
| ⇥⇥ intent | string | false | 點擊通知打開應用程式特定頁面: 可為空,click_action為intent時不可為空。示例:intent:#Intent;component=包名/activity全路徑;S.parm1=value1;S.parm2=value2;end | |
| ⇥⇥ badge_class | string | false | 桌面圖標對應的應用程式入口Activity類, 比如 com.test.badge.MainActivity, 可為空 | |
| ⇥ xiaomi | object | false | xiaomi廠商額外參數 | |
| ⇥⇥ sound | string | false | 通知提示聲音,可為空 | |
| ⇥⇥ channel_id | string | false | 通知欄通道,可為空 | |
| ⇥⇥ click_action | string | false | 點擊通知的後續動作: intent 打開應用程式特定頁面; open_app 打開應用程式首頁。可為空 | |
| ⇥⇥ intent | string | false | 點擊通知打開應用程式特定頁面: 可為空,click_action為intent時不可為空。示例:intent:#Intent;component=包名/activity全路徑;S.parm1=value1;S.parm2=value2;end | |
| ⇥ oppo | object | false | oppo廠商額外參數 | |
| ⇥⇥ sound | string | false | 通知提示聲音,可為空 | |
| ⇥⇥ channel_id | string | false | 通知欄通道,可為空 | |
| ⇥⇥ click_action | string | false | 點擊通知的後續動作: intent 打開應用程式特定頁面; open_app 打開應用程式首頁。可為空 | |
| ⇥⇥ intent | string | false | 點擊通知打開應用程式特定頁面: 可為空,click_action為intent時不可為空。示例:intent:#Intent;component=包名/activity全路徑;S.parm1=value1;S.parm2=value2;end | |
| ⇥ vivo | object | false | vivo廠商額外參數 | |
| ⇥⇥ sound | string | false | 通知提示聲音,可為空 | |
| ⇥⇥ channel_id | string | false | 通知欄通道,可為空 | |
| ⇥⇥ click_action | string | false | 點擊通知的後續動作: intent 打開應用程式特定頁面; open_app 打開應用程式首頁。可為空 | |
| ⇥⇥ intent | string | false | 點擊通知打開應用程式特定頁面: 可為空,click_action為intent時不可為空。示例:intent:#Intent;component=包名/activity全路徑;S.parm1=value1;S.parm2=value2;end | |
| ⇥⇥ push_mode | int32 | false | 推播模式: 0-正式推播;1-測試推播,不填預設為0 | |
| ⇥⇥ classification | int32 | false | 訊息類型 0:運營類訊息,1:系統類訊息。不填預設為0 | |
| ⇥ flyme | object | false | 魅族廠商額外參數 | |
| ⇥⇥ sound | string | false | 通知提示聲音,可為空 | |
| ⇥⇥ channel_id | string | false | 通知欄通道,可為空 | |
| ⇥⇥ click_action | string | false | 點擊通知的後續動作: intent 打開應用程式特定頁面; open_app 打開應用程式首頁。可為空 | |
| ⇥⇥ intent | string | false | 點擊通知打開應用程式特定頁面: 可為空,click_action為intent時不可為空。示例:intent:#Intent;component=包名/activity全路徑;S.parm1=value1;S.parm2=value2;end | |
| ⇥ fcm | object | false | fcm廠商額外參數 | |
| ⇥⇥ sound | string | false | 通知提示聲音,可為空 | |
| ⇥⇥ channel_id | string | false | 通知欄通道,可為空 | |
| ⇥⇥ click_action | string | false | 點擊通知的後續動作: intent 打開應用程式特定頁面; open_app 打開應用程式首頁。可為空 | |
| ⇥⇥ intent | string | false | 點擊通知打開應用程式特定頁面: 可為空,click_action為intent時不可為空。示例:intent:#Intent;component=包名/activity全路徑;S.parm1=value1;S.parm2=value2;end | |
| ⇥ honor | object | false | honor廠商額外參數 | |
| ⇥⇥ sound | string | false | 通知提示聲音,可為空 | |
| ⇥⇥ channel_id | string | false | 通知欄通道,可為空 | |
| ⇥⇥ click_action | string | false | 點擊通知的後續動作: intent 打開應用程式特定頁面; open_app 打開應用程式首頁。可為空 | |
| ⇥⇥ intent | string | false | 點擊通知打開應用程式特定頁面: 可為空,click_action為intent時不可為空。示例:intent:#Intent;component=包名/activity全路徑;S.parm1=value1;S.parm2=value2;end | |
| ⇥⇥ badge_class | string | false | 桌面圖標對應的應用程式入口Activity類, 比如 com.test.badge.MainActivity, 可為空 |
響應體#
● 200 響應資料格式:JSON
| 參數名稱 | 類型 | 描述 |
|---|---|---|
| code | int32 | 回傳碼,200是成功 |
| data | object | 結果資料 |
| ⇥ task_id | int64 | 任務ID |
| message | string | 錯誤信息,如果成功,該項為null |
介面描述#
7.3 查詢推播統計結果#
POST /push/task/detail
請求頭#
| 參數名稱 | 資料類型 | 必填 | 描述 |
|---|---|---|---|
| access-token | string | false | Token |
| app_id | string | true | 應用程式ID |
| group_id | int64 | false | 僅當access-token為管理員token時,可以設定此欄位,表示以此群ID的管理員身份來呼叫此介面 |
| user_id | int64 | false | 僅當access-token為管理員token時,可以設定此欄位,表示以此使用者ID的身份來呼叫此介面 |
請求體(Request Body)#
| 參數名稱 | 資料類型 | 必填 | 預設值 | 描述 |
|---|---|---|---|---|
| list | array[int64] | true | 任務ID列表 |
響應體#
● 200 響應資料格式:JSON
| 參數名稱 | 類型 | 描述 |
|---|---|---|
| code | int32 | 回傳碼,200是成功 |
| data | array[object] | 結果資料 |
| ⇥ apns_received | int64 | APNs通道送達數 |
| ⇥ apns_sent | int64 | APNs通道發送數 |
| ⇥ apns_target | int64 | APNs通道有效目標數 |
| ⇥ fcm_received | int64 | FCM通道送達數 |
| ⇥ fcm_sent | int64 | FCM通道發送數 |
| ⇥ fcm_target | int64 | FCM通道有效目標數 |
| ⇥ flyme_received | int64 | 魅族通道送達數 |
| ⇥ flyme_sent | int64 | 魅族通道發送數 |
| ⇥ flyme_target | int64 | 魅族通道有效目標數 |
| ⇥ honor_received | int64 | 榮耀通道送達數 |
| ⇥ honor_sent | int64 | 榮耀通道發送數 |
| ⇥ honor_target | int64 | 榮耀通道有效目標數 |
| ⇥ huawei_received | int64 | 華為通道送達數 |
| ⇥ huawei_sent | int64 | 華為通道發送數 |
| ⇥ huawei_target | int64 | 華為通道有效目標數 |
| ⇥ mxpush_received | int64 | 藍鶯通道送達數 |
| ⇥ mxpush_sent | int64 | 藍鶯通道發送數 |
| ⇥ mxpush_target | int64 | 藍鶯通道有效目標數 |
| ⇥ oppo_received | int64 | oppo通道送達數 |
| ⇥ oppo_sent | int64 | oppo通道發送數 |
| ⇥ oppo_target | int64 | oppo通道有效目標數 |
| ⇥ vivo_received | int64 | vivo通道送達數 |
| ⇥ vivo_sent | int64 | vivo通道發送數 |
| ⇥ vivo_target | int64 | vivo通道有效目標數 |
| ⇥ xiaomi_received | int64 | 小米通道送達數 |
| ⇥ xiaomi_sent | int64 | 小米通道發送數 |
| ⇥ xiaomi_target | int64 | 小米通道有效目標數 |
| ⇥ task_id | int64 | 推播任務ID |
| message | string | 錯誤信息,如果成功,該項為null |