Newer
Older
CosmosSwaggerYAML / swagger (1).yaml
swagger: "2.0"
info:
  description: "これはユーザ情報に関するAPIです。"
  version: "1.0.0"
  title: "user API"
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: "ユーザーのpass"
        required: true
        type: "string"
      - name: "icon-image"
        in: "formData"
        description: "アイコンイメージ"
        required: false
        type: "string"
      responses:
        201:
          description: "Userdate created"
          schema:
            $ref: "#/definitions/User"
          
  
  /users/{uId}:
    get:
      summary: "ユーザー情報を取得"
      description: "userIdを指定してユーザーの情報を取得します。"
      parameters:
      - name: "uId"
        in: "path"
        required: true
        type: "string"
      responses:
        200:
          description: "succesful operation."
          schema:
            type: "object"
            properties:
              name:
                type: "string"
              icon-image:
                type: "string"
        400:
          description: "無効なユーザー名が指定されました。"
        404:
          description: "ユーザーが見つかりませんでした。"
    put:
      summary: "Updated user."
      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: false
        type: "string"
      - name: "pw"
        in: "formData"
        description: "パスワードの更新"
        required: false
        type: "string"
      - name: "icon-image"
        in: "formData"
        description: "アイコンイメージの更新"
        required: false
        type: "string"
      responses:
        200:
          description: "更新しました"
          
    delete:
      summary: "ユーザー情報を削除"
      description: "userIdを指定してユーザーの情報を削除します。"
      parameters:
      - name: "uId"
        in: "path"
        description: "削除したいユーザーのuserId"
        required: true
        type: "string"
      responses:
        400:
          description: "無効なユーザが指定されました。"
        404:
          description: "ユーザが見つかりませんでした。"
          
  /users/{uId}/login:
    get:
      summary: "Logs user into the system."
      description: ""
      parameters:
      - name: "uId"
        in: "path"
        required: true
        type: "string"
      - name: "pw"
        in: "query"
        description: "ログインのためのパスワード"
        required: true
        type: "string"
      responses:
        200:
          description: "処理に成功"
          schema:
            $ref: "#/definitions/Token"
        400:
          description: "ユーザ名もしくはパスワードが間違っています。"
          
  /users/{uId}/logout:
    get:
      summary: "Logs out current logged in user session."
      description: ""
      consumes:  
      - "multipart/form-data"
      parameters:
      - name: "uId"
        in: "path"
        required: true
        type: "string"
      - name: "token"
        in: "formData"
        required: true
        type: "string"
      responses:
        200: 
          description: "ログアウトしました。"
        404:
          description: "ログアウトに失敗しました"
                
definitions:
  User:
    type: "object"
    properties:
      uId:
        type: "string"
      uri:
        type: "string"
      token:
        type: "string"
  Token:
    type: "object"
    properties:
      token:
        type: "string"