{"action":"created","issue":{"url":"https://api.github.com/repos/EC-CUBE/ec-cube/issues/9","labels_url":"https://api.github.com/repos/EC-CUBE/ec-cube/issues/9/labels{/name}","comments_url":"https://api.github.com/repos/EC-CUBE/ec-cube/issues/9/comments","events_url":"https://api.github.com/repos/EC-CUBE/ec-cube/issues/9/events","html_url":"https://github.com/EC-CUBE/ec-cube/issues/9","id":52201287,"number":9,"title":"WebAPIを実装する","user":{"login":"shinichi-takahashi","id":9044511,"avatar_url":"https://avatars.githubusercontent.com/u/9044511?v=3","gravatar_id":"","url":"https://api.github.com/users/shinichi-takahashi","html_url":"https://github.com/shinichi-takahashi","followers_url":"https://api.github.com/users/shinichi-takahashi/followers","following_url":"https://api.github.com/users/shinichi-takahashi/following{/other_user}","gists_url":"https://api.github.com/users/shinichi-takahashi/gists{/gist_id}","starred_url":"https://api.github.com/users/shinichi-takahashi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shinichi-takahashi/subscriptions","organizations_url":"https://api.github.com/users/shinichi-takahashi/orgs","repos_url":"https://api.github.com/users/shinichi-takahashi/repos","events_url":"https://api.github.com/users/shinichi-takahashi/events{/privacy}","received_events_url":"https://api.github.com/users/shinichi-takahashi/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/EC-CUBE/ec-cube/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2014-12-17T04:47:49Z","updated_at":"2015-12-29T05:23:04Z","closed_at":"2015-12-29T05:23:04Z","body":"#### 認証\r\n\r\nOAuth 2.0？SAML？要検討\r\n\r\n\r\n#### 通信方式(REST)\r\nHTTP メソッドをリソースの操作とする。\r\n* POST：create\r\n* GET：read\r\n* PUT：update\r\n* DELETE：delete\r\n\r\n#### URL\r\n 例）`/api/[リソース]/`\r\n \r\n  * 顧客IDの一覧を取得する\r\n```\r\n    GET ~/api/customer/\r\n```\r\n\r\n  * 新規の顧客データを作成する\r\n```\r\n    POST ~/api/customer/\r\n```\r\n\r\n  * [DB系] ※要検討\r\n    + /api/db/customer/\r\n    + /api/db/product/\r\n    + /api/db/order/\r\n\r\n  * [振る舞い系] ※要検討\r\n    + カート情報確認\r\n    + カートに入れる\r\n    + カート削除\r\n    + お届け先の指定\r\n    + 支払方法、お届け日時の指定\r\n    + 購入情報最終確認\r\n    + ログイン\t/api/login/\r\n    + ログアウト\t/api/logout/\r\n    + メール送信\r\n\r\n#### パラメータ\r\nパラメータはJSON形式で渡す。\r\n\r\n#### GETパラメータ例\r\n\r\n```\r\n~/api/customer/?json=\r\n{\r\n    include: [ \"id\", \"name\", \"*\"],      // 取得するカラム\r\n    filter: {\r\n        \"name\": [\"test\", \"aaaa\", \"test example\"],          // name に test と example を両方含む\r\n          // -> where name = test or name = aaaa or (name = test and name = expamle)\r\n        \"kana\": [\"hoge\"]\r\n          // -> and kana = \"hoge\"\r\n    },\r\n    sort: {\"id\":\"asc\", \"create_date\":\"desc\"}, \r\n    limit: 50,\r\n    offset: 100,\r\n}\r\n```\r\n\r\n\r\n#### POSTパラメータ例\r\n```\r\n~/api/customer/?json=\r\n{\r\n    include: [ {\"name\":\"ほげほげ\"}, {\"kana\":\"ホゲホゲ\"}]\r\n}\r\n```\r\n\r\n#### PUTパラメータ例\r\n```\r\n~/api/customer/?json=\r\n{\r\n    filter: {\r\n        \"id\": \"1\",\r\n        \"name\": \"test example\",          // name に test と example を両方含む\r\n        \"name\": [ \"1test\", \"example\" ]   // name が test または example に完全一致\r\n    },\r\n    include: [ {\"name\":\"ほげほげ\"}, {\"kana\":\"ホゲホゲ\"}]\r\n}\r\n```\r\n\r\n#### DELETEパラメータ例\r\n```\r\n~/api/customer/?json=\r\n{\r\n    filter: {\r\n        \"id\": \"1\",\r\n        \"name\": \"test example\",          // name に test と example を両方含む\r\n        \"name\": [ \"1test\", \"example\" ]   // name が test または example に完全一致\r\n    }\r\n}\r\n```\r\n\r\n#### レスポンス\r\nパラメータはJSON形式で渡す。\r\n* HTTPステータスコード「200,201」：OK (POSTの場合のみ、201)\r\n* HTTPステータスコード「200,201以外」：NG\r\n\r\n| APIの処理の結果 | ステータス・コード | Body |\r\n|-----------------|--------------------|------|\r\n| 対象データの取得・削除に成功した場合 | 200 OK | 対象となるデータが格納される {success: true, customer:{\"id\":xxxx,…}, error_message: \"\"} |\r\n| 対象データの追加に成功した場合 | 201 Created | {success: true, error_message: \"\"} |\r\n| 対象データの更新に成功した場合 | 200 OK | {success: true, error_message: \"\"} |\r\n| リクエストに検証エラーが存在する場合 | 400 Bad Request | 検証エラー情報が格納される {success: false, error_message: \"xxxx\"} |\r\n| 対象データが存在しない場合 | 404 Not Found | {success: true, error_message: \"\"} |\r\n| メソッド内で例外が発生した場合 | 500 Internal Server Error | エラー情報が格納される {success: false, error_message: \"xxxx\"} |\r\n"},"comment":{"url":"https://api.github.com/repos/EC-CUBE/ec-cube/issues/comments/167720938","html_url":"https://github.com/EC-CUBE/ec-cube/issues/9#issuecomment-167720938","issue_url":"https://api.github.com/repos/EC-CUBE/ec-cube/issues/9","id":167720938,"user":{"login":"chihiro-adachi","id":8196725,"avatar_url":"https://avatars.githubusercontent.com/u/8196725?v=3","gravatar_id":"","url":"https://api.github.com/users/chihiro-adachi","html_url":"https://github.com/chihiro-adachi","followers_url":"https://api.github.com/users/chihiro-adachi/followers","following_url":"https://api.github.com/users/chihiro-adachi/following{/other_user}","gists_url":"https://api.github.com/users/chihiro-adachi/gists{/gist_id}","starred_url":"https://api.github.com/users/chihiro-adachi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chihiro-adachi/subscriptions","organizations_url":"https://api.github.com/users/chihiro-adachi/orgs","repos_url":"https://api.github.com/users/chihiro-adachi/repos","events_url":"https://api.github.com/users/chihiro-adachi/events{/privacy}","received_events_url":"https://api.github.com/users/chihiro-adachi/received_events","type":"User","site_admin":false},"created_at":"2015-12-29T05:23:04Z","updated_at":"2015-12-29T05:23:04Z","body":"API機能に関する課題を別途整理のため、本issueはクローズします。"}}