Querying the Identity of a User in a Group

Last updated: 2020-07-06 16:40:44

    Feature Description

    This API is used by the app admin to batch obtain the roles of users in a group.

    API Calling Description

    Applicable group types

    Group Type ID Is this RESTful API Supported?
    Private Yes. Same as Work (work group for friends) in the new version.
    Public Yes.
    ChatRoom Yes. Same as Meeting (temporary meeting group) in the new version.
    AVChatRoom No.

    These are the 4 built-in group types in IM. For detailed information, see the Group System.

    AVChatRooms (livestreaming groups) do not support this API and a 10007 error will be returned if this operation is performed on this type of group. To achieve the same result, you can call the API for obtaining profiles of group members.

    Sample request URL

    https://console.tim.qq.com/v4/group_open_http_svc/get_role_in_group?sdkappid=88888888&identifier=admin&usersig=xxx&random=99999999&contenttype=json

    Request parameters

    The list below contains only the parameters commonly used when calling this API and their descriptions. For more parameters, see RESTful API Overview.

    Parameter Description
    v4/group_open_http_svc/get_role_in_group Request API
    sdkappid SDKAppID assigned by the IM console when the application is created
    identifier The value must be the app admin account. For more information, see App Admins.
    usersig Signature generated by the app admin account. For details, see Generating UserSig.
    random A random 32-bit unsigned integer ranging from 0 to 4294967295

    Maximum calling frequency

    The maximum calling frequency is 200 calls per second.

    Sample request packet

    This request packet is used to obtain the list of groups a user has joined. The group information includes the group ID and the IDs of group members whose roles are to be queried.

    {
        "GroupId": "@TGS#2C5SZEAEF",
        "User_Account": [ // Up to 500 accounts are supported.
            "leckie",
            "peter",
            "wesley"
        ]
    }

    Request packet fields

    Field Type Property Description
    GroupId String Required ID of the group to be queried
    User_Account Array Required User accounts to be queried. Up to 500 accounts are supported.

    Sample response packet body

    {
        "ActionStatus": "OK",
        "ErrorInfo": "",
        "ErrorCode": 0,
        "UserIdList": [ // Result
            {
                "Member_Account": "leckie",
                "Role": "Owner" // Member role: Owner/Admin/Member/NotMember
            },
            {
                "Member_Account": "peter",
                "Role": "Member"
            },
            {
                "Member_Account": "wesley",
                "Role": "NotMember"
            }
        ]
    }

    Response packet fields

    Field Type Description
    ActionStatus String Result of the request. OK indicates that the request was successful, and FAIL indicates that the request failed.
    ErrorCode Integer Error code. 0 indicates that the request was successful, and any non-zero value indicates that the request failed.
    ErrorInfo String Detailed error information
    UserIdList Array Member roles that are pulled, including Owner, Admin, Member, and NotMember

    Error Codes

    Unless a network error (such as error 502) occurs, the returned HTTP status code for this API is always 200. The specific error code and details can be found in the response packet fields such as ErrorCode and ErrorInfo.
    For public error codes (60000 to 79999), see Error Codes.
    The list below contains error codes specific to this API:

    Error Code Description
    10002 An internal server error occurred. Please try again.
    10003 The request command word is invalid.
    10004 A parameter is invalid. Check the error description and troubleshoot the issue.
    10007 The operator does not have sufficient permissions for this operation. The operator must have the necessary role in the group to perform this operation.
    10010 The group does not exist, or once existed but has been disbanded.
    10015 Failed to parse the JSON packet. Check whether the request packet meets JSON specifications.

    API Debugging Tool

    Use the online debugging tool for RESTful APIs to debug this API.

    Reference

    Obtaining the groups a user has joined (v4/group_open_http_svc/get_joined_group_list)

    Was this page helpful?

    Was this page helpful?

    • Not at all
    • Not very helpful
    • Somewhat helpful
    • Very helpful
    • Extremely helpful
    Send Feedback
    Help