说明:
本帖是测试口碑营销活动列表查询,只能查询到通过接口创建的营销活动,首先要创建口碑门店
测试环境:JAVA1.5+,eclipse
是否支持沙箱环境:支持
接口文档:查看
sdk下载:下载
沙箱Java版营销活动demo:download:营销活动Java版.zip
1.代码请求示例
AlipayClient alipayClient = new DefaultAlipayClient(AlipayConfig.URL ,AlipayConfig.APPID,AlipayConfig.RSA_PRIVATE_KEY,"json",AlipayConfig.CHARSET,AlipayConfig.ALIPAY_PUBLIC_KEY,"RSA2"); KoubeiMarketingCampaignActivityBatchqueryRequest request = new KoubeiMarketingCampaignActivityBatchqueryRequest(); //通过活动开始时间startTime和 结束时间endTime进行查询 request.setBizContent("{" + "\\"query_criterias\\":"+ "[{\\"field_name\\":\\"startTime\\",\\"field_value\\":\\"2018-03-15 00:00:00\\",\\"operator\\":\\"IN\\"},"+ "{\\"field_name\\":\\"endTime\\",\\"field_value\\":\\"2018-03-17 00:00:00\\",\\"operator\\":\\"IN\\"}]," + "\\"page_number\\":\\"1\\"," + "\\"operator_id\\":\\"2088522421611655\\"," + "\\"operator_type\\":\\"MER\\"," + "\\"page_size\\":\\"20\\"" + " }"); //通过活动状态status查询 /* request.setBizContent("{" + "\\"query_criterias\\":"+ "[{\\"field_name\\":\\"status\\",\\"field_value\\":\\"STARTED|CLOSED\\",\\"operator\\":\\"IN\\"}"+ "]," + "\\"page_number\\":\\"1\\"," + "\\"operator_id\\":\\"2088522421611655\\"," + "\\"operator_type\\":\\"MER\\"," + "\\"page_size\\":\\"20\\"" + " }");*/ //通过活动名称name查询 /*request.setBizContent("{" + "\\"query_criterias\\":"+ "[{\\"field_name\\":\\"name\\",\\"field_value\\":\\"煜雨消费满10元送1元代金券\\",\\"operator\\":\\"EQUAL\\"}"+ "]," + "\\"page_number\\":\\"1\\"," + "\\"operator_id\\":\\"2088522421611655\\"," + "\\"operator_type\\":\\"MER\\"," + "\\"page_size\\":\\"20\\"" + " }");*/ KoubeiMarketingCampaignActivityBatchqueryResponse response = alipayClient.execute(request); if(response.isSuccess()){ System.out.println("调用成功"); } else { System.out.println("调用失败"); } System.out.println(response.getBody());
2.请求成功返回信息示例
调用成功 {"koubei_marketing_campaign_activity_batchquery_response":{"code":"10000","msg":"Success","camp_sets":[{"activity_orders":[{"creator_id":"mpromocenter-49-5015","creator_type":"SYSTEM","order_id":"20180315000000010027147000155657","order_status":"SUCCESS","order_type":"CAMPAIGN_ENABLE_ORDER"},{"creator_id":"2088522421611655","creator_type":"MER","order_id":"20180315000000010119487000155653","order_status":"SUCCESS","order_type":"CAMPAIGN_CREATE_ORDER"}],"auto_delay_flag":"N","creator_type":"MER","end_time":"2018-04-01 00:00:00","id":"20180315000000002603053000151658","name":"煜雨消费满10元送1元代金券","start_time":"2018-03-15 00:00:00","status":"STARTED","type":"GUESS_SEND"}],"total_number":1},"sign":"XXX"}
3.注意事项
1>.通过活动时间(startTime、endTime)或活动名称(name)查询时,query_criterias中的operator参数操作符不能设置 为IN;活动状态status查询query_criterias中的operator参数操作符不能设置为EQUAL,否则会报错“不支持的操作符”
报错示例:
调用失败 {"koubei_marketing_campaign_activity_batchquery_response":{"code":"40004","msg":"Business Failed","sub_code":"REQ_VALIDATE_ERROR","sub_msg":"不支持的操作符"},"sign":"XXX"}
2>.不可以同时设置多个不同的查询条件进行查询,比如:同时通过活动名称(name)和活动状态(status)进行查询,否则会报错“入参格式不正确, , 请检查入参”
报错示例:
调用失败 {"koubei_marketing_campaign_activity_batchquery_response":{"code":"40004","msg":"Business Failed","sub_code":"REQ_VALIDATE_ERROR","sub_msg":"入参格式不正确, , 请检查入参"},"sign":"XXX"}
4.提问:
请按照appid+使用环境(正式/沙箱)+调用接口时间,最好将本次请求的完整参数一并发过来
如有其它问题,欢迎论坛评论留言,如有不足之处也欢迎多多吐槽