| | swagger: "2.0" |
---|
| | info: |
---|
| | description: "これはユーザ情報に関するAPIです。" |
---|
| | description: "これはCosmosのuserAPIです。" |
---|
| | version: "1.0.0" |
---|
| | title: "user API" |
---|
| | title: "User API" |
---|
| | termsOfService: "http://swagger.io/terms/" |
---|
| | host: "nitta-lab-www.is.konan-u.ac.jp" |
---|
| | basePath: "/cosmos" |
---|
| | schemes: |
---|
| | - "https" |
---|
| |
---|
| | description: "新しいユーザーを登録します。" |
---|
| | consumes: |
---|
| | - "multipart/form-data" |
---|
| | parameters: |
---|
| | - name: "uid" |
---|
| | - name: "uId" |
---|
| | in: "formData" |
---|
| | description: "ユーザーID" |
---|
| | required: true |
---|
| | type: "string" |
---|
| |
---|
| | in: "formData" |
---|
| | description: "ユーザーの名前" |
---|
| | required: true |
---|
| | type: "string" |
---|
| | - name: "pass" |
---|
| | in: "formData" |
---|
| | description: "ユーザーのpass" |
---|
| | - name: "pw" |
---|
| | in: "formData" |
---|
| | description: "ユーザーのパスワード" |
---|
| | required: true |
---|
| | type: "string" |
---|
| | - name: "icon-image" |
---|
| | in: "formData" |
---|
| | description: "アイコンイメージ" |
---|
| | required: true |
---|
| | type: "string" |
---|
| | # [$ref: "#/definitions/Parametars"] |
---|
| | description: "アイコンイメージ(base64)" |
---|
| | required: false |
---|
| | type: "string" |
---|
| | responses: |
---|
| | 201: |
---|
| | description: "Userdate created" |
---|
| | |
---|
| | description: "成功時のレスポンス" |
---|
| | schema: |
---|
| | $ref: "#/definitions/User" |
---|
| | |
---|
| | /users/createWithArray: |
---|
| | post: |
---|
| | summary: "Creates list of users with given input array" |
---|
| | description: "" |
---|
| | consumes: |
---|
| | - "multipart/form-data" |
---|
| | parameters: |
---|
| | - name: "uid" |
---|
| | in: "formData" |
---|
| | description: "ユーザーID" |
---|
| | required: true |
---|
| | type: "string" |
---|
| | - name: "name" |
---|
| | in: "formData" |
---|
| | description: "ユーザーの名前" |
---|
| | required: true |
---|
| | type: "string" |
---|
| | - name: "pass" |
---|
| | in: "formData" |
---|
| | description: "ユーザーのpass" |
---|
| | required: true |
---|
| | type: "string" |
---|
| | - name: "icon-image" |
---|
| | in: "formData" |
---|
| | description: "アイコンイメージ" |
---|
| | required: true |
---|
| | type: "string" |
---|
| | # [$ref: "#/definitions/Parametars"] |
---|
| | responses: |
---|
| | default: |
---|
| | description: "処理が成功しました。" |
---|
| | |
---|
| | /users/login: |
---|
| | get: |
---|
| | summary: "Logs user into the system." |
---|
| | description: "" |
---|
| | parameters: |
---|
| | - name: "userId" |
---|
| | in: "query" |
---|
| | description: "ログインのためのユーザ名" |
---|
| | required: true |
---|
| | type: "string" |
---|
| | - name: "password" |
---|
| | in: "query" |
---|
| | description: "ログインのためのパスワード" |
---|
| | required: true |
---|
| | type: "string" |
---|
| | responses: |
---|
| | 200: |
---|
| | description: "処理に成功" |
---|
| | 400: |
---|
| | description: "ユーザ名もしくはパスワードが間違っています。" |
---|
| | |
---|
| | /users/logout: |
---|
| | get: |
---|
| | summary: "Logs out current logged in user session." |
---|
| | description: "" |
---|
| | parameters: [] |
---|
| | responses: |
---|
| | default: |
---|
| | description: "ログアウトしました。" |
---|
| | |
---|
| | /users/{userId}: |
---|
| | /users/{uId}: |
---|
| | get: |
---|
| | summary: "ユーザー情報を取得" |
---|
| | description: "userIdを指定してユーザーの情報を取得します。" |
---|
| | parameters: |
---|
| | - name: "userId" |
---|
| | in: "path" |
---|
| | required: true |
---|
| | type: "string" |
---|
| | responses: |
---|
| | 200: |
---|
| | description: "succesful operation." |
---|
| | schema: |
---|
| | $ref: "#/definitions/User" |
---|
| | consumes: |
---|
| | - "multipart/form-data" |
---|
| | parameters: |
---|
| | - name: "uId" |
---|
| | in: "path" |
---|
| | description: "検索したいユーザーID" |
---|
| | required: true |
---|
| | type: "string" |
---|
| | - name: "token" |
---|
| | in: "formData" |
---|
| | description: "端末が所持するトークン" |
---|
| | required: true |
---|
| | type: "string" |
---|
| | responses: |
---|
| | 200: |
---|
| | description: "成功時のレスポンス" |
---|
| | schema: |
---|
| | type: "object" |
---|
| | properties: |
---|
| | name: |
---|
| | type: "string" |
---|
| | example: "甲南 太郎" |
---|
| | icon-uri: |
---|
| | type: "string" |
---|
| | 400: |
---|
| | description: "無効なユーザー名が指定されました。" |
---|
| | 404: |
---|
| | description: "ユーザーが見つかりませんでした。" |
---|
| | # put: |
---|
| | # summary: "Updated user." |
---|
| | # description: "ログインしているユーザのみが行えます。" |
---|
| | # consumes: |
---|
| | # - "multipart/form-data" |
---|
| | # parameters: |
---|
| | # - name: "userId" |
---|
| | # in: "path" |
---|
| | # description: "ユーザ名の更新" |
---|
| | # required: true |
---|
| | # type: "string" |
---|
| | # - name: "newName" |
---|
| | # in: "formData" |
---|
| | # description: "ユーザーの名前" |
---|
| | # required: true |
---|
| | # type: "string" |
---|
| | # responses: |
---|
| | # 400: |
---|
| | # description: "無効なユーザが指定されました。" |
---|
| | # 404: |
---|
| | # description: "ユーザが見つかりませんでした。" |
---|
| | put: |
---|
| | summary: "ユーザー情報を更新" |
---|
| | description: "ログインしているユーザのみが行えます。" |
---|
| | consumes: |
---|
| | - "multipart/form-data" |
---|
| | parameters: |
---|
| | - name: "uId" |
---|
| | in: "path" |
---|
| | description: "ユーザーIDの取得" |
---|
| | required: true |
---|
| | type: "string" |
---|
| | - name: "token" |
---|
| | in: "formData" |
---|
| | description: "ユーザー情報を更新したいユーザーのトークン" |
---|
| | required: true |
---|
| | type: "string" |
---|
| | - name: "name" |
---|
| | in: "formData" |
---|
| | description: "ユーザー名の更新" |
---|
| | required: true |
---|
| | type: "string" |
---|
| | - name: "pw" |
---|
| | in: "formData" |
---|
| | description: "パスワードの更新" |
---|
| | required: true |
---|
| | type: "string" |
---|
| | - name: "icon-image" |
---|
| | in: "formData" |
---|
| | description: "アイコンイメージの更新(base64)" |
---|
| | required: false |
---|
| | type: "string" |
---|
| | responses: |
---|
| | 200: |
---|
| | description: "更新しました" |
---|
| | schema: |
---|
| | type: "object" |
---|
| | properties: |
---|
| | uId: |
---|
| | type: "string" |
---|
| | example: "1234" |
---|
| | uri: |
---|
| | type: "string" |
---|
| | example: "http://nitta-lab-www.is.konan-u.ac.jp/cosmos/users/{uId}" |
---|
| | delete: |
---|
| | summary: "ユーザー情報を削除" |
---|
| | description: "userIdを指定してユーザーの情報を削除します。" |
---|
| | parameters: |
---|
| | - name: "userId" |
---|
| | in: "path" |
---|
| | description: "削除したいユーザーのuserId" |
---|
| | required: true |
---|
| | type: "string" |
---|
| | responses: |
---|
| | consumes: |
---|
| | - "multipart/form-data" |
---|
| | parameters: |
---|
| | - name: "uId" |
---|
| | in: "path" |
---|
| | description: "削除したいユーザーのユーザーID" |
---|
| | required: true |
---|
| | type: "string" |
---|
| | - name: "token" |
---|
| | in: "formData" |
---|
| | description: "削除したいユーザーのトークン" |
---|
| | required: true |
---|
| | type: "string" |
---|
| | responses: |
---|
| | 200: |
---|
| | description: "成功時のレスポンス" |
---|
| | schema: |
---|
| | type: "object" |
---|
| | properties: |
---|
| | massage: |
---|
| | type: "string" |
---|
| | example: "Already Deleted" |
---|
| | 400: |
---|
| | description: "無効なユーザが指定されました。" |
---|
| | schema: |
---|
| | type: "object" |
---|
| | properties: |
---|
| | massage: |
---|
| | type: "string" |
---|
| | example: "Invalid User" |
---|
| | 404: |
---|
| | description: "ユーザが見つかりませんでした。" |
---|
| | schema: |
---|
| | type: "object" |
---|
| | properties: |
---|
| | massage: |
---|
| | type: "string" |
---|
| | example: "User Not Found" |
---|
| | |
---|
| | /users/{userId}/uId: |
---|
| | get: |
---|
| | summary: "uIdの取得" |
---|
| | description: "userIdで指定したユーザーのuIdを取得します。" |
---|
| | parameters: |
---|
| | - name: "userId" |
---|
| | in: "path" |
---|
| | required: true |
---|
| | type: "integer" |
---|
| | format: "int64" |
---|
| | responses: |
---|
| | default: |
---|
| | description: "取得に成功しました。" |
---|
| | schema: |
---|
| | type: "object" |
---|
| | properties: |
---|
| | uId: |
---|
| | type: "integer" |
---|
| | format: "int64" |
---|
| | put: |
---|
| | summary: "uIdの更新" |
---|
| | description: "userIdで指定したユーザーのuIdを更新します。" |
---|
| | consumes: |
---|
| | - "multipart/form-data" |
---|
| | parameters: |
---|
| | - name: "userId" |
---|
| | in: "path" |
---|
| | required: true |
---|
| | type: "string" |
---|
| | - name: "newName" |
---|
| | in: "formData" |
---|
| | description: "ユーザーの名前" |
---|
| | required: true |
---|
| | type: "string" |
---|
| | responses: |
---|
| | default: |
---|
| | description: "uIdを更新しました。" |
---|
| | schema: |
---|
| | type: "object" |
---|
| | properties: |
---|
| | uId: |
---|
| | type: "integer" |
---|
| | format: "int64" |
---|
| | example: "123" |
---|
| | /users/{uId}/login: |
---|
| | post: |
---|
| | summary: "ログイン" |
---|
| | description: "" |
---|
| | parameters: |
---|
| | - name: "uId" |
---|
| | in: "path" |
---|
| | description: "ログインのためのユーザーID" |
---|
| | required: true |
---|
| | type: "string" |
---|
| | - name: "pw" |
---|
| | in: "query" |
---|
| | description: "ログインのためのパスワード" |
---|
| | required: true |
---|
| | type: "string" |
---|
| | responses: |
---|
| | 200: |
---|
| | description: "ログインしました" |
---|
| | schema: |
---|
| | $ref: "#/definitions/Token" |
---|
| | 400: |
---|
| | description: "ユーザIDもしくはパスワードが間違っています。" |
---|
| | |
---|
| | /users/{uId}/logout: |
---|
| | delete: |
---|
| | summary: "ログアウト" |
---|
| | description: "" |
---|
| | consumes: |
---|
| | - "multipart/form-data" |
---|
| | parameters: |
---|
| | - name: "uId" |
---|
| | in: "path" |
---|
| | description: "ログアウトのためのユーザーID" |
---|
| | required: true |
---|
| | type: "string" |
---|
| | - name: "token" |
---|
| | in: "formData" |
---|
| | description: "ログアウトのためのトークン" |
---|
| | required: true |
---|
| | type: "string" |
---|
| | responses: |
---|
| | 200: |
---|
| | description: "ログアウトしました" |
---|
| | 404: |
---|
| | description: "ログアウトに失敗しました" |
---|
| | |
---|
| | /users/{userId}/name: |
---|
| | get: |
---|
| | summary: "nameの取得" |
---|
| | description: "userIdで指定したユーザーのnameを取得します。" |
---|
| | parameters: |
---|
| | - name: "userId" |
---|
| | in: "path" |
---|
| | required: true |
---|
| | type: "string" |
---|
| | responses: |
---|
| | default: |
---|
| | description: "取得に成功しました。" |
---|
| | schema: |
---|
| | type: "object" |
---|
| | properties: |
---|
| | name: |
---|
| | type: "string" |
---|
| | put: |
---|
| | summary: "nameの更新" |
---|
| | description: "userIdで指定したユーザーのnameを更新します。" |
---|
| | parameters: |
---|
| | - name: "userId" |
---|
| | in: "path" |
---|
| | required: true |
---|
| | type: "string" |
---|
| | responses: |
---|
| | default: |
---|
| | description: "nameを更新しました。" |
---|
| | schema: |
---|
| | type: "object" |
---|
| | properties: |
---|
| | name: |
---|
| | type: "string" |
---|
| | example: "123" |
---|
| | |
---|
| | /users/{userId}/pass: |
---|
| | put: |
---|
| | summary: "passの更新" |
---|
| | description: "userIdで指定したユーザーのpassを更新します。" |
---|
| | parameters: |
---|
| | - name: "userId" |
---|
| | in: "path" |
---|
| | required: true |
---|
| | type: "string" |
---|
| | responses: |
---|
| | default: |
---|
| | description: "passを更新しました。" |
---|
| | schema: |
---|
| | type: "object" |
---|
| | properties: |
---|
| | name: |
---|
| | type: "string" |
---|
| | example: "123" |
---|
| | definitions: |
---|
| | # Parametars: |
---|
| | # - name: "uid" |
---|
| | # in: "formData" |
---|
| | # description: "ユーザーID" |
---|
| | # required: true. |
---|
| | # type: "string" |
---|
| | # - name: "name" |
---|
| | # in: "formData" |
---|
| | # description: "ユーザーの名前" |
---|
| | # required: true |
---|
| | # type: "string" |
---|
| | # - name: "pass" |
---|
| | # in: "formData" |
---|
| | # description: "ユーザーのpass" |
---|
| | # required: true |
---|
| | # type: "string" |
---|
| | # - name: "icon-image" |
---|
| | # in: "formData" |
---|
| | # description: "アイコンイメージ" |
---|
| | # required: true |
---|
| | # type: "string" |
---|
| | User: |
---|
| | type: "object" |
---|
| | properties: |
---|
| | uId: |
---|
| | type: "integer" |
---|
| | format: "int64" |
---|
| | type: "string" |
---|
| | example: "12345" |
---|
| | name: |
---|
| | type: "string" |
---|
| | pass: |
---|
| | type: "string" |
---|
| | icon-image: |
---|
| | type: "string" |
---|
| | example: "甲南 太郎" |
---|
| | uri: |
---|
| | type: "string" |
---|
| | example: "http://nitta-lab-www.is.konan-u.ac.jp/cosmos/users/{uId}" |
---|
| | token: |
---|
| | type: "string" |
---|
| | icon-uri: |
---|
| | type: "string" |
---|
| | |
---|
| | Token: |
---|
| | type: "object" |
---|
| | properties: |
---|
| | token: |
---|
| | type: "string" |
---|
| | |
ユーザー側完成しました。
・POST ユーザの更新
・base64とわかるように
・uIdは『.com』ではありません。
・PUT ユーザ情報の更新
・icon-image以外はrequiredで。
・uIdとuriをExample Valueで返す。
・DELETE ユーザ情報を削除
・グループチームはCode 200の時のExample Valueを
{
"massage": "Already Deleted"
}
としています(参考に)。
ログインとログアウトはPUTではないと考えます。
レビューをもとに修正しました。
POST ユーザの新規作成
・tokenは、ログインするときにサーバ生成するもの(同じユーザでもログインの度に違う値となる)なので、新規登録時に引数として渡すことはできないのではないでしょうか?
ユーザの新規作成後はそのままログインされるので、戻り値としてtokenを返す必要はあると思います。 検討してみてください。
PUT ユーザ情報の更新
・tokenは更新できないので、誤解を生む表現を修正してください。
修正版をコミットしたのでレビューをお願いします。
userAPI.yamlが修正されていることを確認しました。
2eae49a
intomaster
fromuserAPI
on 10 May 2019