使用SAP Cloud for Customer Product OData服务读取产品主数据和其图片信息

我在系统里创建了一个product,id为I043416, 描述信息为Mini Cooper:

使用SAP Cloud for Customer Product OData服务读取产品主数据和其图片信息

图片信息在Attachment区域:

使用SAP Cloud for Customer Product OData服务读取产品主数据和其图片信息
使用SAP Cloud for Customer Product OData服务读取产品主数据和其图片信息

使用一个OData服务读取该产品的明细包括图片信息。因为对数据是只读操作,故不需要额外的请求去获取csrf token.

请求url:https://xxx/sap/c4c/odata/v1/c4codata/ProductCollection?filter=IDfilter=ID%20eq%20%27I043416%27&expand=ProductAttachment

其中$filter=ID和&expand之间的值,实际是 eq ‘I043416’ 进行url encode后的值。

其中产品图片的二进制内容,以Base64的格式存储在节点ProductAttachment->Binary里。

使用SAP Cloud for Customer Product OData服务读取产品主数据和其图片信息

要获取更多Jerry的原创文章,请关注公众号"汪子熙":
使用SAP Cloud for Customer Product OData服务读取产品主数据和其图片信息