listings 接口详解:查询参数、排序方式与返回字段
GET:读取在售列表
GET /api/v1/listings
查询参数
| 参数 | 默认 | 说明 |
|---|---|---|
| cursor | — | 上次响应里的游标,用于翻页 |
| limit | 50 | 单页条数,最大 50 |
| sort_by | best_deal | 排序方式,见下表 |
| category | 0 | 0 任意 / 1 普通 / 2 StatTrak / 3 纪念品 |
| def_index | — | 只返回指定武器定义索引 |
| paint_index | — | 只返回指定涂装索引 |
| paint_seed | — | 只返回指定图案模板 |
| min_float / max_float | — | 浮点区间筛选 |
| min_price / max_price | — | 价格区间(单位:美分) |
| rarity | — | 按稀有度筛选 |
| collection | — | 按收藏品系列筛选 |
| market_hash_name | — | 按市场哈希名筛选 |
| user_id | — | 只看某个 SteamID64 挂的列表 |
| type | — | buy_now(一口价)或 auction(拍卖) |
| stickers | — | 按印花筛选,格式为 ID 与可选槽位的组合 |
sort_by 十种排序
lowest_price、highest_price、most_recent、expires_soon、lowest_float、highest_float、best_deal(默认)、highest_discount、float_rank、num_bids
排序口径与市场页面一致——网页能选的排序,API 都能给(背景见 一口价购买 的筛选三步)。
返回结构(节选)
每个 listing 包含:
id、type、price(美分)、state、created_atseller:卖家头像、在线状态、统计(总交易数、失败数、中位交易时间)、SteamID64item:asset_id、def_index、paint_index、paint_seed、float_value、market_hash_name、收藏系列、印花数组(含各印花磨损)、检视链接、是否已有截图min_offer_price/max_offer_discount:议价空间(对应 议价报价)watchers:关注人数
GET:单品详情
GET /api/v1/listings/<ID>
无论该列表当前是否在售(state 已变化)都能查到,适合做成交回溯。
POST:上架物品
POST /api/v1/listings
| 字段 | 必填 | 说明 |
|---|---|---|
| asset_id | 是 | 要上架的物品 ID |
| type | 否 | buy_now(默认)或 auction |
| price | buy_now 必填 | 一口价(美分);auction 时为当前出价/保留价 |
| reserve_price | auction 必填 | 拍卖起拍价 |
| duration_days | auction 必填 | 拍卖时长:1/3/5/7/14 |
| max_offer_discount | 否 | 覆盖默认的最低议价折扣 |
| description | 否 | 描述,最长 180 字符 |
| private | 否 | true 则不出现在公开搜索 |
参数含义与页面端一致(门槛与规则见 上架与定价、拍卖上架)。
限速提醒
高频轮询务必处理 429(见 错误码表):指数退避 + 本地缓存,别把拉数据做成压测。