Back to top

ZAICO API Document

このドキュメントはZAICO APIの機能と使うために必要なパラメータなどを説明するものです。

認証

認証について

GET

概要

ZAICO APIは認証にBearerトークン認証を採用しています。 リクエストを送る際、HTTPヘッダにAuthorization: Bearerをつけてください。

Authorization: Bearer YOUR_TOKEN_HERE

在庫データ

在庫データ一覧取得

GET/api/v1/inventories

処理概要

  • 自分のアカウントに登録されている在庫データのすべてを返します。

  • 在庫データが1件も無い場合は、空の配列を返します。

  • 棚卸し日は設定されている場合のみ表示されます。

Example URI

GET https://twics.tamurasouko.com/api/v1/inventories
Request
HideShow
Headers
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "id": 1,
  "title": "在庫データ",
  "quantity": 10,
  "unit": "個",
  "category": "製品",
  "state": "新品",
  "place": "ZAICO倉庫",
  "etc": "備考",
  "code": "tw201800000000",
  "item_image": {
    "url": "itemimageurl"
  },
  "stocktake": {
    "checked_at": "2018-03-27T09:38:19+09:00"
  },
  "optional_attributes": [
    {
      "name": "追加項目名",
      "value": "追加項目値"
    }
  ],
  "created_at": "2018-03-27T09:38:19+09:00",
  "updated_at `2018-03-27T09:38:19+09:00`": "",
  "create_user_name": "田村 太郎",
  "update_user_name": "田村 次郎",
  "user_group": "基本グループ"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "id": {
      "type": "number",
      "description": "ID"
    },
    "title": {
      "type": "string",
      "description": "在庫データタイトル"
    },
    "quantity": {
      "type": "number",
      "description": "数量"
    },
    "unit": {
      "type": "string",
      "description": "単位"
    },
    "category": {
      "type": "string",
      "description": "カテゴリ"
    },
    "state": {
      "type": "string",
      "description": "状態"
    },
    "place": {
      "type": "string",
      "description": "保管場所"
    },
    "etc": {
      "type": "string",
      "description": "備考"
    },
    "code": {
      "type": "string",
      "description": "バーコードの値"
    },
    "item_image": {
      "type": "object",
      "properties": {
        "url": {
          "type": "string",
          "description": "画像URL"
        }
      }
    },
    "stocktake": {
      "type": "object",
      "properties": {
        "checked_at": {
          "type": "string",
          "description": "棚卸し日"
        }
      }
    },
    "optional_attributes": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "追加項目名"
          },
          "value": {
            "type": "string",
            "description": "追加項目値"
          }
        }
      }
    },
    "created_at": {
      "type": "string",
      "description": "作成日"
    },
    "updated_at `2018-03-27T09:38:19+09:00`": {
      "type": "string",
      "description": "更新日"
    },
    "create_user_name": {
      "type": "string",
      "description": "作成者"
    },
    "update_user_name": {
      "type": "string",
      "description": "更新者"
    },
    "user_group": {
      "type": "string",
      "description": "ユーザーグループ"
    }
  }
}

在庫データ作成

POST/api/v1/inventories

処理概要

  • 在庫データを作成します

注意事項

  • タイトルのみあれば作成可能です

  • 画像もつけてデータを作成する場合は、画像をbase64エンコードして送ってください

  • 送られたパラメータにタイトルが無い場合やデータが無い場合はエラーを返します

  • パースできないJSONを送るとエラーを返します

  • 存在しないユーザーグループを送るとエラーを返します

  • 変更履歴のメモも一緒に保存することが可能です。詳しくは下記Bodyをご覧ください

Example URI

