Home > php教程 > php手册 > body text

微信公众平台开发(74) 用户分组管理

WBOY
Release: 2016-06-13 10:17:40
Original
1535 people have browsed it

微信公众平台开发 用户分组管理 分组管理接口 查询分组 创建分组 修改分组名 移动用户分组
作者:方倍工作室 
地址:http://www.cnblogs.com/txw1958/p/weixin74-group-manage.html 

 

开发者可以使用接口,对公众平台的分组进行查询、创建、修改操作,也可以使用接口在需要时移动用户到某个分组。

 

创建分组

一个公众账号,最多支持创建500个分组。 接口调用请求说明

http请求方式: POST(请使用https协议)
https://api.weixin.qq.com/cgi-bin/groups/create?access_token=ACCESS_TOKEN
POST数据格式:json
POST数据例子:{"group":{"name":"test"}}
Copy after login

参数说明

参数说明
access_token 调用接口凭证
name 分组名字(30个字符以内)

返回说明 正常时的返回JSON数据包示例:

{
    "group": {
        "id": 107, 
        "name": "test"
    }
}
Copy after login

参数说明

参数说明
id 分组id,由微信分配
name 分组名字,UTF8编码

错误时的JSON数据包示例(该示例为AppID无效错误):

{"errcode":40013,"errmsg":"invalid appid"}



Copy after login

创建代码:

 = '{"group":{"name":"朋友"}}' = "https://api.weixin.qq.com/cgi-bin/groups/create?access_token=6j68MFz5WyxI2_xrdSj1XfjhZu7c3qTpgC8PrBznfqUbHe8kbaEe_mEDWZi2TdPYpAx9ljJNkmy1B6-A7dPe2y9L7RdwcjN2QKrhOydyOnveek111j7crIrNHzFzuKpii8VpFpizs7YGcwuangkEXg" = https_post(,( https_post(, =, CURLOPT_URL, , CURLOPT_SSL_VERIFYPEER, , CURLOPT_SSL_VERIFYHOST, , CURLOPT_POST, 1, CURLOPT_POSTFIELDS, , CURLOPT_RETURNTRANSFER, 1 = curl_exec( (curl_errno( 'Errno'.curl_error( 
Copy after login

返回

(36) "{"group":{"id":100,"name":"朋友"}}"
Copy after login

效果




Copy after login

============================================

方倍工作室微信公众平台账号关注方法:
1. 微信通讯录-添加朋友-查找公众号-搜索“方倍工作室”
2. 微信通讯录-添加朋友-搜号码-输入“pondbaystudio”
3. 使用微信扫描下面的二维码

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!