微盟接口对接记录

  • 2021-11-26
  • Admin

1.简介

微盟云-智慧商业生态平台

 微盟商家  微盟 

2.微盟接口

微盟商品、订单涉及到的接口有

查询类目    /category/queryChildrenCategory
查询规格值    ec/category/queryCategoryAttrInfo
获取配送方式 /goods/findDeliveryTypeList
获取运费模板   /goods/findFreightTemplateList
添加规格值    ec/category/addAttrValue
添加商品    ec/goods/addGoods
上传图片    ec/goodsImage/uploadImg
获取分组    ec/goodsClassify/queryClassifyInfoList
添加分组    ec/goodsClassify/addClassify  
批量上下架  ec/goods/updateGoodsShelfStatus
查询订单列表    ec/order/queryOrderList
查询订单详情    ec/order/queryOrderDetail

微盟http请求方法

  1. public JSONObject httpPostRaw(String url, JSONObject bodyJson, JSONObject headerMap)
  2. {
  3. // post请求返回结果
  4. CloseableHttpClient httpClient = HttpClientBuilder.create().build(); // 获取DefaultHttpClient请求
  5. HttpPost httpPost = new HttpPost(url);
  6. try {
  7. // 设置http头
  8. httpPost.setHeader("Content-Type", "application/json"); // 默认json
  9. if (null != headerMap && headerMap.size() > 0){
  10. for (String name : headerMap.keySet())
  11. {
  12. httpPost.setHeader(name, headerMap.getString(name));
  13. }
  14. }
  15. // 设置body
  16. if(bodyJson != null){
  17. StringEntity entity = new StringEntity(bodyJson.toJSONString(),"UTF-8");
  18. entity.setContentEncoding("UTF-8");
  19. entity.setContentType("application/json");
  20. httpPost.setEntity(entity);
  21. }
  22. HttpResponse result = httpClient.execute(httpPost);
  23. url = URLDecoder.decode(url, "UTF-8");
  24. // 请求发送成功,并得到响应
  25. try {
  26. String str = EntityUtils.toString(result.getEntity());
  27. return JSON.parseObject(str);
  28. } catch (Exception e) {
  29. logger.error("post请求提交失败:" + url, e);
  30. }
  31. } catch (IOException e) {
  32. logger.error("post请求提交失败:" + url, e);
  33. }
  34. finally {
  35. try {
  36. httpClient.close();
  37. } catch (IOException e) {
  38. e.printStackTrace();
  39. }
  40. }
  41. return null;
  42. }
  43. public static void main(String[] args) {
  44. HttpRequestUtils httpRequestUtil = new HttpRequestUtils();
  45. String weiMengBaseUrl = "https://dopen.weimob.com";
  46. String addAttrValue = "/api/1_0/ec/category/addAttrValue";
  47. JSONObject bodyJson = new JSONObject();
  48. bodyJson.put("categoryId", 44);
  49. bodyJson.put("attrId", 53000);
  50. JSONArray noExistJson = new JSONArray();
  51. JSONObject tmp = new JSONObject();
  52. tmp.put("value", "01白色");
  53. noExistJson.add(tmp);
  54. bodyJson.put("attrValueList", noExistJson);
  55. JSONObject retJson = httpRequestUtil.httpPostRaw(weiMengBaseUrl + addAttrValue + "?accesstoken=87186ee0-b557-47f8-89d9-230cb3a1669f", bodyJson, null);
  56. System.out.println(retJson.toJSONString());
  57. }

添加商品

https://dopen.weimob.com/api/1_0/ec/goods/addGoods?accesstoken=a9dc920d-c488-4354-9c09-1c0d0463ceb5

传参:

{"goods":{"b2cGoods":{"b2cGoodsType":0,"deliveryTypeIdList":[3920196],"freightTemplateId":229050849},"categoryId":44,"deductStockType":1,"goodsDesc":"仙女裙","goodsImageUrl":["https://image-c.weimobwmc.com/openruntime/3ea7f5949c50488a8c436fa3073eea20.jpg"],"isMultiSku":1,"isPutAway":1,"selectedSaleAttrList":[{"attrValueList":[{"key":"148252623149"}],"attributeId":"53000"},{"attrValueList":[{"key":"148250430149"},{"key":"148250431149"}],"attributeId":"52000"}],"sellModelType":1,"skuList":[{"b2cSku":{"volume":"0.1","weight":"0.4"},"editStockNum":"0","outerSkuCode":"6018#","salePrice":"154.00","skuAttrMap":{"53000":{"name":"颜色","value":"40杏色","key":"148252623149"},"52000":{"name":"尺寸","value":"S","key":"148250430149"}}},{"b2cSku":{"volume":"0.1","weight":"0.4"},"editStockNum":"0","outerSkuCode":"6018#","salePrice":"154.00","skuAttrMap":{"53000":{"name":"颜色","value":"40杏色","key":"148252623149"},"52000":{"name":"尺寸","value":"M","key":"148250431149"}}}],"title":"6018#秋装新款可盐可甜亮片连衣裙网纱仙女裙性感晚礼服超仙"}}

返回数据:

{"globalTicket":"907260111855793408","code":{"errcode":"0","errmsg":"处理成功"},"data":{"result":true,"applyId":null,"skuList":[{"goodsId":null,"validateId":null,"imageUrl":null,"outerSkuCode":"6018#","storeId":null,"title":null,"skuId":2082944090149},{"goodsId":null,"validateId":null,"imageUrl":null,"outerSkuCode":"6018#","storeId":null,"title":null,"skuId":2082944100149}],"distributorId":null,"goodsId":1370590010149,"notDelDeliveryGoodsIds":null,"outerGoodsIdList":null,"deletedGoodsIds":null,"distributorResponse":null}}

3.获取微盟订单列表

获取微盟订单列表结构如下,pageList为订单数组。

itemList为商品列表,

商品中goodsCode为商品中的SPU编码,groupList为分组信息列表(可以在商品中进行设置,订单商品的这里也可以获取到,可用于区分不同平台商品)。

 

 

原文:https://blog.csdn.net/leadseczgw01/article/details/121566182

联系站长

QQ:769220720