POST https://twics.tamurasouko.com/api/v1/inventories
Request
HideShow
Headers
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json
Body
{
  "title": "在庫データ",
  "quantity": 10,
  "unit": "個",
  "category": "製品",
  "state": "新品",
  "place": "ZAICO倉庫",
  "etc": "備考",
  "code": "tw201800000000",
  "item_image": "base64-encoded-image",
  "stocktake": {
    "checked_at": "2018-03-27T09:38:19+09:00"
  },
  "optional_attributes": [
    {
      "name": "追加項目名",
      "value": "追加項目値"
    }
  ],
  "inventory_history": {
    "memo": "変更履歴メモ"
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "title": {
      "type": "string",
      "description": "在庫データタイトル"
    },
    "quantity": {
      "type": "number",
      "description": "数量"
    },
    "unit": {
      "type": "string",
      "description": "単位"
    },
    "category": {
      "type": "string",
      "description": "カテゴリ"
    },
    "state": {
      "type": "string",
      "description": "状態"
    },
    "place": {
      "type": "string",
      "description": "保管場所"
    },
    "etc": {
      "type": "string",
      "description": "備考"
    },
    "code": {
      "type": "string",
      "description": "バーコードの値"
    },
    "item_image": {
      "type": "string"
    },
    "stocktake": {
      "type": "object",
      "properties": {
        "checked_at": {
          "type": "string",
          "description": "棚卸し日"
        }
      }
    },
    "optional_attributes": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "追加項目名"
          },
          "value": {
            "type": "string",
            "description": "追加項目値"
          }
        }
      }
    },
    "inventory_history": {
      "type": "object",
      "properties": {
        "": {
          "type": "object",
          "properties": {}
        },
        "memo": {
          "type": "string",
          "description": "変更履歴のメモ"
        }
      }
    }
  },
  "required": [
    "title"
  ]
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "code": 200,
  "status": "success",
  "message": "Data was successfully created.",
  "data_id": 123456
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "code": {
      "type": "number",
      "description": "ステータスコード"
    },
    "status": {
      "type": "string",
      "description": "状態"
    },
    "message": {
      "type": "string",
      "description": "メッセージ"
    },
    "data_id": {
      "type": "number",
      "description": "作成した在庫データのID"
    }
  }
}
Response  400
HideShow
Headers
Content-Type: application/json
Body
{
  "code": 400,
  "status": "error",
  "message": "error message"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "code": {
      "type": "number",
      "description": "ステータスコード"
    },
    "status": {
      "type": "string",
      "description": "ステータス"
    },
    "message": {
      "type": "string",
      "description": "エラー内容"
    }
  }
}
Response  406
HideShow
Headers
Content-Type: application/json
Body
{
  "code": 406,
  "status": "error",
  "message": "UserGroup is NOT exist"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "code": {
      "type": "number",
      "description": "ステータスコード"
    },
    "status": {
      "type": "string",
      "description": "ステータス"
    },
    "message": {
      "type": "string",
      "description": "エラー内容"
    }
  }
}

在庫データ個別取得

GET/api/v1/inventories/{id}

処理概要

  • 在庫データを1件のみ取得します

  • 棚卸し日は設定されている場合のみ表示されます。

注意事項

  • 在庫データが無い場合は404を返します

Example URI

GET https://twics.tamurasouko.com/api/v1/inventories/1
URI Parameters
HideShow
id
number (required) Example: 1

在庫データのID

Request
HideShow
Headers
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "id": 1,
  "title": "在庫データ",
  "quantity": 10,
  "unit": "個",
  "category": "製品",
  "state": "新品",
  "place": "ZAICO倉庫",
  "etc": "備考",
  "code": "tw201800000000",
  "item_image": {
    "url": "itemimageurl"
  },
  "stocktake": {
    "checked_at": "2018-03-27T09:38:19+09:00"
  },
  "optional_attributes": [
    {
      "name": "追加項目名",
      "value": "追加項目値"
    }
  ],
  "created_at": "2018-03-27T09:38:19+09:00",
  "updated_at `2018-03-27T09:38:19+09:00`": "",
  "create_user_name": "田村 太郎",
  "update_user_name": "田村 次郎",
  "user_group": "基本グループ"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "id": {
      "type": "number",
      "description": "ID"
    },
    "title": {
      "type": "string",
      "description": "在庫データタイトル"
    },
    "quantity": {
      "type": "number",
      "description": "数量"
    },
    "unit": {
      "type": "string",
      "description": "単位"
    },
    "category": {
      "type": "string",
      "description": "カテゴリ"
    },
    "state": {
      "type": "string",
      "description": "状態"
    },
    "place": {
      "type": "string",
      "description": "保管場所"
    },
    "etc": {
      "type": "string",
      "description": "備考"
    },
    "code": {
      "type": "string",
      "description": "バーコードの値"
    },
    "item_image": {
      "type": "object",
      "properties": {
        "url": {
          "type": "string",
          "description": "画像URL"
        }
      }
    },
    "stocktake": {
      "type": "object",
      "properties": {
        "checked_at": {
          "type": "string",
          "description": "棚卸し日"
        }
      }
    },
    "optional_attributes": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "追加項目名"
          },
          "value": {
            "type": "string",
            "description": "追加項目値"
          }
        }
      }
    },
    "created_at": {
      "type": "string",
      "description": "作成日"
    },
    "updated_at `2018-03-27T09:38:19+09:00`": {
      "type": "string",
      "description": "更新日"
    },
    "create_user_name": {
      "type": "string",
      "description": "作成者"
    },
    "update_user_name": {
      "type": "string",
      "description": "更新者"
    },
    "user_group": {
      "type": "string",
      "description": "ユーザーグループ"
    }
  }
}
Response  404
HideShow
Headers
Content-Type: application/json
Body
{
  "code": 404,
  "status": "error",
  "message": "Inventory not found"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "code": {
      "type": "number",
      "description": "ステータスコード"
    },
    "status": {
      "type": "string",
      "description": "ステータス"
    },
    "message": {
      "type": "string",
      "description": "エラー内容"
    }
  }
}

在庫データ更新

PUT/api/v1/inventories/{id}

処理概要

  • 特定の在庫データを更新します

