Appearance
朋友圈隐私设置
设置整个账号的朋友圈隐私:好友能看多久、陌生人能不能看。改的是全局设置,不是某一条朋友圈的可见性。
接口地址: POST /snsPrivacySettings
说明与注意
- 设置后立即生效;手机端显示可能有延迟,约 30 秒后重启微信能看到。
请求参数
| 参数名 | 必选 | 类型 | 说明 |
|---|---|---|---|
| wId | 是 | string | 登录实例标识 |
| type | 是 | int | 权限类型,见下方说明 |
type 取值说明
| 值 | 含义 |
|---|---|
10 | 允许好友查看全部朋友圈 |
11 | 允许好友查看近半年 |
12 | 允许好友查看近一个月 |
13 | 允许好友查看近三天 |
20 | 允许陌生人查看十条朋友圈 |
21 | 不允许陌生人查看朋友圈 |
请求示例
http
POST {BASE_URL}/snsPrivacySettings
Authorization: Bearer <你的调用凭证>
Content-Type: application/json
{
"wId": "b7ad08a6-77c2-4ad6-894a-29993b84c0e4",
"type": 11
}bash
curl -X POST '{BASE_URL}/snsPrivacySettings' \
-H 'Authorization: Bearer <你的调用凭证>' \
-H 'Content-Type: application/json' \
--data-raw '{
"wId": "b7ad08a6-77c2-4ad6-894a-29993b84c0e4",
"type": 11
}'python
import requests
url = "{BASE_URL}/snsPrivacySettings"
headers = {"Authorization": "Bearer <你的调用凭证>", "Content-Type": "application/json"}
body = """{
"wId": "b7ad08a6-77c2-4ad6-894a-29993b84c0e4",
"type": 11
}"""
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}/snsPrivacySettings";
String body = "{\n" +
" \"wId\": \"b7ad08a6-77c2-4ad6-894a-29993b84c0e4\",\n" +
" \"type\": 11\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}/snsPrivacySettings';
$body = <<<'JSON'
{
"wId": "b7ad08a6-77c2-4ad6-894a-29993b84c0e4",
"type": 11
}
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
{
"code": "1000",
"message": "成功",
"data": null
}错误响应
json
{
"code": "1001",
"message": "失败",
"data": null
}响应参数
| 参数名 | 类型 | 说明 |
|---|---|---|
| code | string | 1000 成功;其他值都是失败,通常是 1001 |
| message | string | 反馈信息 |
| data | null | 无业务数据返回 |