swagger: "2.0"
info:
description: "これはCosmosのuserAPIです。"
version: "1.0.0"
title: "User API"
termsOfService: "http://swagger.io/terms/"
host: "nitta-lab-www.is.konan-u.ac.jp"
basePath: "/cosmos"
schemes:
- "https"
- "http"
paths:
/users:
post:
summary: "ユーザーの新規作成"
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: "pw"
in: "formData"
description: "ユーザーのパスワード"
required: true
type: "string"
- name: "icon-image"
in: "formData"
description: "アイコンイメージ(base64)"
required: false
type: "string"
responses:
201:
description: "成功時のレスポンス"
schema:
$ref: "#/definitions/User"
/users/{uId}:
get:
summary: "ユーザー情報を取得"
description: "userIdを指定してユーザーの情報を取得します。"
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: "ユーザー情報を更新"
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を指定してユーザーの情報を削除します。"
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/{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: "ログアウトに失敗しました"
definitions:
User:
type: "object"
properties:
uId:
type: "string"
example: "12345"
name:
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"