shopee API接口:item_get - 根据ID取商品详情 API

为了进行电商平台 的API开发,首先我们需要做下面几件事情。

1)开发者注册一个账号

2)然后为每个 shopee 应用注册一个应用程序键(App Key) 。

3)下载 shopee API的SDK并掌握基本的API基础知识和调用

4)利用SDK接口和对象,传入AppKey或者必要的时候获取并传入SessionKey来进行程序开发。

5)利用shopee 平台的文档中心和API测试工具,对接口进行测试。从而了解返回信息,方便程序获取。

以上是一般shopee API应用开发的关键流程,其中通过shopee 文档中心和API测试工具,进行概念了解和接口信息查询很重要。因为这些数据就是我们需要在逐步显示出来的。shopee 的API很多,不过都分为了好几个领域,慢慢就会了解深入了。

注册链接(获取Key和secret):​​https://o0b.cn/iinoah​

响应实例

{
  "item": {
    "num_iid": 5637247041,
    "title": "Fashionable plus size women's dress 2020 new spring and summer dress was thin and thin and fat sister dress two-piece suit",
    "detail_url": "https://shopee.com.my/Fashionable plus size women's dress 2020 new spring and summer dress was thin and thin and fat sister dress two-piece suit-i.264070136.5637247041?",
    "pic_url": "https://cf.shopee.com.my/file/f8bc1116ea922e5ed87a492390b1cc1a",
    "price": 31.68,
    "orginal_price": 31.68,
    "cid": 100017,
    "desc": "Brand: Other/Other\nStyle: Sweet and Fresh/College\nPopular elements: buttons, gauze, stitching\nStyle: skirt suit\nsleeve length: short sleeve\nFabric/Material: Other/Polyester (Polyester Fiber)\nIngredient content: 71% (inclusive)-80% (inclusive)\nWhether to add cashmere: no cashmere\nTime to market: Spring 2020\nDelivery time:\nShipped on the same day before subscripting at 18:00 every day,\nIt is estimated that it will take 4-10 days for normal goods to arrive at your hands\n\nMasa penghantaran\nDihantar pada hari yang sama sebelum pukul 18:00 setiap hari\nDihantar keesokan harinya selepas jam 18:00.\nDianggarkan memerlukan masa 4-10 hari untuk barang biasa sampai tangan anda\n\nPakaian wanita bersaiz plus bergaya.Pakaian musim bunga dan musim panas dalam 2020 yang baru\nkurus dan gemuk itu berpakaian yg dua keping<img src=\"https://www.o0b.cn/i.php?t.png&rid=gw-1.64194661eb25e&p=1032056033&k=60478&t=1679378019\" style=\"display:none\" />",
    "item_imgs": null,
    "props": [
      {
        "name": "Plus Size",
        "value": "Yes"
      },
      {
        "name": "Dress/Skirt Length",
        "value": "Midi"
      }
    ],
    "props_list": {
      "45590:45636": "颜色分类:T-shirt+skirt",
      "45590:45943": "颜色分类:T-shirt",
      "45590:46031": "颜色分类:skirt",
      "46102:46108": "尺码:M 建议【42.5-50KG】",
      "46102:46144": "尺码:L 建议 【50-57.5kg】",
      "46102:46191": "尺码:XL 【建议57.5-65kg】",
      "46102:46222": "尺码:2XL 【建议65-72.5kg】",
      "46102:46270": "尺码:3XL 【建议72.5-82.5kg】",
      "46102:46301": "尺码:4XL【建议82.5-90kg】"
    },
    "prop_imgs": {
      "prop_img": [
        {
          "properties": "45590:45636",
          "url": "https://cf.shopee.com.my/file/81bea46afa4113012b7330cc3c846428"
        },
        {
          "properties": "45590:45943",
          "url": "https://cf.shopee.com.my/file/c0d49dfae84b81468269a17714742adb"
        },
        {
          "properties": "45590:46031",
          "url": "https://cf.shopee.com.my/file/f4dd56edbe0ccc13ca2cba0d6ba5167a"
        }
      ]
    },
    "props_imgs": {
      "prop_img": [
        {
          "properties": "45590:45636",
          "url": "https://cf.shopee.com.my/file/81bea46afa4113012b7330cc3c846428"
        },
        {
          "properties": "45590:45943",
          "url": "https://cf.shopee.com.my/file/c0d49dfae84b81468269a17714742adb"
        },
        {
          "properties": "45590:46031",
          "url": "https://cf.shopee.com.my/file/f4dd56edbe0ccc13ca2cba0d6ba5167a"
        }
      ]
    },
    "props_name": "45590:45636:颜色分类:T-shirt+skirt;45590:45636:颜色分类:T-shirt+skirt;45590:45636:颜色分类:T-shirt+skirt;45590:45636:颜色分类:T-shirt+skirt;45590:45636:颜色分类:T-shirt+skirt;45590:45636:颜色分类:T-shirt+skirt;45590:45943:颜色分类:T-shirt;45590:45943:颜色分类:T-shirt;45590:45943:颜色分类:T-shirt;45590:45943:颜色分类:T-shirt;45590:45943:颜色分类:T-shirt;45590:45943:颜色分类:T-shirt;45590:46031:颜色分类:skirt;45590:46031:颜色分类:skirt;45590:46031:颜色分类:skirt;45590:46031:颜色分类:skirt;45590:46031:颜色分类:skirt;45590:46031:颜色分类:skirt;46102:46108:尺码:M 建议【42.5-50KG】;46102:46144:尺码:L 建议 【50-57.5kg】;46102:46191:尺码:XL 【建议57.5-65kg】;46102:46222:尺码:2XL 【建议65-72.5kg】;46102:46270:尺码:3XL 【建议72.5-82.5kg】;46102:46301:尺码:4XL【建议82.5-90kg】;46102:46108:尺码:M 建议【42.5-50KG】;46102:46144:尺码:L 建议 【50-57.5kg】;46102:46191:尺码:XL 【建议57.5-65kg】;46102:46222:尺码:2XL 【建议65-72.5kg】;46102:46270:尺码:3XL 【建议72.5-82.5kg】;46102:46301:尺码:4XL【建议82.5-90kg】;46102:46108:尺码:M 建议【42.5-50KG】;46102:46144:尺码:L 建议 【50-57.5kg】;46102:46191:尺码:XL 【建议57.5-65kg】;46102:46222:尺码:2XL 【建议65-72.5kg】;46102:46270:尺码:3XL 【建议72.5-82.5kg】;46102:46301:尺码:4XL【建议82.5-90kg】",
    "desc_img": [],
    "location": null,
    "post_fee": "",
    "skus": {
      "sku": [
        {
          "price": 63.36,
          "total_price": 0,
          "orginal_price": 63.36,
          "properties": "45590:45636;46102:46108",
          "properties_name": "45590:45636:颜色分类:T-shirt+skirt;46102:46108:尺码:M 建议【42.5-50KG】",
          "quantity": 982,
          "sku_id": null
        },
        {
          "price": 63.36,
          "total_price": 0,
          "orginal_price": 63.36,
          "properties": "45590:45636;46102:46144",
          "properties_name": "45590:45636:颜色分类:T-shirt+skirt;46102:46144:尺码:L 建议 【50-57.5kg】",
          "quantity": 983,
          "sku_id": null
        },
        {
          "price": 63.36,
          "total_price": 0,
          "orginal_price": 63.36,
          "properties": "45590:45636;46102:46191",
          "properties_name": "45590:45636:颜色分类:T-shirt+skirt;46102:46191:尺码:XL 【建议57.5-65kg】",
          "quantity": 992,
          "sku_id": null
        },
        {
          "price": 63.36,
          "total_price": 0,
          "orginal_price": 63.36,
          "properties": "45590:45636;46102:46222",
          "properties_name": "45590:45636:颜色分类:T-shirt+skirt;46102:46222:尺码:2XL 【建议65-72.5kg】",
          "quantity": 989,
          "sku_id": null
        },
        {
          "price": 63.36,
          "total_price": 0,
          "orginal_price": 63.36,
          "properties": "45590:45636;46102:46270",
          "properties_name": "45590:45636:颜色分类:T-shirt+skirt;46102:46270:尺码:3XL 【建议72.5-82.5kg】",
          "quantity": 992,
          "sku_id": null
        },
        {
          "price": 63.36,
          "total_price": 0,
          "orginal_price": 63.36,
          "properties": "45590:45636;46102:46301",
          "properties_name": "45590:45636:颜色分类:T-shirt+skirt;46102:46301:尺码:4XL【建议82.5-90kg】",
          "quantity": 985,
          "sku_id": null
        },
        {
          "price": 38.08,
          "total_price": 0,
          "orginal_price": 38.08,
          "properties": "45590:45943;46102:46108",
          "properties_name": "45590:45943:颜色分类:T-shirt;46102:46108:尺码:M 建议【42.5-50KG】",
          "quantity": 998,
          "sku_id": null
        },
        {
          "price": 38.08,
          "total_price": 0,
          "orginal_price": 38.08,
          "properties": "45590:45943;46102:46144",
          "properties_name": "45590:45943:颜色分类:T-shirt;46102:46144:尺码:L 建议 【50-57.5kg】",
          "quantity": 999,
          "sku_id": null
        },
        {
          "price": 38.08,
          "total_price": 0,
          "orginal_price": 38.08,
          "properties": "45590:45943;46102:46191",
          "properties_name": "45590:45943:颜色分类:T-shirt;46102:46191:尺码:XL 【建议57.5-65kg】",
          "quantity": 1000,
          "sku_id": null
        },
        {
          "price": 38.08,
          "total_price": 0,
          "orginal_price": 38.08,
          "properties": "45590:45943;46102:46222",
          "properties_name": "45590:45943:颜色分类:T-shirt;46102:46222:尺码:2XL 【建议65-72.5kg】",
          "quantity": 999,
          "sku_id": null
        },
        {
          "price": 38.08,
          "total_price": 0,
          "orginal_price": 38.08,
          "properties": "45590:45943;46102:46270",
          "properties_name": "45590:45943:颜色分类:T-shirt;46102:46270:尺码:3XL 【建议72.5-82.5kg】",
          "quantity": 999,
          "sku_id": null
        },
        {
          "price": 38.08,
          "total_price": 0,
          "orginal_price": 38.08,
          "properties": "45590:45943;46102:46301",
          "properties_name": "45590:45943:颜色分类:T-shirt;46102:46301:尺码:4XL【建议82.5-90kg】",
          "quantity": 998,
          "sku_id": null
        },
        {
          "price": 31.68,
          "total_price": 0,
          "orginal_price": 31.68,
          "properties": "45590:46031;46102:46108",
          "properties_name": "45590:46031:颜色分类:skirt;46102:46108:尺码:M 建议【42.5-50KG】",
          "quantity": 1000,
          "sku_id": null
        },
        {
          "price": 31.68,
          "total_price": 0,
          "orginal_price": 31.68,
          "properties": "45590:46031;46102:46144",
          "properties_name": "45590:46031:颜色分类:skirt;46102:46144:尺码:L 建议 【50-57.5kg】",
          "quantity": 1000,
          "sku_id": null
        },
        {
          "price": 31.68,
          "total_price": 0,
          "orginal_price": 31.68,
          "properties": "45590:46031;46102:46191",
          "properties_name": "45590:46031:颜色分类:skirt;46102:46191:尺码:XL 【建议57.5-65kg】",
          "quantity": 997,
          "sku_id": null
        },
        {
          "price": 31.68,
          "total_price": 0,
          "orginal_price": 31.68,
          "properties": "45590:46031;46102:46222",
          "properties_name": "45590:46031:颜色分类:skirt;46102:46222:尺码:2XL 【建议65-72.5kg】",
          "quantity": 998,
          "sku_id": null
        },
        {
          "price": 31.68,
          "total_price": 0,
          "orginal_price": 31.68,
          "properties": "45590:46031;46102:46270",
          "properties_name": "45590:46031:颜色分类:skirt;46102:46270:尺码:3XL 【建议72.5-82.5kg】",
          "quantity": 999,
          "sku_id": null
        },
        {
          "price": 31.68,
          "total_price": 0,
          "orginal_price": 31.68,
          "properties": "45590:46031;46102:46301",
          "properties_name": "45590:46031:颜色分类:skirt;46102:46301:尺码:4XL【建议82.5-90kg】",
          "quantity": 997,
          "sku_id": null
        }
      ]
    },
    "num": 17907,
    "seller_id": null,
    "shop_id": "",
    "nick": null,
    "sales": 0,
    "total_sold": "-1",
    "seller_info": {
      "nick": null,
      "item_score": null,
      "score_p": null,
      "delivery_score": null,
      "shop_type": "",
      "user_num_id": null,
      "sid": "",
      "title": "",
      "zhuy": "https://my.xiapibuy.com/qzq1274334183.my",
      "cert": null,
      "open_time": "",
      "credit_score": null,
      "shop_name": "Big size women's fashion "
    },
    "data_from": "Ha",
    "props_img": {
      "45590:45636": "https://cf.shopee.com.my/file/81bea46afa4113012b7330cc3c846428",
      "45590:45943": "https://cf.shopee.com.my/file/c0d49dfae84b81468269a17714742adb",
      "45590:46031": "https://cf.shopee.com.my/file/f4dd56edbe0ccc13ca2cba0d6ba5167a"
    },
    "format_check": "ok",
    "shop_item": [],
    "relate_items": []
  },
  "error": "",
  "secache": "da67365cb819d7c288d8451ffd8c3692",
  "secache_time": 1679378019,
  "secache_date": "2023-03-21 13:53:39",
  "translate_status": "",
  "translate_time": 0,
  "language": {
    "default_lang": "cn",
    "current_lang": "cn"
  },
  "reason": "",
  "error_code": "0000",
### Shopee API 商品管理使用教程 #### 了解Shopee API基础 为了有效管理和操作商品,开发者需先熟悉Shopee开放平台所提供的API接口。这些接口允许第三方应用程序与Shopee电商平台交互,实现诸如获店铺信息、上传商品图片、创建或更新商品列表等功能[^1]。 #### 配置环境 确保已安装并配置好PHP开发环境以及必要的依赖项,比如通过Composer来管理项目所需的外部库。对于基于Laravel框架的应用来说,可以通过注册服务提供者的方式快速集成Shopee PHP客户端,从而简化调用过程。 #### 获授权令牌 在正式请求之前,必须获得有效的OAuth访问令牌。这通常涉及到引导用户登录其Shopee账户,并授予您的应用权限以代表他们执行特定的操作。完成身份验证流程后,您将收到一个可用于后续API调用的token字符串。 #### 实现商品管理功能 下面是一些常见的商品管理任务及其对应的API方法: - **查询商品详情** 可以使用`/api/v2/product/get_item_detail`端点来检索指定ID的商品详细资料。此操作有助于确认现有库存状态或是作为编辑前的数据预览。 ```php $response = Http::withHeaders([ 'Authorization' => 'Bearer '.$accessToken, ])->get('https://partner.shopeemobile.com/api/v2/product/get_item_detail', [ 'item_id' => 123456789, // 替换为您想要查看的具体商品ID ]); ``` - **新增商品** 若要向商店添加新产品,则应调用`/api/v2/product/add_item`接口。注意,在提交新条目前可能需要预先准备好一些必要参数,如类别编号、属性集等。 ```php $response = Http::withHeaders([ 'Authorization' => 'Bearer '.$accessToken, ])->post('https://partner.shopeemobile.com/api/v2/product/add_item', [ 'category_id' => 100001, // 类目ID 'name' => 'New Product',// 商品名称 'description' => '...', // 描述 'price' => 99.99, // 单价 'stock' => 100, // 库存数量 ... ]); ``` - **修改已有商品的信息** 当需要更改已经存在的商品数据时,可借助于`/api/v2/product/update_item`路径发送PUT请求来进行相应字段的更新工作。 ```php $response = Http::withHeaders([ 'Authorization' => 'Bearer '.$accessToken, ])->put('https://partner.shopeemobile.com/api/v2/product/update_item', [ 'item_id' => 123456789,// 修改的目标商品ID 'updates' => ['key'=>'value'],// 待更正的内容键值对集合 ]); ``` - **删除商品** 如果决定移除某个不再销售的产品记录,那么就应当采用DELETE HTTP动词配合`/api/v2/product/delete_item`地址发起指令。 ```php $response = Http::withHeaders([ 'Authorization' => 'Bearer '.$accessToken, ])->delete('https://partner.shopeemobile.com/api/v2/product/delete_item', [ 'item_id' => 123456789,// 删除目标商品ID ]); ``` 以上即为利用Shopee API进行基本商品管理的主要步骤概述。实际应用场景可能会更加复杂多变,建议深入阅读官方文档了解更多细节和最佳实践指导。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

分享干货的猫

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值