Sample API
サンプルの仕様書
Example ¶
Example ¶
Example GET APIGET/example
処理概要
-
[端的にどんなAPIかを書く]
-
[注意点、特記事項など]
Example URI
GET http://localhost:3000/example
Response
200Headers
Content-Type: application/jsonBody
{
"value": "GET API Response Example"
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"value": {
"type": "string",
"description": "値"
}
}
}Example POST APIPOST/example
処理概要
-
[端的にどんなAPIかを書く]
-
[注意点、特記事項など]
Example URI
POST http://localhost:3000/example
Request
Headers
Content-Type: application/jsonBody
{
"value": "POST API Request Example"
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"value": {
"type": "string",
"description": "値"
}
},
"required": [
"value"
]
}Response
200Headers
Content-Type: application/jsonBody
{
"value": "POST API Response Example"
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"value": {
"type": "string",
"description": "値"
}
}
}All User ¶
Todo一覧取得 ¶
Todo一覧取得GET/todos
処理概要
- Todo一覧を取得
Example URI
GET http://localhost:3000/todos
Response
200Headers
Content-Type: application/jsonBody
{
"description": "OK",
"todos": [
{
"id": 1,
"name": "やること"
}
]
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"description": {
"type": "string",
"description": "説明"
},
"todos": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "number",
"description": "ID"
},
"name": {
"type": "string",
"description": "名前"
}
}
},
"description": "Todo一覧"
}
}
}指定したTodo取得 ¶
指定したTodo取得GET/todos/{todo_id}
処理概要
- 指定したTodoを取得
Example URI
GET http://localhost:3000/todos/1
URI Parameters
- todo_id
number(required) Example: 1TodoのID
Response
200Headers
Content-Type: application/jsonBody
{
"description": "OK",
"todo": {
"id": 1,
"name": "やること"
}
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"description": {
"type": "string",
"description": "説明"
},
"todo": {
"type": "object",
"properties": {
"id": {
"type": "number",
"description": "ID"
},
"name": {
"type": "string",
"description": "名前"
}
},
"description": "Todo詳細"
}
}
}Todoの新規追加 ¶
Todoの新規追加POST/todos/new
処理概要
- Todoの新規追加
Example URI
POST http://localhost:3000/todos/new
Request
Headers
Content-Type: application/jsonBody
{
"name": "やること"
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "名前"
}
},
"required": [
"name"
]
}Response
201Headers
Content-Type: application/jsonBody
{
"description": "Created",
"message": "Todoを新規作成しました",
"todo": {
"id": 1,
"name": "やること"
}
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"description": {
"type": "string",
"description": "Description"
},
"message": {
"type": "string",
"description": "メッセージ"
},
"todo": {
"type": "object",
"properties": {
"id": {
"type": "number",
"description": "ID"
},
"name": {
"type": "string",
"description": "名前"
}
},
"description": "追加したTodo詳細"
}
}
}