大淘客,让选品更简单! |

{{item.type_name}}:

API 市场 / 优惠券查询
 

优惠券查询
吐槽建议
应用场景:
可用于查券机器人,当用户提供商品链接或者淘口令时,给用户返回商品优惠券信息,让用户领券下单
接口说明:
接口可用于获取某个具体的优惠券信息(领券量,剩余量、使用周期等等),支持二合一链接,淘口令,或同时输入商品+优惠券链接进行查询
使用人数: 1000+
优惠券查询 接口测试 建议使用通用GET方法调用
  • 接口说明
  • 更新日志
  • 接口版本号:v1.0.0

请求地址:https://openapi.dataoke.com/api/dels/taobao/kit/coupon/get-coupon-info 复制

请求方式:GET

公共参数:
请求参数:

注:请求参数须区分大小写

返回数据:
调用示例:
String url = "https://openapi.dataoke.com/api/dels/taobao/kit/coupon/get-coupon-info";
String appKey = "xxx";
String appSecret = "xxx";
TreeMap<String, String> paraMap = new TreeMap<>();
paraMap.put("version", "v1.0.0");
paraMap.put("content", 12);
String data = ApiClient.sendReq(url, appSecret, paraMap);

SDK调用示例
String appKey = "xxx";
String appSecret = "xxx";
DtkApiClient client = DtkApiClient.getInstance(appKey,appSecret);
DtkCouponQueryRequest request = new DtkCouponQueryRequest();
request.setVersion("v1.0.0");
request.setContent("https://detail.tmall.com/item.htm?spm=a230r.1.14.4.3b014bb1PkrElh&id=630464637415&cm_id=140105335569ed55e27b&abbucket=13"); //√
DtkApiResponse < DtkCouponQueryResponse > execute = client.execute(request);
    //优惠券查询
    $data = [
        'appKey' => "xxxxxxxxxxxx",
        'version' => "v1.0.0",
        ...
    ];
    $host = "https://openapi.dataoke.com/api/dels/taobao/kit/coupon/get-coupon-info";
    $url = $host . '?' . http_build_query($data);
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_TIMEOUT, $this->timeout);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    $output = curl_exec($ch);
    $a = curl_error($ch);
    if(!empty($a)){
        return json_encode(array('code'=>10003, 'msg'=>$a));
    }
    curl_close($ch);
    return $output;

    SDK调用示例
    $client = new GetCouponInfo();
    $client->setAppKey("xxxxxxxxx");
    $client->setAppSecret("xxxxxxxxxxxxxxxxxxxxxxxxx");
    $client->setVersion("v1.0.0");

    $res = $client->setParams([])->request();
package main

import (
	"fmt"
	"gitee.com/dtk-developer/openapi-sdk-go/sdk"
)

func main() {
	// 1.初始化所需要的参数appKey, appSecret, version
	var (
		appKey = "xxxxxxxxxx"
		appSecret = "xxxxxxxxxx"
		version = "v1.3.1"
	)

	// 2.初始化开放平台api的客户端句柄
	oa := &sdk.OpenApi{}
	oa.AppKey = appKey
	oa.AppSecret = appSecret
	oa.Version = version
	client :=  oa.GetClient()

	// 3.准备请求参数
	params := map[string]string {
		"content": "639331017111",
	}

	// 4.业务请求,示例使用优惠券查询和淘系万能解析接口,其它开放接口使用方法相同
	resp, err := client.GetCouponInfo(params)
	if err != nil {
		panic(err)
	}
	fmt.Println(resp)

	// 复用client句柄
	params = map[string]string {
		// 指定接口版本
		"version": "v1.0.0",
		"content": "1👈¥fym8XiJU9Oi¥ https://s.click.taobao.com/Ys3TNlu  包邮 漫花抽纸10包4层加厚280张/包纸巾卫生纸家用实惠装面巾纸",
	}
	resp, err = client.ParseContent(params)
	if err != nil {
		panic(err)
	}
	fmt.Println(resp)
}
返回示例:
{
    "requestId": "2b9ed72ef6844429909c0edbf748e7a2",
    "time": 1611284342959,
    "code": 0,
    "msg": "成功",
    "data": {
        "couponId": "271dbf9d1f7c498eb8f19ae3cc38f5de",
        "couponAmount": 40,
        "couponTotalNum": 100000,
        "couponReceiveNum": 7000,
        "couponRemainNum": 93000,
        "couponConditions": "59",
        "couponStartTime": "2021-01-21",
        "couponEndTime": "2021-01-23",
        "couponLink": "https://uland.taobao.com/quan/detail?sellerId=752847099&activityId=271dbf9d1f7c498eb8f19ae3cc38f5de"
    }
}
常见错误码:
[{"id":1,"code":"-1","desc":"服务器错误","faq":"稍后尝试访问","pid":-1},{"id":1,"code":"1","desc":"参数错误","faq":"请根据msg提示信息进行修改","pid":-1}]
错误码列表: