Smartmat API 共通仕様 (0.0.9)

Download OpenAPI specification:

Smartmatサービスの安定性向上のため、APIKey毎に「1分60回 & 24時間1440回」の呼び出し回数が制限されています。アプリケーションを作成する際は、実行回数が制限を超えないように調整してください。

在庫情報取得(1件)

在庫情報取得API

デバイスIDをキーに在庫情報を取得します

query Parameters
id
required
string
Example: id=W42190804999

取得したいデバイスID

header Parameters
X-Smartmat-Key
required
string

配布済みのAPI KEY

Responses

Response Schema: application/json
object
deviceSerialNumber
string

デバイスID

version
string

デバイスバージョン

object
isConnected
boolean

最新計測状態

current
integer

デバイスとしての最新計測値(グラム単位)

measuredAt
string <date-time>

最新計測日

battery
integer

最新バッテリー残量

rssi
integer

最新電波強度

Array of objects
Array
object

V1マットの場合こちらにデータが入ります

type
string

計測タイプ

frequency
integer

計測頻度

timing
string

計測時刻

standardHour
integer

基準時刻

object

V2マットの場合こちらにデータが入ります

frequency
integer

計測頻度

timing
string

計測時刻

standardHour
integer

基準時刻

object
subscribed
boolean

有効/無効フラグ

outputTypeText
string

発注方式テキスト

quantity
integer

発注数量

measurementModeText
string

残量表示タイプ

measurementTypeText
string

減少/増加

full
integer

満タン重量(%モードのみ設定可能)

weight
integer

1個あたり重量(個数モードのみ設定可能)

weightUnit
string

1個あたり重量単位(個数モードのみ設定可能)

containerWeight
integer

容器重量

triggerRemainingPercent
integer

発注閾値(%モード時)

triggerRemainingNumber
integer

発注閾値(個数モード時)

object
current
integer

在庫としての最新計測値(グラム単位)

measuredAt
string <date-time>

最新計測日

remainingPercent
integer

最新残量(%モード時)

remainingNumber
integer

最新残量(個数モード時)

Array of objects (TagType)
Array
key
string

タグ名(ただし場所の場合は '___TagKeyLocation' 固定)

value
string

内容

object
productCode
string

計測商品コード

title
string

計測商品名

imageUrl
string

計測商品画像URL

Response samples

Content type
application/json
{
  • "device": {
    • "deviceSerialNumber": "W32190800097",
    • "version": "SM-W32"
    },
  • "deviceMeasurement": {
    • "isConnected": true,
    • "current": 1500,
    • "measuredAt": "2020-05-28 09:51:03+09:00",
    • "battery": 61,
    • "rssi": -70
    },
  • "measurementControl": [
    • {
      • "v1": {
        • "type": "frequency",
        • "frequency": 4,
        • "timing": "00,06,12,18",
        • "standardHour": 9
        },
      • "v2": {
        • "frequency": 24,
        • "timing": "09",
        • "standardHour": 9
        }
      }
    ],
  • "subscription": {
    • "subscribed": true,
    • "outputTypeText": "AmazonDRS発注",
    • "quantity": 1,
    • "measurementModeText": "%",
    • "measurementTypeText": "減少",
    • "full": 19000,
    • "weight": 100,
    • "weightUnit": "grams",
    • "containerWeight": 1000,
    • "triggerRemainingPercent": 40,
    • "triggerRemainingNumber": 100
    },
  • "subscriptionMeasurement": {
    • "current": 1500,
    • "measuredAt": "2020-05-28 09:51:03+09:00",
    • "remainingPercent": 61,
    • "remainingNumber": 15
    },
  • "tags": [
    • {
      • "key": "ユーザ指定のタグ名(ただし場所の場合は '___TagKeyLocation' 固定)",
      • "value": "本社倉庫棚番A01"
      }
    ],
  • "product": {
    • "productCode": "B01BEPNPF6",
    • "title": "計測商品 水 PET (2L×6本)",
    • "imageUrl": "https://xxx.xxx"
    }
}

計測履歴情報一括取得(クエリで条件を指定)

計測履歴取得API

デバイスIDをキーに計測履歴情報を取得します(デフォルト直近30件分)

query Parameters
id
required
string
Example: id=W42190804999

取得したいデバイスID

dateFrom
string <date-time>
Example: dateFrom=YYYYMMDDHHMMSS

ログデータを該当日時分以降に絞る。14桁の半角数字のみ設定可。省略可。

dateTo
string <date-time>
Example: dateTo=YYYYMMDDHHMMSS

ログデータを該当日時分以前に絞る。14桁の半角数字のみ設定可。省略可

limit
integer
Example: limit=100

取得件数設定。1〜1000までの半角整数値が設定可。省略可。

header Parameters
X-Smartmat-Key
required
string

配布済みのAPI KEY

Responses

Response Schema: application/json
Array of objects
Array
measuredAt
string <date-time>

計測時刻

prev
integer

前回計測時データ(グラム単位)

