コンテンツにスキップ

商品計上日移動平均原価一覧取得

GET
/products/{product_id}/posting_date_moving_average_costs
curl --request GET \
--url 'https://api.smaregi.dev/TARGET-CONTRACT-ID/pos/products/example/posting_date_moving_average_costs?sort=postingDate&posting_date_from=2026-04-15&posting_date_to=%E7%8F%BE%E5%9C%A8%E6%97%A5%E4%BB%98' \
--header 'Authorization: Bearer <token>'

商品の計上日移動平均原価一覧を取得します。集計済みの計上日移動平均原価のみ取得します。
※ 計上日移動平均原価は毎日夜間に集計されます。計上日移動平均原価の更新はWebhookで検知可能です。

原価の計算方法が「移動平均法(更新日基準)」「移動平均法(計上日基準)」以外の契約では空配列を返却します。

指定した計上日の期間の内、計上日移動平均原価の表示を開始する計上日以降の計上日のみ返却します。

指定した商品で初めて在庫変動が起きた計上日より前の計上日は返却しません。

対象プラン

  • リテールビジネス
product_id
required
string
<= 15 characters /^[0-9]{1,15}$/

商品ID

※ ユーザーアクセストークンを利用する場合、ユーザーの所属する店舗で販売している商品IDを指定してください。

fields
array

検索パラメータ(カンマ区切りで指定可)
Response項目を指定可能
※一部項目(withで指定する項目、2階層目以降の項目)については指定不可

sort
string
Allowed values: postingDate postingDate:asc postingDate:desc

並び順(カンマ区切りで指定可)

指定可能なパラメータ

  • postingDate:計上日
posting_date_from
required
string format: date

計上日(From):[YYYY-MM-DD]

※ From〜Toの期間は最大1年までの指定でご利用ください。

posting_date_to
string format: date
default: 現在日付

計上日(To):[YYYY-MM-DD]

※ From〜Toの期間は最大1年までの指定でご利用ください。

取得成功

Media typeapplication/json
Array<object>
object
productId

商品ID:数字15桁以内。

string
<= 15 characters /^[0-9]{1,15}$/
postingDate

計上日:[YYYY-MM-DD]

string format: date
cost

計上日移動平均原価:数字8桁以内(少数5桁まで)。

string
<= 14 characters /^[0-9]{1,8}(\.[0-9]{1,5})?$/
Example
[
{
"productId": "1",
"postingDate": "2026-01-23",
"cost": "2741.34897"
},
{
"productId": "1",
"postingDate": "2026-01-24",
"cost": "2741.34897"
},
{
"productId": "1",
"postingDate": "2026-01-25",
"cost": "2650.54365"
}
]
  • 入力チェックエラーの場合
  • 計上日(To) が 計上日(From) より前の日付の場合
  • 計上日のFrom-Toの範囲が上限を超えている場合
Media typeapplication/json
object
type
required
string
title
required
string
detail
string
status
integer
Examples
{
"type": "about:blank",
"title": "Bad Request",
"detail": "[posting_date_from]YYYY-MM-DD形式を指定してください",
"status": 400
}

指定した商品データが存在しない場合

Media typeapplication/json
object
type
required
string
title
required
string
detail
string
status
integer
Examples
Exampleリソースが存在しない場合
{
"type": "about:blank",
"title": "NotFound",
"detail": "指定された商品IDのリソースが見つかりません",
"status": 404
}