注意事項

  • タイトルのみあれば作成可能です

  • 画像もつけてデータを作成する場合は、画像をbase64エンコードして送ってください

  • 該当する在庫データが無い場合はエラーを返します

  • パースできないJSONを送るとエラーを返します

  • 存在しないユーザーグループを送るとエラーを返します

  • 変更履歴のメモも一緒に保存することが可能です。詳しくは下記Bodyをご覧ください

Example URI

PUT https://twics.tamurasouko.com/api/v1/inventories/1
URI Parameters
HideShow
id
number (required) Example: 1

在庫データのID

Request
HideShow
Headers
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json
Body
{
  "title": "在庫データ",
  "quantity": 10,
  "unit": "個",
  "category": "製品",
  "state": "新品",
  "place": "ZAICO倉庫",
  "etc": "備考",
  "code": "tw201800000000",
  "item_image": "base64-encoded-image",
  "stocktake": {
    "checked_at": "2018-03-27T09:38:19+09:00"
  },
  "optional_attributes": [
    {
      "name": "追加項目名",
      "value": "追加項目値"
    }
  ],
  "inventory_history": {
    "memo": "変更履歴メモ"
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "title": {
      "type": "string",
      "description": "在庫データタイトル"
    },
    "quantity": {
      "type": "number",
      "description": "数量"
    },
    "unit": {
      "type": "string",
      "description": "単位"
    },
    "category": {
      "type": "string",
      "description": "カテゴリ"
    },
    "state": {
      "type": "string",
      "description": "状態"
    },
    "place": {
      "type": "string",
      "description": "保管場所"
    },
    "etc": {
      "type": "string",
      "description": "備考"
    },
    "code": {
      "type": "string",
      "description": "バーコードの値"
    },
    "item_image": {
      "type": "string"
    },
    "stocktake": {
      "type": "object",
      "properties": {
        "checked_at": {
          "type": "string",
          "description": "棚卸し日"
        }
      }
    },
    "optional_attributes": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "追加項目名"
          },
          "value": {
            "type": "string",
            "description": "追加項目値"
          }
        }
      }
    },
    "inventory_history": {
      "type": "object",
      "properties": {
        "": {
          "type": "object",
          "properties": {}
        },
        "memo": {
          "type": "string",
          "description": "変更履歴のメモ"
        }
      }
    }
  },
  "required": [
    "title"
  ]
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "code": 200,
  "status": "success",
  "message": "Data was successfully updated."
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "code": {
      "type": "number",
      "description": "ステータスコード"
    },
    "status": {
      "type": "string",
      "description": "状態"
    },
    "message": {
      "type": "string",
      "description": "メッセージ"
    }
  }
}
Response  400
HideShow
Headers
Content-Type: application/json
Body
{
  "code": 400,
  "status": "error",
  "message": "error message"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "code": {
      "type": "number",
      "description": "ステータスコード"
    },
    "status": {
      "type": "string",
      "description": "ステータス"
    },
    "message": {
      "type": "string",
      "description": "エラー内容"
    }
  }
}
Response  404
HideShow
Headers
Content-Type: application/json
Body
{
  "code": 404,
  "status": "error",
  "message": "Inventory not found"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "code": {
      "type": "number",
      "description": "ステータスコード"
    },
    "status": {
      "type": "string",
      "description": "ステータス"
    },
    "message": {
      "type": "string",
      "description": "エラー内容"
    }
  }
}
Response  406
HideShow
Headers
Content-Type: application/json
Body
{
  "code": 406,
  "status": "error",
  "message": "UserGroup is NOT exist"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "code": {
      "type": "number",
      "description": "ステータスコード"
    },
    "status": {
      "type": "string",
      "description": "ステータス"
    },
    "message": {
      "type": "string",
      "description": "エラー内容"
    }
  }
}

在庫データ削除

DELETE/api/v1/inventories/{id}

処理概要

  • 特定の在庫データを削除します

注意事項

  • 該当する在庫データが無い場合はエラーを返します

Example URI

DELETE https://twics.tamurasouko.com/api/v1/inventories/1
URI Parameters
HideShow
id
number (required) Example: 1

在庫データのID

Request
HideShow
Headers
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "code": 200,
  "status": "success",
  "message": "Data was successfully deleted."
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "code": {
      "type": "number",
      "description": "ステータスコード"
    },
    "status": {
      "type": "string",
      "description": "状態"
    },
    "message": {
      "type": "string",
      "description": "メッセージ"
    }
  }
}
Response  404
HideShow
Headers
Content-Type: application/json
Body
{
  "code": 404,
  "status": "error",
  "message": "Inventory not found"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "code": {
      "type": "number",
      "description": "ステータスコード"
    },
    "status": {
      "type": "string",
      "description": "ステータス"
    },
    "message": {
      "type": "string",
      "description": "エラー内容"
    }
  }
}

Generated by aglio on 30 Nov 2018