Skip to content

Instantly share code, notes, and snippets.

@eiel
Last active January 27, 2021 10:06
Show Gist options
  • Save eiel/50193ab80d1bae82adbf44cd90206f98 to your computer and use it in GitHub Desktop.
Save eiel/50193ab80d1bae82adbf44cd90206f98 to your computer and use it in GitHub Desktop.
ChatWork APIのSwagger
swagger: '2.0'
info:
title: ChatWork API
version: v1
# the domain of the service
host: api.chatwork.com
# array of all schemes that your API supports
schemes:
- https
# will be prefixed to all paths
basePath: /v1
paths:
/me:
get:
summary: 自分自身の情報
description: |
自分自身の情報を取得
parameters:
- $ref: '#/parameters/ChatWorkToken'
responses:
"200":
$ref: '#/responses/MyAccount'
"401":
$ref: '#/responses/Unauthorize'
tags:
- me
/my/status:
get:
summary: 自分の未読数、未読To数、未完了タスク数
description: 自分の未読数、未読To数、未完了タスク数を返す
parameters:
- $ref: '#/parameters/ChatWorkToken'
responses:
"200":
$ref: '#/responses/MyStatus'
"401":
$ref: '#/responses/Unauthorize'
tags:
- my
/my/tasks:
get:
summary: 自分のタスク一覧を取得する。
description: |-
自分のタスク一覧を取得する。(※100件まで取得可能。今後、より多くのデータを取得する為のページネーションの仕組みを提供予定)
parameters:
- $ref: '#/parameters/ChatWorkToken'
- $ref: '#/parameters/AssignedByAccountId'
- $ref: '#/parameters/Status'
responses:
"200":
$ref: '#/responses/Tasks'
"401":
$ref: '#/responses/Unauthorize'
tags:
- my
- tasks
/contacts:
get:
summary: 自分のコンタクト一覧を取得
description: 自分のコンタクト一覧を取得
parameters:
- $ref: '#/parameters/ChatWorkToken'
responses:
"200":
$ref: '#/responses/Accounts'
"401":
$ref: '#/responses/Unauthorize'
tags:
- contacts
/rooms:
get:
summary: 自分のチャット一覧の取得
description: 自分のチャット一覧の取得
parameters:
- $ref: '#/parameters/ChatWorkToken'
responses:
"200":
$ref: '#/responses/Rooms'
"401":
$ref: '#/responses/Unauthorize'
tags:
- rooms
post:
summary: グループチャットを新規作成
description: グループチャットを新規作成
parameters:
- $ref: '#/parameters/ChatWorkToken'
- name: description
type: string
description: ''
in: formData
- $ref: '#/parameters/IconPreset'
- $ref: '#/parameters/MembersAdminIds'
- $ref: '#/parameters/MembersMemberIds'
- $ref: '#/parameters/MembersReadonlyIds'
- name: name
type: string
in: formData
description: ''
required: true
responses:
"200":
$ref: '#/responses/RoomId'
"401":
$ref: '#/responses/Unauthorize'
tags:
- rooms
/rooms/{room_id}:
get:
summary: チャットの名前、アイコン、種類(my/direct/group)を取得
description: チャットの名前、アイコン、種類(my/direct/group)を取得
parameters:
- $ref: '#/parameters/ChatWorkToken'
- $ref: '#/parameters/RoomId'
responses:
"200":
$ref: '#/responses/Room'
"401":
$ref: '#/responses/Unauthorize'
tags:
- rooms
put:
summary: チャットの名前、アイコンをアップデート
description: チャットの名前、アイコンをアップデート
parameters:
- $ref: '#/parameters/ChatWorkToken'
- $ref: '#/parameters/RoomId'
- name: description
type: string
in: formData
description: ''
- $ref: '#/parameters/IconPreset'
- name: name
type: string
in: formData
description: ''
responses:
"200":
$ref: '#/responses/Room'
"401":
$ref: '#/responses/Unauthorize'
tags:
- rooms
delete:
summary: グループチャットを退席/削除する
description: グループチャットを退席/削除する
parameters:
- $ref: '#/parameters/ChatWorkToken'
- $ref: '#/parameters/RoomId'
responses:
"200":
description: ''
"401":
$ref: '#/responses/Unauthorize'
tags:
- rooms
/rooms/{room_id}/members:
get:
summary: チャットのメンバー一覧を取得
description: チャットのメンバー一覧を取得
parameters:
- $ref: '#/parameters/ChatWorkToken'
- $ref: '#/parameters/RoomId'
responses:
"200":
$ref: '#/responses/Members'
"401":
$ref: '#/responses/Unauthorize'
tags:
- rooms
- members
put:
summary: チャットのメンバーを一括変更
description: チャットのメンバーを一括変更
parameters:
- $ref: '#/parameters/ChatWorkToken'
- $ref: '#/parameters/RoomId'
- $ref: '#/parameters/MembersAdminIds'
- $ref: '#/parameters/MembersMemberIds'
- $ref: '#/parameters/MembersReadonlyIds'
responses:
"200":
$ref: '#/responses/UpdateMembers'
"401":
$ref: '#/responses/Unauthorize'
tags:
- rooms
- members
/rooms/{room_id}/messages:
get:
summary: メッセージ情報を取得
description: メッセージ情報を取得
parameters:
- $ref: '#/parameters/ChatWorkToken'
- $ref: '#/parameters/RoomId'
- name: force
type: integer
in: query
description: ''
responses:
"200":
$ref: '#/responses/Messages'
"401":
$ref: '#/responses/Unauthorize'
tags:
- rooms
- messages
post:
summary: チャットに新しいメッセージを追加
description: チャットに新しいメッセージを追加
parameters:
- $ref: '#/parameters/ChatWorkToken'
- $ref: '#/parameters/RoomId'
- name: body
type: integer
in: formData
required: true
description: ''
responses:
"200":
$ref: '#/responses/MessageId'
"401":
$ref: '#/responses/Unauthorize'
tags:
- rooms
- messages
/rooms/{room_id}/messages/{message_id}:
get:
summary: メッセージ情報を取得
description: メッセージ情報を取得
parameters:
- $ref: '#/parameters/ChatWorkToken'
- $ref: '#/parameters/RoomId'
- name: message_id
type: integer
in: path
required: true
description: ''
responses:
"200":
$ref: '#/responses/Message'
"401":
$ref: '#/responses/Unauthorize'
tags:
- rooms
- messages
/rooms/{room_id}/tasks:
get:
summary: チャットのタスク一覧を取得
description: チャットのタスク一覧を取得 (※100件まで取得可能。今後、より多くのデータを取得する為のページネーションの仕組みを提供予定)
parameters:
- $ref: '#/parameters/ChatWorkToken'
- $ref: '#/parameters/RoomId'
- $ref: '#/parameters/AccountId'
- $ref: '#/parameters/AssignedByAccountId'
- $ref: '#/parameters/Status'
responses:
"200":
$ref: '#/responses/Tasks'
"401":
$ref: '#/responses/Unauthorize'
tags:
- rooms
- tasks
post:
summary: チャットに新しいタスクを追加
description: チャットに新しいタスクを追加
parameters:
- $ref: '#/parameters/ChatWorkToken'
- $ref: '#/parameters/RoomId'
- name: body
type: integer
in: formData
required: true
description: 'タスクの内容'
- name: limit
type: integer
in: formData
description: 'タスクの期限'
- name: to_ids
type: array
items:
type: integer
in: formData
collectionFormat: csv
responses:
"200":
$ref: '#/responses/TaskIds'
"401":
$ref: '#/responses/Unauthorize'
tags:
- rooms
- tasks
/rooms/{room_id}/tasks/{task_id}:
get:
summary: タスク情報を取得
description: タスク情報を取得
parameters:
- $ref: '#/parameters/ChatWorkToken'
- $ref: '#/parameters/RoomId'
- name: task_id
type: integer
in: path
required: true
description: ''
responses:
"200":
$ref: '#/responses/Task'
"401":
$ref: '#/responses/Unauthorize'
tags:
- rooms
- tasks
/rooms/{room_id}/files:
get:
summary: チャットのファイル一覧を取得
description: チャットのファイル一覧を取得 (※100件まで取得可能。今後、より多くのデータを取得する為のページネーションの仕組みを提供予定)
parameters:
- $ref: '#/parameters/ChatWorkToken'
- $ref: '#/parameters/RoomId'
- $ref: '#/parameters/AccountId'
responses:
"200":
$ref: '#/responses/Files'
"401":
$ref: '#/responses/Unauthorize'
tags:
- rooms
- files
/rooms/{room_id}/files/{file_id}:
get:
summary: ファイル情報を取得
description: ファイル情報を取得
parameters:
- $ref: '#/parameters/ChatWorkToken'
- $ref: '#/parameters/RoomId'
- name: file_id
type: integer
in: path
required: true
description: ''
- name: create_download_url
type: integer
in: query
description: ''
responses:
"200":
$ref: '#/responses/File'
"401":
$ref: '#/responses/Unauthorize'
tags:
- rooms
- files
definitions:
Status:
type: string
enum:
- open
- done
Me:
type: object
properties:
account_id:
type: integer
room_id:
type: integer
name:
type: string
chatwork_id:
type: string
organization_id:
type: integer
organization_name:
type: string
department:
type: string
title:
type: string
url:
type: string
introduction:
type: string
mail:
type: string
tel_organization:
type: string
tel_extension:
type: string
tel_mobile:
type: string
skype:
type: string
facebook:
type: string
twitter:
type: string
avatar_image_url:
type: string
required:
- account_id
- room_id
- name
- chatwork_id
- organization_id
- organization_name
- department
- title
- url
- introduction
- mail
- tel_organization
- tel_extension
- tel_mobile
- skype
- facebook
- twitter
- avatar_image_url
Account:
type: object
properties:
account_id:
type: integer
room_id:
type: integer
name:
type: string
chatwork_id:
type: string
organization_id:
type: integer
organization_name:
type: string
department:
type: string
avatar_image_url:
type: string
required:
- account_id
- room_id
- name
- chatwork_id
- organization_id
- organization_name
- department
- avatar_image_url
AccountSummary:
type: object
properties:
account_id:
type: integer
name:
type: string
avatar_image_url:
type: string
required:
- account_id
- name
- avatar_image_url
File:
type: object
properties:
file_id:
type: integer
account:
$ref: '#/definitions/Account'
message_id:
type: integer
filename:
type: string
filesize:
type: integer
upload_time:
type: integer
required:
- file_id
- account
- message_id
- filename
- filesize
- upload_time
RoomSummary:
type: object
properties:
room_id:
type: integer
name:
type: string
icon_path:
type: string
required:
- room_id
- name
- icon_path
Message:
type: object
properties:
message_id:
type: integer
account:
$ref: '#/definitions/Account'
body:
type: string
send_time:
type: integer
update_time:
type: integer
required:
- message_id
- account
- body
- send_time
- update_time
Task:
type: object
properties:
task_id:
type: integer
room:
$ref: '#/definitions/RoomSummary'
assigned_by_account:
$ref: '#/definitions/AccountSummary'
message_id:
type: integer
body:
type: string
limit_time:
type: integer
status:
$ref: '#/definitions/Status'
required:
- task_id
- room
- assigned_by_account
- message_id
- body
- limit_time
- status
Room:
type: object
properties:
room_id:
type: integer
name:
type: string
type:
type: string
enum:
- my
- direct
- group
role:
type: string
sticky:
type: boolean
unread_num:
type: integer
mention_num:
type: integer
mytask_num:
type: integer
message_num:
type: integer
file_num:
type: integer
task_num:
type: integer
icon_path:
type: string
last_update_time:
type: integer
required:
- room_id
- name
- type
- role
- sticky
- unread_num
- mention_num
- mytask_num
- message_num
- file_num
- task_num
- icon_path
- last_update_time
Member:
type: object
properties:
account_id:
type: integer
role:
type: string
name:
type: string
chatwork_id:
type: string
organization_id:
type: integer
organization_name:
type: string
department:
type: string
avatar_image_url:
type: string
required:
- account_id
- role
- name
- chatwork_id
- organization_id
- organization_name
- department
- avatar_image_url
MyStatus:
type: object
properties:
unread_room_num:
type: integer
mention_room_num:
type: integer
mytask_room_num:
type: integer
unread_num:
type: integer
mention_num:
type: integer
required:
- unread_room_num
- mention_room_num
- mytask_room_num
- unread_num
- mention_num
parameters:
ChatWorkToken:
name: X-ChatWorkToken
in: header
description: ''
required: true
type: string
IconPreset:
name: icon_preset
type: string
description: ''
in: formData
enum:
- group
- check
- document
- meeting
- event
- project
- business
- study
- security
- star
- idea
- heart
- magcup
- beer
- music
- sports
- travel
AccountId:
name: account_id
type: integer
in: query
required: true
description: ''
AssignedByAccountId:
name: assigned_by_account_id
type: integer
in: query
RoomId:
name: room_id
type: integer
in: path
required: true
description: ''
MembersAdminIds:
name: members_admin_ids
type: array
description: ''
in: formData
items:
type: integer
collectionFormat: csv
required: true
MembersMemberIds:
name: members_member_ids
type: array
description: ''
in: formData
items:
type: integer
collectionFormat: csv
MembersReadonlyIds:
name: members_readonly_ids
type: array
description: ''
in: formData
items:
type: integer
collectionFormat: csv
Status:
name: status
type: string
in: query
enum:
- open
- done
responses:
MyAccount:
description: ''
schema:
$ref: '#/definitions/Me'
examples:
application/json: |-
{
"account_id": 123,
"room_id": 322,
"name": "John Smith",
"chatwork_id": "tarochatworkid",
"organization_id": 101,
"organization_name": "Hello Company",
"department": "Marketing",
"title": "CMO",
"url": "http://mycompany.com",
"introduction": "Self Introduction",
"mail": "taro@example.com",
"tel_organization": "XXX-XXXX-XXXX",
"tel_extension": "YYY-YYYY-YYYY",
"tel_mobile": "ZZZ-ZZZZ-ZZZZ",
"skype": "myskype_id",
"facebook": "myfacebook_id",
"twitter": "mytwitter_id",
"avatar_image_url": "https://example.com/abc.png"
}
MyStatus:
description: ''
schema:
$ref: '#/definitions/MyStatus'
examples:
application/json: |-
{
"unread_room_num": 2,
"mention_room_num": 1,
"mytask_room_num": 3,
"unread_num": 12,
"mention_num": 1,
"mytask_num": 8
}
Accounts:
description: ''
schema:
type: array
items:
$ref: '#/definitions/Account'
examples:
application/json: |-
[
{
"account_id": 123,
"room_id": 322,
"name": "John Smith",
"chatwork_id": "tarochatworkid",
"organization_id": 101,
"organization_name": "Hello Company",
"department": "Marketing",
"avatar_image_url": "https://example.com/abc.png"
}
]
File:
description: ''
schema:
$ref: '#/definitions/File'
examples:
application/json: |-
{
"file_id":3,
"account": {
"account_id":123,
"name":"Bob",
"avatar_image_url": "https://example.com/ico_avatar.png"
},
"message_id": 22,
"filename": "README.md",
"filesize": 2232,
"upload_time": 1384414750
}
Files:
description: ''
schema:
type: array
items:
$ref: '#/definitions/File'
examples:
application/json: |-
[
{
"file_id": 3,
"account": {
"account_id": 123,
"name": "Bob",
"avatar_image_url": "https://example.com/ico_avatar.png"
},
"message_id": 22,
"filename": "README.md",
"filesize": 2232,
"upload_time": 1384414750
}
]
Messages:
description: ''
schema:
type: array
items:
$ref: '#/definitions/Message'
examples:
application/json: |-
[
{
"message_id": 5,
"account": {
"account_id": 123,
"name": "Bob",
"avatar_image_url": "https://example.com/ico_avatar.png"
},
"body": "Hello Chatwork!",
"send_time": 1384242850,
"update_time": 0
}
]
Message:
description: ''
schema:
$ref: '#/definitions/Message'
examples:
application/json: |-
{
"message_id": 5,
"account": {
"account_id": 123,
"name": "Bob",
"avatar_image_url": "https://example.com/ico_avatar.png"
},
"body": "Hello Chatwork!",
"send_time": 1384242850,
"update_time": 0
}
MessageId:
description: ''
schema:
type: object
properties:
room_id:
type: integer
examples:
appliaction/json: |-
{
"message_id": 1234
}
Task:
description: ''
schema:
$ref: '#/definitions/Task'
examples:
application/json: |-
{
"task_id": 3,
"room": {
"room_id": 5,
"name": "Group Chat Name",
"icon_path": "https://example.com/ico_group.png"
},
"assigned_by_account": {
"account_id": 456,
"name": "Anna",
"avatar_image_url": "https://example.com/def.png"
},
"message_id": 13,
"body": "buy milk",
"limit_time": 1384354799,
"status": "open"
}
Tasks:
description: ''
schema:
type: array
items:
$ref: '#/definitions/Task'
examples:
application/json: |-
[
{
"task_id": 3,
"room": {
"room_id": 5,
"name": "Group Chat Name",
"icon_path": "https://example.com/ico_group.png"
},
"assigned_by_account": {
"account_id": 456,
"name": "Anna",
"avatar_image_url": "https://example.com/def.png"
},
"message_id": 13,
"body": "buy milk",
"limit_time": 1384354799,
"status": "open"
}
]
TaskIds:
description: ''
schema:
type: object
properties:
task_ids:
type: array
items:
type: integer
examples:
application/json: |-
{
"task_ids": [123,124]
}
Rooms:
description: ''
schema:
type: array
items:
$ref: '#/definitions/Room'
examples:
application/json: |-
[
{
"room_id": 123,
"name": "Group Chat Name",
"type": "group",
"role": "admin",
"sticky": false,
"unread_num": 10,
"mention_num": 1,
"mytask_num": 0,
"message_num": 122,
"file_num": 10,
"task_num": 17,
"icon_path": "https://example.com/ico_group.png",
"last_update_time": 1298905200
}
]
Room:
description: ''
schema:
$ref: '#/definitions/Room'
examples:
application/json: |-
{
"room_id": 123,
"name": "Group Chat Name",
"type": "group",
"role": "admin",
"sticky": false,
"unread_num": 10,
"mention_num": 1,
"mytask_num": 0,
"message_num": 122,
"file_num": 10,
"task_num": 17,
"icon_path": "https://example.com/ico_group.png",
"last_update_time": 1298905200,
"description": "room description text"
}
RoomId:
description: ''
schema:
type: object
properties:
room_id:
type: integer
examples:
appliaction/json: |-
{
"room_id": 1234
}
Members:
description: ''
schema:
type: array
items:
$ref: '#/definitions/Member'
UpdateMembers:
description: ''
schema:
type: object
properties:
admin:
type: array
items:
type: integer
member:
type: array
items:
type: integer
readanly:
type: array
items:
type: integer
Unauthorize:
description: '認証エラー時のレスポンス'
schema:
type: object
properties:
errors:
type: array
items:
type: string
examples:
application/json: |-
{
"errors": ["Invalid API token"]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment