Appearance
获取我的二维码
获取当前微信实例对应账号的个人二维码链接。
接口地址: POST /getQrCode
请求参数
| 参数名 | 必选 | 类型 | 说明 |
|---|---|---|---|
wId | 是 | string | 登录实例标识 |
请求示例
http
POST {BASE_URL}/getQrCode
Authorization: Bearer <你的调用凭证>
Content-Type: application/json
{
"wId": "0000016f-a2f0-03e3-0003-65e826091614"
}bash
curl -X POST '{BASE_URL}/getQrCode' \
-H 'Authorization: Bearer <你的调用凭证>' \
-H 'Content-Type: application/json' \
--data-raw '{
"wId": "0000016f-a2f0-03e3-0003-65e826091614"
}'python
import requests
url = "{BASE_URL}/getQrCode"
headers = {"Authorization": "Bearer <你的调用凭证>", "Content-Type": "application/json"}
body = """{
"wId": "0000016f-a2f0-03e3-0003-65e826091614"
}"""
resp = requests.post(url, headers=headers, data=body.encode("utf-8"))
print(resp.text)java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
String url = "{BASE_URL}/getQrCode";
String body = "{\n" +
" \"wId\": \"0000016f-a2f0-03e3-0003-65e826091614\"\n" +
"}";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder(URI.create(url))
.header("Authorization", "Bearer <你的调用凭证>")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(body))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());php
<?php
$url = '{BASE_URL}/getQrCode';
$body = <<<'JSON'
{
"wId": "0000016f-a2f0-03e3-0003-65e826091614"
}
JSON;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer <你的调用凭证>',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
echo $response;成功响应
json
{
"message": "成功",
"code": "1000",
"data": {
"qrCodeUrl": "http://qr.topscan.com/api.php?text=http://weixin.qq.com/x/QapmFw5pgyAShaPk2cLM",
"uuId": "QapmFw5pgyAShaPk2cLM"
}
}错误响应
json
{
"message": "失败",
"code": "1001",
"data": null
}响应参数
| 参数名 | 类型 | 说明 |
|---|---|---|
code | string | 1000 成功;其他值都是失败,通常是 1001 |
message | string | 反馈信息 |
data | object | 二维码信息 |
data.qrCodeUrl | string | 二维码图片或生成链接 |
data.uuId | string | 二维码唯一标识 |