業務サーバからサーバ側のAPIを呼び出せます。
サーバ側のアプリケーションから呼び出す場合も、アプリケーション管理者によるアクセス制御を使用します。
詳細は、「7.4.1 サーバ側のAPI」を参照してください。
以下はメッセージ送信APIを呼び出す例です。
HttpClientBuilder httpclient = HttpClientBuilder.create(); String b64_authval = "1234567890abcdefghijklmnop=="; String url = "http://ホスト名:ポート/pushidmng/notify"; StringBuilder sb = new StringBuilder(); sb.append("{"); sb.append(" \"APNs\": {"); sb.append(" \"aps\": {"); sb.append(" \"alert\": \"test\","); sb.append(" \"sound\": \"bingbong.aiff\","); sb.append(" \"badge\": 7"); sb.append(" }"); sb.append(" },"); sb.append(" \"regIDs\": ["); sb.append(" \"1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef\""); sb.append(" ]"); sb.append("}"); HttpPost httpPost = new HttpPost(url); httpPost.setHeader("IMAPS-Authorization", "Basic " + b64_authval); httpPost.setHeader("Content-Type", "application/json; charset=UTF-8"); httpPost.setEntity(new StringEntity(sb.toString(),"UTF-8")); im_response = httpclient.build().execute(httpPost);
上記の例では、Apache HttpClientのOSSを使用しています。
注意
Javaアプリケーションのみサポートします。