义乌购平台店铺商品接口开发指南

接口概述

义乌购平台提供RESTful风格的店铺商品查询接口,支持获取指定店铺下的所有商品信息,包括商品基础信息、价格、库存等数据。

点击获取key和secret

接口地址

arduino 复制代码
https://api.yiwugo.com/store/products

请求方法

GET

请求参数

参数名类型必填说明store_idstring是店铺IDpageint否分页页码(默认1)page_sizeint否每页数量(默认20,最大100)access_tokenstring是授权令牌

返回示例

css 复制代码
{
  "code": 200,
  "data": {
    "products": [
      {
        "product_id": "P10086",
        "name": "创意文具套装",
        "price": 15.8,
        "stock": 500,
        "images": ["https://xxx.com/img1.jpg"],
        "specs": {"color":["红","蓝"],"size":["S","M"]}
      }
    ],
    "total": 1,
    "current_page": 1
  }
}

错误码

  • 400: 参数错误
  • 401: 认证失败
  • 404: 店铺不存在
  • 500: 服务器错误

Java调用示例

typescript 复制代码
public class YiwuProductApi {
    private static final String API_URL = "https://api.yiwugo.com/store/products";
    
    public static JSONObject getStoreProducts(String storeId, String token) 
        throws IOException {
        HttpGet request = new HttpGet(API_URL + "?store_id=" + storeId 
            + "&access_token=" + token);
        
        try (CloseableHttpResponse response = HttpClients.createDefault()
            .execute(request)) {
            String json = EntityUtils.toString(response.getEntity());
            return new JSONObject(json);
        }
    }
}

Python调用示例

csharp 复制代码
import requests

def get_store_products(store_id, token):
    params = {
        'store_id': store_id,
        'access_token': token
    }
    response = requests.get('https://api.yiwugo.com/store/products', params=params)
    return response.json()

注意事项

  1. 需要提前申请开发者账号获取access_token
  2. 高频调用需遵守限流规则(100次/分钟)
  3. 商品数据缓存建议不超过1小时
  4. 敏感字段需做脱敏处理
相关推荐
爱学习的程序媛1 小时前
【Web前端】JavaScript设计模式全解析
前端·javascript·设计模式·web
小码哥_常1 小时前
从SharedPreferences到DataStore:Android存储进化之路
前端
老黑1 小时前
开源工具 AIDA:给 AI 辅助开发加一个数据采集层,让 AI 从错误中自动学习(Glama 3A 认证)
前端·react.js·ai·nodejs·cursor·vibe coding·claude code
jessecyj2 小时前
Spring boot整合quartz方法
java·前端·spring boot
苦瓜小生2 小时前
【前端】|【js手撕】经典高频面试题:手写实现function.call、apply、bind
java·前端·javascript
天若有情6732 小时前
前端HTML精讲03:页面性能优化+懒加载,搞定首屏加速
前端·性能优化·html
踩着两条虫2 小时前
AI驱动的Vue3应用开发平台深入探究(十):物料系统之内置组件库
android·前端·vue.js·人工智能·低代码·系统架构·rxjava
swipe3 小时前
AI 应用里的 Memory,不是“保存聊天记录”,而是管理上下文预算
前端·llm·agent
慧一居士3 小时前
nuxt3 项目和nuxt4 项目区别和对比
前端·vue.js
威联通安全存储3 小时前
破除“重前端、轻底层”的数字幻象:如何夯实工业数据的物理底座
前端·python