更新时间:2022-08-17 14:45:18
需要说明的是:
先在微信公众号后台获取APPID和APPSECRET
通过接口获取ACCESS_TOKEN
GET https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=APPID&secret=APPSECRET
文档:
https://developers.weixin.qq.com/doc/offiaccount/Basic_Information/Get_access_token.html
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" }
文档:
https://developers.weixin.qq.com/doc/offiaccount/Account_Management/URL_Shortener.html