User tag management
User tag management
Developers can use the relevant interfaces of user tag management to create and create tags for public accounts. Operations such as query, modification, and deletion can also be performed on users, such as labeling and unlabeling.
Tag management
##1. Create tags
A public account can create up to 100 tags. Interface call request description
http request method: POST (please use https protocol)https://api.weixin.qq.com/cgi-bin/tags/create?access_token=ACCESS_TOKENPOST data format: JSONPOST data example: { "tag" : { "name" : "Guangdong"//Tag name }} Parameter description
Parameter Description access_token Call interface credentials name Tag name (within 30 characters)
Return description (example of json data packet returned when normal)
##{ "tag":{"id":134,//Tag id"name":"Guangdong" }} Return parameter description
Parameter Description id Tag id, assigned by WeChat name Tag name, UTF8 encoding
Error code description
Error code Description -1 The system is busy ##45157 The tag name is illegal, please be careful not to duplicate it with other tags Name 45158 The tag name length exceeds 30 bytes 45056 Created tag Too many, please note that it cannot exceed 100 2. Get the tags created by the official account
Interface call request description
##http request method: GET (please use https protocol)https://api.weixin.qq.com/cgi-bin/tags/get?access_token=ACCESS_TOKEN Return instructions
##{ "tags":[{ "id":1, "name":"One Can of Coke a Day", "count":0 //The number of fans under this tag} ,{ "id":2, "name":"star group", "count":0},{ "id":127, "name":"Guangdong", "count":5} ]} 3. Edit tag
Interface call request description
http request method :POST (please use https protocol)
https://api.weixin.qq.com/cgi-bin/tags/update?access_token=ACCESS_TOKEN
POST data format: JSON
POST data example:
{
"tag" : {
"id" : 134,
"name" : "Guangdong people"
}
}
Return description
{
"errcode":0,
"errmsg":"ok"
}
Error code description
Error code Description -1 The system is busy ##45157 The tag name is illegal, please be careful not to duplicate it with other tags Name 45158 The tag name length exceeds 30 bytes 45058 Cannot be modified 0 /1/2 Tags reserved by default for these three systems 4. Delete tags
Please note that when the number of fans under a certain tag exceeds 100,000, the tag cannot be deleted directly in the background. At this time, developers can first cancel the label in the openid list under the label, and then delete the label directly until the number of fans does not exceed 100,000.
Interface call request description
http request method: POST (please use https protocol ) https://api.weixin.qq.com/cgi-bin/tags/delete?access_token=ACCESS_TOKEN
POST data format: JSON
POST data example:
{
"tag":{
"id" : 134
}
}
Return description
##{ "errcode":0, "errmsg ":"ok"} Error code description
Error code Description -1 The system is busy 45058 Cannot modify the three systems 0/1/2 Tags retained by default 45057 The number of fans under this tag exceeds 100,000, and direct deletion is not allowed
5. Get the list of fans under the tag
Interface call request description
## http request method: GET (please use https protocol)https://api.weixin.qq.com/cgi-bin/user/tag/get?access_token=ACCESS_TOKENPOST data Format: JSONPOST data example:{ "tagid" : 134, "next_openid":""//The first pull Get the OPENID, if not filled in, it will be pulled from scratch by default } Return description (example of json package returned when normal)
{
"count ":2,//The number of fans obtained this time
"data":{//Fans list
"openid":[
"ocYxcuAEy30bX0NXmGn4ypqx3tI0",
"ocYxcuBt0mRugKZ7tGAHPnUaOW7Y"
]
},
"next_openid":"ocYxcuBt0mRugKZ7tGAHPnUaOW7Y"//Pull the openid of the last user in the list
}
Error code description
Error code Description -1 The system is busy 40003 Incoming illegal openid 45159 Illegal tag_id
User Management
The label function currently supports public accounts to label up to three labels for users.
1. Tag users in batches
Interface call request instructions
http request method: POST (please use https protocol)
https://api.weixin.qq.com/cgi-bin/tags/members/batchtagging?access_token=ACCESS_TOKEN
POST data format: JSON
POST data example:
{
"openid_list" : [//Fan list
"ocYxcuAEy30bX0NXmGn4ypqx3tI0",
"ocYxcuBt0mRugKZ7tGAHPnUaOW7Y"
],
"tagid" : 134
}
Return instructions (example of json package returned when normal)
{
"errcode ":0,
"errmsg":"ok"
}
Error code description
Error code Description -1 The system is busy 40032 The number of openid lists passed in each time Cannot exceed 50 45159 Illegal tags 45059 Tags on fans The number has exceeded the limit 40003 Incoming illegal openid 49003 Incoming openid does not belong to this AppID
2. Cancel tags for users in batches
Interface call request instructions
http request method: POST (please use https protocol)
https://api.weixin.qq.com/cgi-bin/tags/members/batchuntagging?access_token=ACCESS_TOKEN
POST data format: JSON
POST data example:
{
"openid_list" : [//Fan list
"ocYxcuAEy30bX0NXmGn4ypqx3tI0",
"ocYxcuBt0mRugKZ7tGAHPnUaOW7Y"
],
"tagid" : 134
}
Return instructions (example of json package returned when normal)
{
"errcode ":0,
"errmsg":"ok"
}
Error code description
Error code Description -1 The system is busy 40032 The number of openid lists passed in each time Cannot exceed 50 45159 Illegal tags 40003 Incoming illegal openid 49003 The incoming openid does not belong to this AppID
3. Get the tag list on the user
Interface call request description
http request method: POST (please use https protocol)
https://api.weixin.qq.com/cgi-bin/tags/getidlist?access_token=ACCESS_TOKEN
POST data format: JSON
POST data example:
{
"openid" : "ocYxcuBt0mRugKZ7tGAHPnUaOW7Y"
}
Return description (json example returned under normal circumstances)
{ " tagid_list":[//The set tag list
134,
2
]
}
Error code description
Error code Description -1 系统繁忙 40003 传入非法的openid 49003 传入的openid不属于此AppID
User tag management
Developers can use the relevant interfaces of user tag management to create and create tags for public accounts. Operations such as query, modification, and deletion can also be performed on users, such as labeling and unlabeling.
Tag management
##1. Create tags
A public account can create up to 100 tags.Interface call request description
http request method: POST (please use https protocol)https://api.weixin.qq.com/cgi-bin/tags/create?access_token=ACCESS_TOKENPOST data format: JSONPOST data example: { "tag" : { "name" : "Guangdong"//Tag name }} |
Parameter | Description |
access_token | Call interface credentials |
name | Tag name (within 30 characters) |
Return description (example of json data packet returned when normal)
"tag":{"id":134,//Tag id"name":"Guangdong" }} |
Parameter | Description |
id | Tag id, assigned by WeChat |
name | Tag name, UTF8 encoding |
Error code description
Error code | Description |
-1 | The system is busy |
The tag name is illegal, please be careful not to duplicate it with other tags Name | |
The tag name length exceeds 30 bytes | |
Created tag Too many, please note that it cannot exceed 100 |
##http request method: GET (please use https protocol)https://api.weixin.qq.com/cgi-bin/tags/get?access_token=ACCESS_TOKEN |
##{ "tags":[{ "id":1, "name":"One Can of Coke a Day", "count":0 //The number of fans under this tag} ,{ "id":2, "name":"star group", "count":0},{ "id":127, "name":"Guangdong", "count":5} ]} |
http request method :POST (please use https protocol) https://api.weixin.qq.com/cgi-bin/tags/update?access_token=ACCESS_TOKEN POST data format: JSON POST data example: { "tag" : { "id" : 134, "name" : "Guangdong people" } } |
Return description
{ "errcode":0, "errmsg":"ok" } |
Error code description
Error code | Description |
-1 | The system is busy |
The tag name is illegal, please be careful not to duplicate it with other tags Name | |
The tag name length exceeds 30 bytes | |
Cannot be modified 0 /1/2 Tags reserved by default for these three systems |
http request method: POST (please use https protocol ) https://api.weixin.qq.com/cgi-bin/tags/delete?access_token=ACCESS_TOKEN POST data format: JSON POST data example: { "tag":{ "id" : 134 } } |
Return description
##{ "errcode":0, "errmsg ":"ok"} |
Error code | Description |
-1 | The system is busy |
45058 | Cannot modify the three systems 0/1/2 Tags retained by default |
45057 | The number of fans under this tag exceeds 100,000, and direct deletion is not allowed |
5. Get the list of fans under the tag
Interface call request description
## http request method: GET (please use https protocol)https://api.weixin.qq.com/cgi-bin/user/tag/get?access_token=ACCESS_TOKENPOST data Format: JSONPOST data example:{ "tagid" : 134, "next_openid":""//The first pull Get the OPENID, if not filled in, it will be pulled from scratch by default } |
{ "count ":2,//The number of fans obtained this time "data":{//Fans list "openid":[ "ocYxcuAEy30bX0NXmGn4ypqx3tI0", "ocYxcuBt0mRugKZ7tGAHPnUaOW7Y" ] }, "next_openid":"ocYxcuBt0mRugKZ7tGAHPnUaOW7Y"//Pull the openid of the last user in the list } |
Error code description
Error code | Description |
-1 | The system is busy |
40003 | Incoming illegal openid |
45159 | Illegal tag_id |
User Management
The label function currently supports public accounts to label up to three labels for users.
1. Tag users in batches
Interface call request instructions
http request method: POST (please use https protocol) https://api.weixin.qq.com/cgi-bin/tags/members/batchtagging?access_token=ACCESS_TOKEN POST data format: JSON POST data example: { "openid_list" : [//Fan list "ocYxcuAEy30bX0NXmGn4ypqx3tI0", "ocYxcuBt0mRugKZ7tGAHPnUaOW7Y" ], "tagid" : 134 } |
Return instructions (example of json package returned when normal)
{ "errcode ":0, "errmsg":"ok" } |
Error code description
Error code | Description |
-1 | The system is busy |
40032 | The number of openid lists passed in each time Cannot exceed 50 |
45159 | Illegal tags |
45059 | Tags on fans The number has exceeded the limit |
40003 | Incoming illegal openid |
49003 | Incoming openid does not belong to this AppID |
2. Cancel tags for users in batches
Interface call request instructions
http request method: POST (please use https protocol) https://api.weixin.qq.com/cgi-bin/tags/members/batchuntagging?access_token=ACCESS_TOKEN POST data format: JSON POST data example: { "openid_list" : [//Fan list "ocYxcuAEy30bX0NXmGn4ypqx3tI0", "ocYxcuBt0mRugKZ7tGAHPnUaOW7Y" ], "tagid" : 134 } |
Return instructions (example of json package returned when normal)
{ "errcode ":0, "errmsg":"ok" } |
Error code description
Error code | Description |
-1 | The system is busy |
40032 | The number of openid lists passed in each time Cannot exceed 50 |
45159 | Illegal tags |
40003 | Incoming illegal openid |
49003 | The incoming openid does not belong to this AppID |
3. Get the tag list on the user
Interface call request description
http request method: POST (please use https protocol) https://api.weixin.qq.com/cgi-bin/tags/getidlist?access_token=ACCESS_TOKEN POST data format: JSON POST data example: { "openid" : "ocYxcuBt0mRugKZ7tGAHPnUaOW7Y" } |
Return description (json example returned under normal circumstances)
{ " tagid_list":[//The set tag list 134, 2 ] } |
Error code description
Error code | Description |
-1 | 系统繁忙 |
40003 | 传入非法的openid |
49003 | 传入的openid不属于此AppID |