Configuring Profiles

Last updated: 2020-03-24 16:02:22

    Feature Description

    This API is used to set standard profile fields and custom profile fields.

    API Calling Description

    Request URL example

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

    Request parameters

    The following table lists only the parameters to be modified when this API is called. For details on other parameters, see RESTful API Overview.

    Parameter Description
    v4/profile/portrait_set Request API
    sdkappid SDKAppID assigned by the IM console when an app is created
    identifier The value must be the app admin account. For details, 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 times per second.

    Request packet example

    {
        "From_Account":"id",
        "ProfileItem":
        [
            {
                "Tag":"Tag_Profile_IM_Nick",
                "Value":"MyNickName"
            }
        ]
    }

    Request packet fields

    Field Type Attribute Description
    From_Account String Required UserID of the user whose profile needs to be set
    ProfileItem Array Required Profile object array of the target user. Each object in the array contains a Tag and a Value.
    Tag String Required Profile field to be set. Profile fields that can be set include:
    1. Standard profile fields. For details, see Standard Profile Fields
    2. Custom profile fields. For details, see Custom Profile Fields.
    Value uint64_t/string/bytes Required Value of the profile field to be set. For details, see Profile Fields.

    Response packet example

    {
        "ActionStatus":"FAIL",
        "ErrorCode":40001,
        "ErrorInfo":"Err_Profile_Comm_Decode_Fail",
        "ErrorDisplay":""
    }

    Response packet fields

    Field Type Description
    ActionStatus String Request processing result. OK: succeeded. FAIL: failed.
    ErrorCode Integer Error code. 0: succeeded. Others: failed.
    ErrorInfo String Detailed error information
    ErrorDisplay String Detailed error information to be displayed on the client

    Error Codes

    Unless a network error (such as error 502) occurs, the HTTP return code for this API is always 200. ErrorCode and ErrorInfo in the response packet represent the actual error code and error information, respectively.
    For common error codes (60000 to 79999), see Error Codes.
    The following table describes the error codes specific to this API.

    Error Code Description
    40001 A request parameter is incorrect. To correct it, check request parameters based on the error description.
    40003 The requested user account does not exist.
    40004 The request requires app admin permissions.
    40005 A profile field contains sensitive words.
    40006 An internal server error occurred. To correct it, try again later.
    40008 You do not have the permission to write profile fields. For details, see Profile Fields.
    40009 The tag of a profile field does not exist.
    40601 The length of the value of a profile field exceeds 500 bytes.
    40605 The value of a standard profile field is incorrect. For details, see Standard Profile Fields.
    40610 The value type of a profile field is incorrect. For details, see Standard Profile Fields.

    API Commissioning Tool

    Use the online commissioning tool for RESTful APIs to commission this API.

    References

    Pulling profiles (v4/profile/portrait_get)

    Was this page helpful?

    Was this page helpful?

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