说明及作用:
官网接口文档看一下:[url]https://docs.open.alipay.com/213/105272/[/url]
在口碑店铺页中,增加商家自定义区域。可由商家通过接口自定义上传带外链的图片广告,或者H5页面。这时广告 处于初始化状态,用户不能在钱包APP上看到!
其它说明:
测试该接口需要先使用这个上传门店照片和视频接口:[url]https://openclub.alipay.com/read.php?tid=4605&fid=71[/url]
调用获取到图片id或者图片url为测试该接口content_type传入方式为URL和PIC以供选择
调用代码示例:
复制代码
public static void createAd() { DefaultAlipayClient aliClient = alipayclient(); AlipayMarketingCdpAdvertiseCreateRequest request = new AlipayMarketingCdpAdvertiseCreateRequest(); request.setBizContent("{" + "\"ad_code\":\"CDP_OPEN_MERCHANT\"," + //这里也要改URL或者PIC "\"content_type\":\"URL\"," + //创建这里要改为https协议 "\"content\":\"https://oalipay-dl-django.alicdn.com/rest/1.0/image?fileIds=kGSB9--MRcS87H6SCT1LXQAAACMAAQQD&zoom=original\"," + "\"action_url\":\"https://www.baidu.com\"," + //此处输入自己的店铺id "\"ad_rules\":\"{\\\"shop_id\\\":[\\\"2016083000077000000018269663\\\"]}\"," + "\"height\":\"100\"," + "\"start_time\":\"2018-02-04 12:12:12\"," + "\"end_time\":\"2018-08-24 12:12:12\"" + "}"); try { AlipayMarketingCdpAdvertiseCreateResponse response = aliClient.execute(request); System.out.print(response.getBody()); } catch (AlipayApiException e) { // TODO Auto-generated catch block e.printStackTrace(); }}
接口同步返回:
复制代码
1
|
{
"alipay_marketing_cdp_advertise_create_response"
:{
"code"
:
"10000"
,
"msg"
:
"Success"
,
"ad_id"
:
"422039"
},
"sign"
:
"qY1ONC4Jqk/Sm76ONTzAcX/PIuNjXEVOhwu31R6i6E/rMbj2jYp3Yp1QHw8KpZ/vS+mDmBRyrKpNk7zzyRFCwFByWVEofkl7+N2bfUthnfVx7Es/tOvgkJlXDmnCTxrpCPsvaRoF1BDy5DlsDHQKZh2fNHQGZYcmHWHMMr1qgs4="
}
|
注意点:
1.content参数的传入要依据你content_type传入的参数类型选择,广告类型URL和PIC的像素要求不一样,具体参考文档描述
2.当content_type参数为pic类型height参数不传入,当广告类型是H5时,必须传入height参数
3.biz_ext_info和behavior为拓展预留参数,测试该接口可不用填写
4.action_url参数广告类型为PIC时,需要设置该值。必须为https协议,对于类型为URL不生效
报错提供信息:
appid+接口名+调用接口时间,最好将本次请求的完整参数一并发过来
如果大家在测试过程中遇到问题欢迎在帖子下方追问,请按照标准方式提问