User tag management


User tag management

1474939241277079.jpg

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

Parameter description

http request method: POST (please use https protocol)

https://api.weixin.qq.com/cgi-bin/tags/create?access_token=ACCESS_TOKEN

POST data format: JSON

POST data example:

{

"tag" : {

"name" : "Guangdong"//Tag name

}

}

ParameterDescription
access_tokenCall interface credentials
nameTag name (within 30 characters)

Return description (example of json data packet returned when normal)

##{

Return parameter description

"tag":{

"id":134,//Tag id

"name":"Guangdong"

}

}

ParameterDescription
idTag id, assigned by WeChat
nameTag name, UTF8 encoding

Error code description

##45157The tag name is illegal, please be careful not to duplicate it with other tags Name45158The tag name length exceeds 30 bytes45056Created tag Too many, please note that it cannot exceed 100

2. Get the tags created by the official account

Interface call request description

Error codeDescription
-1The system is busy

Return instructions

##http request method: GET (please use https protocol)

https://api.weixin.qq.com/cgi-bin/tags/get?access_token=ACCESS_TOKEN

3. Edit tag

Interface call request description

##{

"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

##45157The tag name is illegal, please be careful not to duplicate it with other tags Name45158The tag name length exceeds 30 bytes45058Cannot 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

Error codeDescription
-1The system is busy
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

Error code description

##{

"errcode":0,

"errmsg ":"ok"

}

Error codeDescription
-1The system is busy
45058Cannot modify the three systems 0/1/2 Tags retained by default
45057The 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

Return description (example of json package returned when normal)

## http request method: GET (please use https protocol)

https://api.weixin.qq.com/cgi-bin/user/tag/get?access_token=ACCESS_TOKEN

POST data Format: JSON

POST 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 codeDescription
-1The system is busy
40003Incoming illegal openid
45159Illegal 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 codeDescription
-1The system is busy
40032The number of openid lists passed in each time Cannot exceed 50
45159Illegal tags
45059Tags on fans The number has exceeded the limit
40003Incoming illegal openid
49003Incoming 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 codeDescription
-1The system is busy
40032The number of openid lists passed in each time Cannot exceed 50
45159Illegal tags
40003Incoming illegal openid
49003The 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 codeDescription
-1系统繁忙
40003传入非法的openid
49003传入的openid不属于此AppID