(1) customer的查询:
https:// jerry.c4c.saphybriscloud.cn /sap/c4c/odata/v1/c4codata/IndividualCustomerCollection? $filter=CustomerID eq '1000490'
上述url的语义是,在系统里查询CustomerID为1000490的customer数据。如果存在,返回格式如下,即该customer的明细:

如果指定一个在系统中不存在的customer ID,结果如下:

(2) 客户的创建
url: https:// jerry.c4c.saphybriscloud.cn /sap/c4c/odata/v1/c4codata/IndividualCustomerCollection
csrf token的获取方式,Jerry之前已经介绍过:

请求正文:

将微信用户的open id赋给LastName,微信用户昵称赋给FirstName,RoleCode维护成BUP002(代表该客户代表一个Prospect),创建成功后,HTTP状态码201,返回系统自动分配的CustomerID:1004481

成功创建的Customer在系统里显示如图:

如果在创建时将微信用户的openID和Cloud for Customer系统里的客户LastName字段绑定的话,下次就可以直接用wechat openID查询C4C系统里有无对应客户了。
https:// jerry.c4c.saphybriscloud.cn /sap/c4c/odata/v1/c4codata/IndividualCustomerCollection? $filter=LastName eq 'Jerry_Wechat_openid'

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/24475491/viewspace-2681757/ ,如需转载,请注明出处,否则将追究法律责任。