Back to top

API Documentation

APIBlueprintSample

Githubはこちら

商品系API

商品一覧取得
GET/v1/item/{clientId}/{?acl,inserted_by}

動作概要

  • 見出し4以降は、Markdown形式でこのようにdescriptionを挟めます

Example URI

GET /v1/item/5/?acl=hogeAPItoken_001&inserted_by=darai0512
URI Parameters
HideShow
clientId
number (required) Example: 5

ここに各パラメータのコメントを書けます

acl
string (required) Example: hogeAPItoken_001

acl token

inserted_by
string (optional) Example: darai0512

任意パラメータ

Response  200
HideShow

UTF-8

Headers
Content-Type: application/json
Body
{
  "status": {
    "code": 200,
    "message": null,
    "details": []
  },
  "results": [
    {
      "id": 100,
      "name": "食洗機",
      "similarItems": {}
    },
    {
      "id": "101",
      "name": "土鍋",
      "similarItems": {
        "16": "北京鍋"
      }
    }
  ]
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "status": {
      "type": "object",
      "properties": {
        "code": {
          "type": "number",
          "description": "application status code"
        },
        "message": {
          "type": [
            "string",
            "null"
          ]
        },
        "details": {
          "description": "Error時のみカラム別エラー詳細などが入る"
        }
      },
      "required": [
        "code"
      ],
      "description": "HTTP statusとは異なるアプリケーション専用のstatus"
    },
    "results": {
      "type": "array",
      "description": "array内の構造はschema(メタデータ)に表現されない"
    }
  }
}

商品削除
DELETE/v1/item/{clientId}/{id}

  • 削除成功時のresultsは空のため、成功/失敗はHTTPステータスコードで判断してください

Example URI

DELETE /v1/item/5/100
URI Parameters
HideShow
clientId
number (required) Example: 5

商品提供顧客ID

id
number (required) Example: 100

商品ID

Response  200
HideShow

UTF-8

Headers
Content-Type: application/json
Body
{
  "status": {
    "code": 200,
    "message": "Hello, world!",
    "details": []
  },
  "results": []
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "status": {
      "type": "object",
      "properties": {
        "code": {
          "type": "number",
          "description": "application status code"
        },
        "message": {
          "type": [
            "string",
            "null"
          ]
        },
        "details": {
          "description": "Error時のみカラム別エラー詳細などが入る"
        }
      },
      "required": [
        "code"
      ],
      "description": "HTTP statusとは異なるアプリケーション専用のstatus"
    },
    "results": {
      "description": "array内の構造はschema(メタデータ)に表現されない"
    }
  }
}
Response  400
HideShow

UTF-8

Headers
Content-Type: application/json
Body
{
  "status": {
    "code": 404,
    "message": "Combination of clientId and id is invalid.",
    "details": []
  },
  "results": []
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "status": {
      "type": "object",
      "properties": {
        "code": {
          "type": "number",
          "description": "application status code"
        },
        "message": {
          "type": [
            "string",
            "null"
          ]
        },
        "details": {
          "description": "Error時のみカラム別エラー詳細などが入る"
        }
      },
      "required": [
        "code"
      ],
      "description": "HTTP statusとは異なるアプリケーション専用のstatus"
    },
    "results": {
      "description": "array内の構造はschema(メタデータ)に表現されない"
    }
  }
}

顧客系

クライアント登録
POST/v1/client

Example URI

POST /v1/client
Request
HideShow

UTF-8

Headers
Content-Type: application/json
Body
{
  "name": "darai0512",
  "type": "A"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "クライアント名"
    },
    "type": {
      "type": "string",
      "enum": [
        "A",
        "B"
      ],
      "default": "A - default値はこう記述",
      "description": "列挙データ。下記ネストしたメタ情報はschemaに記載される(A: 通常、B: 特別契約顧客)"
    }
  },
  "required": [
    "name"
  ]
}
Response  200
HideShow

UTF-8

Headers
Content-Type: application/json
Body
{
  "status": {
    "code": 200,
    "message": null,
    "details": []
  },
  "results": {
    "id": "5",
    "name": "darai0512",
    "type": "A"
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "status": {
      "type": "object",
      "properties": {
        "code": {
          "type": "number",
          "description": "application status code"
        },
        "message": {
          "type": [
            "string",
            "null"
          ]
        },
        "details": {
          "description": "Error時のみカラム別エラー詳細などが入る"
        }
      },
      "required": [
        "code"
      ],
      "description": "HTTP statusとは異なるアプリケーション専用のstatus"
    },
    "results": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "型省略時はstring"
        },
        "name": {
          "type": "string",
          "description": "クライアント名"
        },
        "type": {
          "type": "string",
          "enum": [
            "A"
          ],
          "description": "顧客タイプ"
        }
      },
      "description": "array内の構造はschema(メタデータ)に表現されない"
    }
  }
}

カラム説明

商品一覧取得[GET]

results(array)内の構造は以下の通り

key type format description
5d number 1以上の整数 商品ID
name string マルチバイトを含む1文字以上 商品名
similarItems object key: id(商品ID)
value: name(商品名)
類似商品(レコメンド用)

Generated by aglio on 07 Aug 2016