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

接口概述

义乌购平台提供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. 敏感字段需做脱敏处理
相关推荐
子兮曰6 小时前
async/await高级模式:async迭代器、错误边界与并发控制
前端·javascript·github
恋猫de小郭7 小时前
2026 Flutter VS React Native ,同时在 AI 时代 VS Native 开发,你没见过的版本
android·前端·flutter
GIS之路9 小时前
ArcGIS Pro 中的 Notebooks 入门
前端
IT_陈寒10 小时前
React状态管理终极对决:Redux vs Context API谁更胜一筹?
前端·人工智能·后端
Kagol11 小时前
TinyVue 支持 Skills 啦!现在你可以让 AI 使用 TinyVue 组件搭建项目
前端·agent·ai编程
柳杉11 小时前
从零打造 AI 全球趋势监测大屏
前端·javascript·aigc
simple_lau11 小时前
Cursor配置MasterGo MCP:一键读取设计稿生成高还原度前端代码
前端·javascript·vue.js
睡不着先生11 小时前
如何设计一个真正可扩展的表单生成器?
前端·javascript·vue.js
天蓝色的鱼鱼11 小时前
模块化与组件化:90%的前端开发者都没搞懂的本质区别
前端·架构·代码规范
明君8799711 小时前
Flutter 如何给图片添加多行文字水印
前端·flutter