tencent cloud

Feedback

Pulling Specified Friends

Last updated: 2024-02-07 17:19:05

    Feature Overview

    This API allows you to pull the data and profiles of specified friends. We recommend that you pull no more than 100 friends at a time to avoid response packet failure due to excessive data volume.

    API Calling Description

    Request URL

    https://xxxxxx/v4/sns/friend_get_list?sdkappid=88888888&identifier=admin&usersig=xxx&random=99999999&contenttype=json

    Request parameters

    The following table describes the modified parameters when this API is called. For other parameters, see RESTful API Overview.
    Parameter
    Description
    xxxxxx
    Domain name corresponding to the country/region where your SDKAppID is located.
    China: console.tim.qq.com
    Singapore: adminapisgp.im.qcloud.com
    Seoul: adminapikr.im.qcloud.com
    Frankfurt: adminapiger.im.qcloud.com
    Mumbai: adminapiind.im.qcloud.com
    Silicon Valley: adminapiusa.im.qcloud.com
    Jakarta: adminapiidn.im.qcloud.com
    v4/sns/friend_get_list
    Request API
    sdkappid
    SDKAppID assigned by the Chat console when an app is created
    identifier
    App admin account. For more information, see the App Admin section in Login Authentication.
    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.
    contenttype
    Request format, which should always be json.

    Maximum call frequency

    200 calls per second

    Sample request

    Basic format
    {
    "From_Account":"UserID_1",
    "To_Account":
    [
    "UserID_2"
    ],
    "TagList":
    [
    "Tag_Profile_Custom_Test",
    "Tag_Profile_IM_Image",
    "Tag_Profile_IM_Nick",
    "Tag_SNS_Custom_Test",
    "Tag_SNS_IM_Remark",
    "Tag_SNS_IM_Group"
    ]
    }
    Response to a batch request
    {
    "From_Account":"UserID_1",
    "To_Account":
    [
    "UserID_2",
    "UserID_3",
    "UserID_4"
    ],
    "TagList":
    [
    "Tag_Profile_Custom_Test",
    "Tag_Profile_IM_Image",
    "Tag_Profile_IM_Nick",
    "Tag_SNS_Custom_Test",
    "Tag_SNS_IM_Remark",
    "Tag_SNS_IM_Group"
    ]
    }

    Request fields

    Field
    Type
    Required
    Description
    From_Account
    String
    Yes
    The UserID of the account that requests to pull friend data.
    To_Account
    Array
    Yes
    The list of friend UserIDs.
    We recommend that you pull no more than 100 friends at a time to avoid response packet failure due to excessive data volume.
    TagList
    Array
    Yes
    This specifies the following profile fields and friend fields to be pulled:

    Sample response

    Response to a basic or complete request
    {
    "InfoItem": [
    {
    "To_Account": "UserID_2",
    "SnsProfileItem": [
    {
    "Tag": "Tag_SNS_IM_Remark",
    "Value": "remark_2"
    },
    {
    "Tag": "Tag_SNS_IM_Group",
    "Value": ["group1","group2"]
    },
    {
    "Tag": "Tag_Profile_IM_Nick",
    "Value": "nick_2"
    },
    {
    "Tag": "Tag_SNS_Custom_Test",
    "Value": "custom_sns_2"
    },
    {
    "Tag": "Tag_Profile_Custom_Test",
    "Value": "custom_profile_2"
    }
    ],
    "ResultCode": 0,
    "ResultInfo": ""
    }
    ],
    "ActionStatus": "OK",
    "ErrorCode": 0,
    "ErrorInfo": "",
    "ErrorDisplay": ""
    }
    Pulling specified friends in batches
    {
    "InfoItem": [
    {
    "To_Account": "UserID_2",
    "SnsProfileItem": [
    {
    "Tag": "Tag_SNS_IM_Remark",
    "Value": "remark_2"
    },
    {
    "Tag": "Tag_SNS_IM_Group",
    "Value": ["group1","group2"]
    },
    {
    "Tag": "Tag_Profile_IM_Nick",
    "Value": "nick_2"
    },
    {
    "Tag": "Tag_SNS_Custom_Test",
    "Value": "custom_sns_2"
    },
    {
    "Tag": "Tag_Profile_Custom_Test",
    "Value": "custom_profile_2"
    }
    ],
    "ResultCode": 0,
    "ResultInfo": ""
    },
    {
    "To_Account": "UserID_3",
    "SnsProfileItem": [
    {
    "Tag": "Tag_SNS_IM_Remark",
    "Value": "remark_3"
    },
    {
    "Tag": "Tag_Profile_IM_Nick",
    "Value": "nick_3"
    },
    {
    "Tag": "Tag_Profile_Custom_Test",
    "Value": "custom_profile_3"
    }
    ],
    "ResultCode": 0,
    "ResultInfo": ""
    },
    {
    "To_Account": "UserID_4",
    "ResultCode": 30001,
    "ResultInfo": "Err_SNS_FriendGetList_Friend_Not_Exist"
    }
    ],
    "Fail_Account": [
    "UserID_4"
    ],
    "ActionStatus": "OK",
    "ErrorCode": 0,
    "ErrorInfo": "",
    "ErrorDisplay": ""
    }

    Response fields

    Field
    Type
    Description
    InfoItem
    Array
    Friend object array. Each friend object contains a To_Account field and a SnsProfileItem array.
    To_Account
    String
    UserID of a friend
    SnsProfileItem
    Array
    Array for storing friend data. Each array element contains a Tag field and a Value field.
    Tag
    String
    Field name
    Value
    String/Integer/Array
    Field value
    ResultCode
    Integer
    The result of To_Account. 0: Successful. Other values: Failed. For details on non-zero results, see Error Codes.
    ResultInfo
    String
    The error description of To_Account. This field is empty if the request succeeds.
    Fail_Account
    Array
    List of UserIDs that failed to be verified. This field is only returned when at least one user fails.
    ActionStatus
    String
    Request result. OK: Successful; FAIL: Failed
    ErrorCode
    Integer
    Error code. 0: Successful. Other values: Failed. For details on non-zero results, see Error Codes.
    ErrorInfo
    String
    Detailed error information
    ErrorDisplay
    String
    Detailed information displayed on the client
    

    Error Codes

    The returned HTTP status code for this API is always 200 unless a network error (such as error 502) occurs. The specific error code and details can be found in the response fields ResultCode, ResultInfo, ErrorCode, and ErrorInfo. For public error codes (60000 to 79999), see Error Codes. The following table describes the error codes specific to this API:
    Error Code
    Description
    30001
    Incorrect request parameter. Check your request according to the error description.
    30003
    The requested account does not exist.
    30004
    The request requires app admin permissions.
    30006
    Internal server error. Try again.
    30007
    Network timeout. Try again later.

    API Debugging Tool

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

    References

    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support