[[FrontPage]]

&size(24){ユーザーAPI/Notification登録};

* API情報 [#q6190828]

|~名称|Notification登録|
|~APIバージョン|1|
|~認証タイプ|ユーザー認証|
|~URL|https://(APIサーバー名)/services/api/(アクセスコード)/|
|~Method|POST|
|~データ形式|application/x-www-form-urlencoded|

* 概要 [#jfe13a2c]

Notificationを登録する。

* パラメーター [#ya59d11f]

|引数名|値|型|必須|内容|h
|v|1(固定)|int定数|必須|バージョン番号&br;現在は1|
|c|Bu(固定)|string定数|必須|コマンド&br;Bu = ユーザー認証付きBBAPIを呼び出す|
|Category|ANU(固定)|string定数|必須|オペレーションカテゴリー&br;ANU = Application Notification|
|Operation|poo(固定)|string定数|必須|オペレーション&br;poo = PUTオペレーション|
|AppKey|アプリケーションキー|string|必須|アプリケーションキーペアのアプリケーションキー|
|UserAuth|ユーザー認証タイプ|string|必須|userhashbb|
|uid|モバイルダイエットID|string|uidまたはloginidのいずれか必須|ユーザーのモバイルダイエットID|
|loginid|ログインID|string|uidまたはloginidのいずれか必須|ユーザーのログインID|
|password|パスワードハッシュ値|hash|必須|sha1(アプリケーションシークレット+パスワード) の値|
|StructData|登録データ|xml|必須|登録Notificationデータ|
|Format|json,yaml,xml|string定数|任意|出力フォーマット指定&br;省略時json(またはアプリケーションキー毎に指定のフォーマット)|
|Charset|UTF-8,SJIS,EUC-JP|string定数|任意|出力文字コード指定・省略時UTF8&br;出力フォーマットjson,xml時は常にUTF-8|
認証パラメーターAppKey,UserAuth,uid,passwordについては、[[API認証>API認証#authtype_user]]を参照~
出力指定パラメーターFormat,Charsetについては、[[出力フォーマット]]を参照~

* 登録データXML [#d1118dc6]

** データ定義XML構成 [#sbcdc85d]
 NotificationSetタグ: ルートノード
 Notificationタグ: Notificationのエントリ
 sdateタグ: 告知すべき日時
 actタグ: 推奨する動作 openurl=URLを開く
 messageタグ: 表示メッセージ
 urlタグ: 関連するURL
 overrideタグ: 推奨するオーバーライド処理 true/false

** XML例 [#g9ecbe25]
#html{{
<pre class="brush:xml;">
}}
#htmlinsert(samxml_mobadaiapi_notification_put.xml)
#html{{
</pre>
}}

* 返値 [#e86e04c1]

|変数名|型|内容|h
|api_result|boolean|API実行結果&br;true:成功 false:失敗|
|registed|integer|登録された数|
|struct|array|結果の配列|

結果の配列
|変数名|型|内容|h
|result|boolean|登録処理の結果|
|objectid|string|通知オブジェクトID|

** JSONの例 [#a81f6668]
#html{{
<pre class="brush:xml;">
{
	"api_result":true,
	"struct":[
		{
			"result":true,
			"objectid":"ANeae2533351846f6b"
		},
		{
			"result":true,
			"objectid":"ANeae25333518554f6"
		}
	],
	"registed":2
}
</pre>
}}


** XMLの例 [#a81f6668]
#html{{
<pre class="brush:xml;">
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;response&gt;
	&lt;api_result&gt;1&lt;/api_result&gt;
	&lt;struct&gt;
		&lt;item&gt;
			&lt;result&gt;1&lt;/result&gt;
			&lt;objectid&gt;ANeae2533352222d07&lt;/objectid&gt;
		&lt;/item&gt;
		&lt;item&gt;
			&lt;result&gt;1&lt;/result&gt;
			&lt;objectid&gt;ANeae2533352227453&lt;/objectid&gt;
		&lt;/item&gt;
	&lt;/struct&gt;
	&lt;registed&gt;2&lt;/registed&gt;
&lt;/response&gt;
</pre>
}}

* サンプル [#z5db7844]

PHPサンプル [[サンプル/PHP/ユーザーAPI/Notification登録]]

* バージョン [#o0becc47]

このドキュメントのバージョン情報
|Version|1|
|Revision|1|
|Editor|west|

トップ   差分 履歴 リロード   一覧 検索 最終更新   ヘルプ   最終更新のRSS