说明:
本帖是利用支付宝正式环境测试账号测试活动详情查询接口,请求中根据文档传入了必传参数,大家可以配置自己的环境,根据自己的需求严格按照文档要求添加相关的可选参数,此demo仅供参考
测试环境:Eclipse+JDK1.6及以上+Tomcat6.0及以上
营销活动创建完成后,可以通过营销活动ID来查询活动详情信息。koubei.marketing.campaign.activity.query(活动详情查询)接口示例代码
package com.alipay.demo; import com.alipay.api.AlipayApiException;import com.alipay.api.AlipayClient;import com.alipay.api.DefaultAlipayClient;import com.alipay.api.domain.KoubeiMarketingCampaignActivityQueryModel;import com.alipay.api.request.KoubeiMarketingCampaignActivityQueryRequest;import com.alipay.api.response.KoubeiMarketingCampaignActivityQueryResponse;import com.alipay.config.AlipayConfig; public class KoubeiMarketingCampaignActivityQuery { /** * koubei.marketing.campaign.activity.query 活动详情查询 * * @param args */ public static void main(String[] args) { AlipayClient alipayClient = new DefaultAlipayClient(AlipayConfig.gatewayUrl, AlipayConfig.app_id, AlipayConfig.merchant_private_key, AlipayConfig.format, AlipayConfig.charset, AlipayConfig.alipay_public_key, AlipayConfig.sign_type); KoubeiMarketingCampaignActivityQueryRequest request = new KoubeiMarketingCampaignActivityQueryRequest(); KoubeiMarketingCampaignActivityQueryModel model = new KoubeiMarketingCampaignActivityQueryModel(); model.setCampId("20180314000000002577674000151339"); model.setOperatorId("2088501624560335"); model.setOperatorType("MER"); request.setBizModel(model); KoubeiMarketingCampaignActivityQueryResponse response; try { response = alipayClient.execute(request); if (response.isSuccess()) { System.out.println("调用成功"); System.out.println(response.getBody()); } else { System.out.println("调用失败"); System.out.println(response.getBody()); } } catch (AlipayApiException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
请求参数注意事项:
1.app_auth_token:ISV/开发者可以通过“第三方应用授权:[url]https://openclub.alipay.com/read.php?tid=1649[/url]”得到商家授权令牌(app_auth_token)作为请求参数传入,实现代商家发起请求的能力;
2..camp_id(活动id)通过koubei.marketing.campaign.activity.create (活动创建接口):[url]https://openclub.alipay.com/read.php?tid=2638&fid=74[/url]调用成功同步返回
调用成功返回信息:
{"koubei_marketing_campaign_activity_query_response":{"code":"10000","msg":"Success","camp_detail":{"activity_orders":[{"creator_id":"mpromocenter-40-5217","creator_type":"SYSTEM","order_id":"20180314000000010097427000155336","order_status":"SUCCESS","order_type":"CAMPAIGN_ENABLE_ORDER"},{"creator_id":"2088501624560335","creator_type":"MER","order_id":"20180314000000010239345000155337","order_status":"SUCCESS","order_type":"CAMPAIGN_CREATE_ORDER"}],"auto_delay_flag":"N","budget_info":{"budget_total":"10258","budget_type":"QUANTITY"},"constraint_info":{"suit_shops":["2017031500077000000027299729","2017031000077000000027197410"]},"desc":"该活动是用于挽回流失用户的","end_time":"2018-05-13 00:00:00","ext_info":"{\"CAMPAIGN_REGION_SUMMARY\":\"\",\"ENABLED_TRIGGER_TYPE\":\"AUTO\",\"STARTED_TRIGGER_TYPE\":\"AUTO\",\"isv_app_id\":\"2014100900013222\",\"usagedEnv\":\"PROD\"}","id":"20180314000000002577674000151339","name":"口碑门店消费满10元送1元代金券","promo_tools":[{"send_rule":{"min_cost":"100"},"status":"STARTED","voucher":{"brand_name":"券副标题测试","donate_flag":"true","effect_type":"IMMEDIATELY","end_time":"2018-05-13 00:00:00","ext_info":"{\"voucher_template_id\":\"20180314000730013360000Y6HIZ\"}","item_info":{"item_ids":["00012345678"],"item_name":"测试单品优惠","item_text":"单品卷测试"},"logo":"gKpPK40RSNeBiMxDsat8CQAAACMAAQED","name":"满10减1","start_time":"2018-03-13 00:00:00","type":"MONEY","use_instructions":["口碑门店满十减一特价优惠"],"use_rule":{"suit_shops":["2017031500077000000027299729","2017031000077000000027197410"]},"validate_type":"FIXED","voucher_note":"券的备注测试","worth_value":"1"},"voucher_no":"9541945aea0f48e1af27d5fe7d6dd306"}],"start_time":"2018-03-13 00:00:00","status":"STARTED","type":"RECHARGE_SEND"}},"sign":"bb3ZYyYJym1ec8JCVmiQhH0IB9y0dxv5e1TW6R2oMsJK3QGuSvT1Qlht5ST1BrDM1GyezROPJzBVjwnj11F/wmAIkSeduN6sLakwosyWbWPealQ02AdvSOYZT3GVzC4929RZ4u8uI/JEp5De6bDKmKMKW89m9DAWmMWeDFaybpU="}
如有疑问欢迎跟帖提问,不足之处欢迎多多吐槽!!!