Push通知を送信するためのAPIです。

URL

  • POST
    http://{AppPot Server name}:{Port}/{Context root}/api/{companyId}/{appId}/{appVersion}/messages
    

Authentication

ユーザー認証が完了している必要があります。

Content-Type: application/json
apppot-token: token

Name Data Format Description
apppot-token String (Required) Login APIの結果得られたユーザートークン

Request parameters

Name Data Format Description
targetApp TargetApp (Option) ターゲットのアプリのAppId、AppVersionを指定します。省略した場合、ログインしているアプリが対象となります。
target List<Target> / String (Required) Value can be “all” if want to send to all users relate to target app or individual userName / groupId-roleId
title String (Opution) Pushメッセージのタイトル
message String (Required) Pushメッセージの本文
sendAt String (Optional) 送信日時を指定。省略した場合、すぐに送信されます。 Ex: “2014-09-10T14:44:10.939-07:00”. If the user does not set this element, AppPot Server will send it immediately.
icon String (Optional) 通知メッセージのアイコン。Androidのみで有効
badge String (Optional) アプリアイコンに表示されるバッジ数。iOSのみで有効
sound String (Optional) 通知メッセージの通知音
titleLocKey String (Optional) タイトルを文字列リソースファイルから取得する場合のキー名
titleLocArgs 文字列の配列 (Optional) タイトルで指定された書式の一部を指定された配列の値で置換する
messageLocKey String (Optional) 本文を文字列リソースファイルから取得する場合のキー名
messageLocArgs 文字列の配列 (Optional) 本文で指定された書式の一部を指定された配列の値で置換する
customData 連想配列 (Optional) 任意の値をKey、Valueの形式で複数指定できる

titleLocArgs、messageLocArgsの書式の詳細はAPNs、GCMの国際化(ローカライズ)のマニュアルを参照してください。

宛先の指定

User can choose multiple targets.
宛先は、全体、グループ、ユーザーを指定することができます。

全体

全体’all’を指定した場合、同じテナントに属するすべてのユーザーにプッシュ通知が送信されます。

グループ指定

送信するグループと、ロールを指定できます。
ロールを省略した場合、指定したグループのすべてのロールのユーザーに送信されます。

Name Data Format Description
groupId Long (Option) User groupId
roleName String (Option) User roleName. If exist groupId without roleName, then will send to all users in group
ユーザー指定

個人のユーザーを指定できます。

Name Data Format Description
account String (option) User account

Request example

Ex1: 個人宛

{
  "targetApp":{
    "appId": "test1",
    "appVersion": "1.0"
  },
  "target":[
    {
      "groupId": 1,
      "roleName": "Manager"
    },
    {
      "groupId": 2
    },
    {
      "account": "yamada@apppot.ne.jp"
    },
    {
      "account": "suzuki@apppot.ne.jp"
    }
  ],
  "title":"タイトルです",
  "message":"messageBody",
  "sendAt":"sendAt",
  "icon":"myicon",
  "sound":"mysound",
  "badge":"123",
  "messageLocKey":"",
  "messageLocArgs":["1","2","3"],
  "titleLocKey":"",
  "titleLocArgs":["a","b","c"],
  "customData":{
        "foo":"this is foo message.",
        "bar":"this is bar message."
  }
}

Ex2: 全員宛

{
  "target":[
    {
      "all": true,
    }
  ],
  "title":"タイトルです",
  "message":"messageBody",
  "icon":"myicon",
  "sound":"mysound",
  "badge":"123",
  "messageLocKey":"",
  "messageLocArgs":["1","2","3"],
  "titleLocKey":"",
  "titleLocArgs":["a","b","c"],
  "customData":{
        "foo":"this is foo message.",
        "bar":"this is bar message."
  }
}

Response example

{
    "errCode": 0,
    "status": "OK",
    "description": null
}

Response properties

Name Data Format Description
errCode int Response error code: 0, 101, 105, 106, 107, 109, 120, 121, 122, 170, 198, 199, 800, 801
status String (Required) API result status value.
description String (Optional) Detail status if error.