current
integer

今回計測データ(グラム単位)

battery
integer

計測時電池残量

rssi
integer

計測時電波強度

pushedMeasureButton
boolean

手動計測だったかどうか(falseなら自動計測)

measurementModeText
string

計測時残量表示タイプ

measureControlMappingID
integer

計測時計測マッピングID

frequency
integer

計測時計測頻度数

timing
string

計測時計測時刻

standardHour
integer

計測基準時刻

Response samples

Content type
application/json
{
  • "measureHistories": [
    • {
      • "measuredAt": "2020-05-28 09:51:03+09:00",
      • "prev": 15500,
      • "current": 30700,
      • "battery": 90,
      • "rssi": -70,
      • "pushedMeasureButton": false,
      • "measurementModeText": "%",
      • "measureControlMappingID": 1,
      • "frequency": 4,
      • "timing": "0,6,12,18",
      • "standardHour": 9
      }
    ]
}

発注履歴一括取得(クエリで条件を指定)

発注履歴取得API

発注IDもしくは発注日をキーに発注履歴を取得します(デフォルト最新1000件)

query Parameters
id
integer
Example: id=1234

発注ID(カンマ区切りで複数指定可)

dateFrom
string <date-time>
Example: dateFrom=YYYYMMDDHHMMSS

発注日From

dateTo
string <date-time>
Example: dateTo=YYYYMMDDHHMMSS

発注日To

header Parameters
X-Smartmat-Key
required
string

配布済みのAPI KEY

Responses

Response Schema: application/json
Array of objects
Array
id
integer

発注ID

orderDate
string <date-time>

発注日時

operationUserEmail
string

手動発注者のメールアドレス(自動発注なら null)

orderSupplierOrNotificationName
string

仕入先/通知先名

phaseText
string

発注ステータス(全体)

orderPrice
number

発注金額(全体)

Array of objects
Array
subscriptionID
integer

在庫ID

outputTypeText
string

発注方法

productCode
string

商品コード

productTitle
string

商品名

quantity
integer

発注数量

unit
string

発注単位

orderUnitPrice
number

発注単価

totalPrice
number

発注金額(在庫単体)

itemPhaseText
string

発注ステータス(在庫単体)

Response samples

Content type
application/json
{
  • "orders": [
    • {
      • "id": 1,
      • "orderDate": "2019-08-24T14:15:22Z",
      • "operationUserEmail": "example@example.com",
      • "orderSupplierOrNotificationName": "仕入先名",
      • "phaseText": "通知済み",
      • "orderPrice": 750,
      • "orderItems": [
        • {
          • "subscriptionID": 1,
          • "outputTypeText": "Email発注",
          • "productCode": "BX01298FGA",
          • "productTitle": "おいしい水",
          • "quantity": 5,
          • "unit": "個",
          • "orderUnitPrice": 150,
          • "totalPrice": 750,
          • "itemPhaseText": "発注済み"
          }
        ]
      }
    ]
}

在庫一覧取得(クエリで条件を指定)

在庫一覧取得API

在庫IDをキーに在庫情報を取得します(在庫IDの新しい順で1000件)

query Parameters
subscriptionID
integer
Example: subscriptionID=123456

取得したい在庫ID(カンマ区切りで複数指定可)

pageNumber
integer
Example: pageNumber=3

取得したいページ番号(1ページあたり1,000件固定) 指定がない場合はデフォルト1ページ目が指定される

header Parameters
X-Smartmat-Key
required
string

配布済みのAPI KEY

Responses

Response Schema: application/json
counts
integer

総在庫データ数

Array of objects
Array
id
number

在庫ID

deviceSerialNumbers
Array of strings

マットのシリアル番号

Array of objects
Array
object
deviceSerialNumber
string

デバイスID

version
string

デバイスバージョン

object
isConnected
boolean

最新計測状態

current
integer

デバイスとしての最新計測値(グラム単位)

measuredAt
string <date-time>

最新計測日

battery
integer

最新バッテリー残量

rssi
integer

最新電波強度

object
frequency
integer

計測頻度

timing
string

計測時刻

standardHour
integer

基準時刻

measuredAt
string <date-time>

最終接続日時

isConnected
boolean

マット接続状況

productCode
string

商品コード

productTitle
string

商品名

remainingPercent
integer

残量(%)

remainingNumber
integer

残量(個)

triggerRemainingPercent
integer

閾値(%)

triggerRemainingNumber
integer

閾値(個)

measurementMode
integer <int32>

1:%,2:個数

measurementType
integer <int32>

1:減少,2:増加

inventoryUnitPrice
integer

在庫単価

inventoryUnitPriceCurrency
string

ISO4217に基づいた通貨コード

inventoryPrice
integer <int32>

在庫金額(残量×在庫単価(円))

Array of objects

期限

Array
lotNumber
string

ロット番号

expirationDate
string

期限

quantity
integer

残量(個)

location
string <string>

場所

Array of objects

タグ

Array
id
integer

タグID

