请选择 进入手机版 | 继续访问电脑版

有赞新零售社区

发帖
聊天专版»调用客户创建接口报错

调用客户创建接口报错

孕橙 2018-12-24 1295 浏览 6 评论 | [显示全部楼层] [打印]
生成的token:51bf2d62ecfd31e384b69491cf5eb0af
传入参数:{"birthday":"1987-08-03","gender":1,"name":"李明","remark":"无","contact_address":{"address":"清华西路115号","area_code":"100091"}}


所报错误:

2018-12-24 15:14:45.540 ERROR 12412 --- [nio-9090-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is com.youzan.open.sdk.exception.KDTException: ErrorResponse{code='143001027', msg='null'}] with root cause

com.youzan.open.sdk.exception.KDTException: ErrorResponse{code='143001027', msg='null'}
    at com.youzan.open.sdk.client.core.DefaultYZClient.handleError(DefaultYZClient.java:115) ~[open-sdk-java-2.0.2.jar:na]
    at com.youzan.open.sdk.client.core.DefaultYZClient.invoke(DefaultYZClient.java:90) ~[open-sdk-java-2.0.2.jar:na]

但是把参数放到有赞开放API调试工具里可以

    您好,可以具体描述下你的问题场景吗?以便我们了解您所遇到的问题,提出解决方案,您也可以到店铺后台右侧边栏咨询在线客服,或拨打商家服务热线:0571-89988848 ,感谢您对有赞的支持!

      孕橙 青铜   2018-12-24 显示全部楼层
      您好,这个问题是我做测试的,我写了一个方法,调用你们的接口想添加一个客户,就报这个错了

        孕橙 青铜   2018-12-24 显示全部楼层
        以下是代码:
        public void createCustomer() throws Exception{
                YZClient client = new DefaultYZClient(new Token(getYouzanAccessToken())); //new Sign(appKey, appSecret)
                YouzanScrmCustomerCreateParams youzanScrmCustomerCreateParams = new YouzanScrmCustomerCreateParams();

                youzanScrmCustomerCreateParams.setMobile("18632783979");
                YouzanCustom youzanCustom = new YouzanCustom();
                youzanCustom.setBirthday("1987-08-03");
                youzanCustom.setGender(1);
                youzanCustom.setName("李明");
                youzanCustom.setRemark("无");

                YouzanContactAddress youzanContactAddress=new YouzanContactAddress();
                youzanContactAddress.setAddress("清华西路115号");
                youzanContactAddress.setArea_code("100091");

                youzanCustom.setContact_address(youzanContactAddress);

                //转成json字符串
                String json = JSON.toJSON(youzanCustom).toString();
                System.out.println(json);
                youzanScrmCustomerCreateParams.setCustomerCreate(json);

                YouzanScrmCustomerCreate youzanScrmCustomerCreate = new YouzanScrmCustomerCreate();
                youzanScrmCustomerCreate.setAPIParams(youzanScrmCustomerCreateParams);
                YouzanScrmCustomerCreateResult result = client.invoke(youzanScrmCustomerCreate);
            }

          孕橙 青铜   2018-12-24 显示全部楼层

            孕橙 发表于 2018-12-24 15:59
            以下是代码:
            public void createCustomer() throws Exception{
                    YZClient client = new DefaultYZ ...


            这个报错是resultStr":"{\"error_response\":{\"code\":143001027,\"message\":\"客户已存在\"}}"} 需要更换手机号和name

              孕橙 青铜   2018-12-26 显示全部楼层
              导演 发表于 2018-12-24 17:07
              这个报错是resultStr":"{\"error_response\":{\"code\":143001027,\"message\":\"客户已存在\"}}"} 需要 ...


              正解,谢谢了

                1跳至
                您需要登录后才可以回帖 登录 | 立即注册

                本版积分规则

                复制链接
                新浪微博
                QQ空间
                微信扫码
                • 回复

                • 评分

                客服工作时间是9:00-18:00,客服妹子当前不在线,若不能及时回复请谅解。试试右上角的搜索吧,论坛有丰富的经验贴、公告贴,相信一定能够帮到您~

                复制成功