如何调用接口创建客户
如何调用接口创建客户
答:创建客户请参考文档 https://doc.youzanyun.com/doc#/content/API/1-405/detail/api/0/92,请参考以下代码
YouzanScrmCustomerCreate youzanScrmCustomerCreate = new YouzanScrmCustomerCreate();
//设置customer_create参数
YouzanScrmCustomerCreateParams youzanScrmCustomerCreateParams = new YouzanScrmCustomerCreateParams();
YouzanScrmCustomerCreateParams.YouzanScrmCustomerCreateParamsCustomercreate youzanScrmCustomerCreateParamsCustomercreate
= new YouzanScrmCustomerCreateParams.YouzanScrmCustomerCreateParamsCustomercreate();
youzanScrmCustomerCreateParamsCustomercreate.setBirthday("1988-05-13 00:00:00");
youzanScrmCustomerCreateParamsCustomercreate.setName("阿文1234");
youzanScrmCustomerCreateParamsCustomercreate.setRemark("阿文1234");
youzanScrmCustomerCreateParamsCustomercreate.setBirthday("1990-12-03");
youzanScrmCustomerCreateParamsCustomercreate.setGender((short)1);
// 设置 contact_address 参数
YouzanScrmCustomerCreateParams.YouzanScrmCustomerCreateParamsContactaddress youzanScrmCustomerCreateParamsContactaddress =
new YouzanScrmCustomerCreateParams.YouzanScrmCustomerCreateParamsContactaddress();
youzanScrmCustomerCreateParamsContactaddress.setAreaCode(310000);
youzanScrmCustomerCreateParamsContactaddress.setAddress("浙江省杭州市西湖区文三西路223号");
// 入参设置
youzanScrmCustomerCreateParams.setMobile(String.valueOf(15144445335L));
youzanScrmCustomerCreateParamsCustomercreate.setContactAddress(youzanScrmCustomerCreateParamsContactaddress);
youzanScrmCustomerCreateParams.setCustomerCreate(youzanScrmCustomerCreateParamsCustomercreate);
youzanScrmCustomerCreate.setAPIParams(youzanScrmCustomerCreateParams);
YouzanScrmCustomerCreateResult result = yzClient.invoke(youzanScrmCustomerCreate, token, YouzanScrmCustomerCreateResult.class);
JSONObject jsonObject = JSONObject.parseObject(JSON.toJSONString(result.getData()));
System.out.println(jsonObject);
当创建完成之后,会返回
{"account_type":"YouZanAccount","account_id":"10229699578","yz_open_id":"qFIZsyWB714776945937694720"}
- account_type 账号类型
- account_id 账号 id
- yz_open_id 有赞的 open_id
在店铺后台的客户 - 客户查询中就可以查看新创建的客户了