key
string

タグ名

value
string

内容

Response samples

Content type
application/json
{
  • "counts": 1234,
  • "subscriptions": [
    • {
      • "id": 123456,
      • "deviceSerialNumbers": [
        • "W42000000001",
        • "W42000000002"
        ],
      • "devices": [
        • {
          • "device": {
            • "deviceSerialNumber": "W32190800097",
            • "version": "SM-W32"
            },
          • "deviceMeasurement": {
            • "isConnected": true,
            • "current": 1500,
            • "measuredAt": "2020-05-28 09:51:03+09:00",
            • "battery": 61,
            • "rssi": -70
            },
          • "measurementControl": {
            • "frequency": 24,
            • "timing": "09",
            • "standardHour": 9
            }
          }
        ],
      • "measuredAt": "2023-03-30 15:46:41",
      • "isConnected": true,
      • "productCode": "123abc",
      • "productTitle": "部品123abc",
      • "remainingPercent": 20,
      • "remainingNumber": 40,
      • "triggerRemainingPercent": 10,
      • "triggerRemainingNumber": 20,
      • "measurementMode": 1,
      • "measurementType": 1,
      • "inventoryUnitPrice": 500,
      • "inventoryUnitPriceCurrency": "JPY",
      • "inventoryPrice": 40000,
      • "expiration": [
        • {
          • "lotNumber": "string",
          • "expirationDate": "2021/01/23",
          • "quantity": 0
          }
        ],
      • "location": "6F",
      • "tags": [
        • {
          • "id": 0,
          • "key": "string",
          • "value": "string"
          }
        ]
      }
    ]
}

入出庫履歴

入出庫履歴一覧取得API

入出庫履歴の一覧を取得します

query Parameters
q
string
Example: q=商品A,東京倉庫,担当者X

キーワード検索。カンマ区切り文字列で指定する。 商品名・商品コード・場所・担当を対象として部分一致で検索する。 複数指定された場合は検索条件(sc)に従いANDまたはOR検索する。アルファベット、数字は半角、全角を区別しない。 空白のみを指定した場合は無視される。また、前後に空白がある場合はトリムされる。

from
string <date-time>
Example: from=20210101090000

検索開始時刻。14桁の半角数字のみ設定可。jst時刻。未入力の場合は、toから72時間前の時刻が指定されたとして検索する。

to
string <date-time>
Example: to=20210101180000

検索終了時刻。14桁の半角数字のみ設定可。jst時刻。未入力の場合は、現在時刻が指定されたとして検索する。

limit
integer
Example: limit=100

取得件数。未入力の場合は、100件取得する。

sc
string
Default: "OR"
Enum: "AND" "OR"
Example: sc=AND

検索条件。qパラメータで指定された複数キーワードをAND検索するかOR検索するかを指定する。未入力の場合は、OR検索となる。

offset
integer
Example: offset=100

取得開始位置。未入力の場合は、0から取得する。

header Parameters
X-Smartmat-Key
required
string

配布済みのAPI KEY

Responses

Response Schema: application/json
count
integer

件数

Array of objects
Array
object

在庫情報

id
string

在庫ID

unit
string

単位

object

場所情報

value
string

場所名

object

商品情報

code
string

商品コード

name
string

商品名

type
string
Enum: "incoming" "outgoing"

入出庫種別。incomingは前回在庫数 - 今回在庫数 < 0 の場合、outgoingは前回在庫数 - 今回在庫数 > 0 の場合。

changeAmount
number <double>

変化数量,ABS(前回在庫数 - 今回在庫数)

amount
number <double>

残量。今回在庫数

measuredAt
string <date-time>

計測時刻

operator
string

担当

note
string

メモ

measurementMethod
string
Enum: "measurement" "setting_change"

どの計量で発生した入出庫か。measurementは計測による入出庫、setting_changeは設定変更による数量変化による入出庫

Response samples

Content type
application/json
{
  • "count": 2,
  • "logs": [
    • [
      • {
        • "inventory": {
          • "id": "1234",
          • "unit": "個",
          • "location": {
            • "value": "東京倉庫1F"
            },
          • "product": {
            • "code": "ITEM-001",
            • "name": "商品A"
            }
          },
        • "type": "incoming",
        • "changeAmount": 50,
        • "amount": 150,
        • "measuredAt": "2024-03-20T10:00:00Z",
        • "operator": "担当者A",
        • "note": "定期入荷",
        • "measurementMethod": "measurement"
        },
      • {
        • "inventory": {
          • "id": "5678",
          • "unit": "個",
          • "location": {
            • "value": "東京倉庫2F"
            },
          • "product": {
            • "code": "ITEM-002",
            • "name": "商品B"
            }
          },
        • "type": "outgoing",
        • "changeAmount": 30,
        • "amount": 70,
        • "measuredAt": "2024-03-20T11:00:00Z",
        • "operator": "担当者B",
        • "note": "出荷処理",
        • "measurementMethod": "measurement"
        }
      ]
    ]
}