获取SPU发布规则和模板
一、请求参数
发布商品和发布SPU前需要调用此接口查看类目是否为SPU类目,如果是,会返回对应的管控策略和SPU发布表单
请求URL:
公共参数
| 参数名称 | 参数类型 | 是否必须 | 示例值 | 参数描述 |
|---|---|---|---|---|
| appid | String | 是 | 合作伙伴AppId | |
| timestamp | String | 是 | 1657525936 | 当前Unix时间戳,秒 |
| seller_nick | String | 是 | 38173182 | 抖店的账号,对应蜂巢授权返回doudianseller字段 |
| sign | String | 是 |
业务参数
| 参数名称 | 参数类型 | 是否必须 | 示例值 | 参数描述 |
|---|---|---|---|---|
| category_id | Int64 | 是 | 23362 | 类目ID |
二、请求示例代码
Java
请求示例代码
@Test public void DDSpuGetspuRule() throws Exception { Map<String, Object> data = new HashMap<String, Object>(); data.put("appid", Config.AppId); Long timestamp = System.currentTimeMillis() / 1000; data.put("timestamp", timestamp.toString()); data.put("seller_nick", Config.DDSellerNick); data.put("category_id",23362 ); data.put("sign", Sign(data,Config.AppSecret)); // 调用服务API String resp = doHttpRequest(Config.DDSpuGetSpuRule, data); System.out.println(resp); }三、返回结果
{ "data": { "control_type": "2", "spu_actual_images_rule": { "is_required": "1", "max_num": "5", "min_num": "1" }, "spu_barcode_rule": { "barcode_image_rule": { "data_format": "[\"png\",\"jpg\",\"jpeg\"]", "is_required": "1", "max_num": "5", "min_num": "1" }, "barcode_rule": { "is_required": "1", "max_num": "1", "min_num": "1" } }, "spu_images_rule": { "is_required": "1", "max_num": "5", "min_num": "1" }, "spu_material_rules": [{ "material_rule": { "aspect_ratio": "[\"1\",\"1\"]", "data_format": "[\"png\",\"jpg\",\"jpeg\"]", "is_required": "0", "max_num": "5", "max_size": "5", "min_num": "0", "name": "主图", "pixel": "[600,600]" }, "material_type": "1" }], "spu_proof_rules": [{ "proof_rule": { "aspect_ratio": "[\"1\",\"1\"]", "data_format": "[\"png\",\"jpg\",\"jpeg\"]", "is_required": "1", "max_num": "5", "max_size": "5", "min_num": "1", "name": "版权页", "pixel": "[600,600]" }, "proof_type": "6" }], "spu_property_rule": [{ "diy_type": "0", "is_required": "1", "max_select_num": "0", "property_id": "1831", "property_name": "书名", "property_type": "0", "value_type": "select", "values": [{ "value_id": "0", "value_name": "小王子" }] }], "support_create_spu": "true", "support_spu_product": "true" }, "code": 10000, "msg": "success", "sub_code": "", "sub_msg": ""}说明: code为0表示成功,非0为失败,message会包含失败原因。返回字段说明见文档 https://op.jinritemai.com/docs/api-docs/14/2312