需要说明的是:
第一步:获取ACCESS_TOKEN
先在微信公众号后台获取APPID和APPSECRET
通过接口获取ACCESS_TOKEN
GET https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=APPID&secret=APPSECRET
第二步:长连接转短连接
POST https://api.weixin.qq.com/cgi-bin/shorturl?access_token=ACCESS_TOKEN
content-type: application/json
{
"action": "long2short",
"long_url":"https://mp.weixin.qq.com/s/mcChCB3vRKmte5a1oP0qVQ"
}
返回结果
{
"errcode": 0,
"errmsg": "ok",
"short_url": "https:\/\/w.url.cn\/s\/AE7X97r"
}