概要
- モバイルサービスのテーブル操作(挿入・更新・削除・読み込み)をREST APIにて行う。
- リクエストにはcurlコマンドを使う。
方法
コマンドの雛形は以下の通り。
見やすくするために改行をしていますが実際には改行しません。
挿入
curl https://<service_name>.azure-mobile.net/tables/<table_name>
-H "Accept: application/json"
-H "X-ZUMO-APPLICATION: <アプリケーションキー>
-H "Content-Type: application/json"
-d ‘<JSONデータ>’
更新
curl —request PATCH https://<service_name>.azure-mobile.net/tables/<table_name>/<item_id>
-H "Accept: application/json"
-H "X-ZUMO-APPLICATION: <アプリケーションキー>
-H "Content-Type: application/json"
-d ‘<JSONデータ>’
削除
curl —request DELETE https://<service_name>.azure-mobile.net/tables/<table_name>/<item_id>
-H "X-ZUMO-APPLICATION: <アプリケーションキー>
参照(読み込み)
参照については、GETリクエストでパラメータを組み立てるだけなので説明は不要と思います。
詳細はレコードのクエリの操作(公式リファレンス)を参照して下さい。
その他
カスタムAPIのコマンド操作については、Azure Mobile Services でアクセス許可を制限した Custom API に カジュアルにアクセスするが参考になります。