User Attribute APIs

Last updated: 2020-11-04 17:05:53

    API Description

    Request method: POST.

    service address/v3/device/set_custom_attribute

    The API service address corresponds to the service access point one by one; therefore, please select the service address corresponding to your application service access point.

    API feature: this API is used to configured personalized attributes at the token level, including CRUD operations.

    Parameter Description

    Request parameters

    Parameter Name Required Type Description
    cmd Yes Integer Operation type:
  • 1: adds attribute.
  • 2: updates attribute description.
  • 3: deletes attribute.
  • 4: deletes all attributes.
  • 5: queries attribute.
  • accessId Yes Integer Application ID, which can be obtained in the Product Management page in the console.
    token Yes String Device ID of 36 bits.
  • Suggestions on getting TPNS token (Android)
  • Suggestions on getting TPNS token (iOS)
  • attributeInfo Yes if cmd is 1, 2, or 3 Map Attribute details:
  • value is attributeMap in Map type.
  • key is attribute and attribute value. Note: you should have created an attribute in TPNS Console > Toolbox > User Attribute Management; otherwise, this parameter will be filtered out, and invalidAttribute will be returned.
  • Response parameters

    Parameter Name Required Type Description
    retCode Yes Integer Error code. For more information, please see Server-Side Error Codes.
    errMsg Yes String Error message when an error occurs in the request.
    attributeInfo cmd = 5 Map Attribute details.
    invalidAttribute When the attribute is invalid Array Details of invalid attribute.


    Sample request for adding attribute

        "cmd": 1,
        "accessId": 1500004469,
        "token": "04cac74a714f61bf089987a986363d88****",
        "attributeInfo": {
             "attributeMap": {
                "age": "100",
                "name": "Ming",
                "high": "2.66"

    Sample response for adding attribute

        "retCode": 0,
        "errMsg": "success",
        "invalidAttribute": [

    Was this page helpful?

    Was this page helpful?

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