Account Binding and Unbinding

Last updated: 2020-10-22 18:45:17

    API Description

    Request method: POST.

    request address/v3/device/account/batchoperate

    The API request address is corresponding to the service access point. Select the request address corresponding to the service access point of your application.

    Feature: this is an async API that is only responsible for task issuance, with real-time operation currently unsupported.

    Parameter Description

    Request parameters

    Parameter Name Type Required Description
    operator_type Integer Yes Operation type. Value range: [1,5] as detailed below:
  • 1: bind token to an account.
  • 2: bind token to an account in an overwriting manner.
  • 3: unbind token from multiple accounts.
  • 4: unbind token from all accounts.
  • 5: unbind account from all tokens.
  • platform String Yes Client platform type
  • Android: Android
  • iOS: iOS
  • account_list Array No The collection of account IDs, which is valid if operator_type is 5, with each element being required, including account and account_type fields.
    For example:
    [{"account":"926@126.com"},{"account":"1527000000"}]
    token_list Array No The collection of device IDs, which is valid if operator_type is 4 and is required
    token_accounts Array No It is valid if operator_type is 1, 2, or 3 and must be called each time. Up to 20 tokens are allowed, and each token_account consists of 1 token and 1 account_list. Below is an example:
    [{"token":"token1","account_list":[{"account":"926@126.com"},{"account":"1527000000"}],
    {"token":"token2","account_list":[{"account":"926@163.com",{"account":"1527000001"}]}]

    Response parameters

    Parameter Name Type Description
    ret_code Integer Return code
    err_msg String Error message
    result Array Operation status code corresponding to each token or account ["0","1008006"]

    Samples

    Sample request

    • Binds token to an account
      {
        "operator_type": 1,
        "platform": "android",
        "token_accounts": [
            {
                "token": "token1",
                "account_list": [
                    {
                        "account": "926@126.com"
                    },
                    {
                        "account": "1527000000"
                    }
                ]
            },
            {
                "token": "token2",
                "account_list": [
                    {
                        "account": "926@163.com"
                    },
                    {
                        "account": "1527000001"
                    }
                ]
            }
        ]
      }
    • Binds token to an account in an overwriting manner
      {
        "operator_type": 2,
        "platform": "android",
        "token_accounts": [
            {
                "token": "token1",
                "account_list": [
                    {
                        "account": "926@126.com"
                    },
                    {
                        "account": "1527000000"
                    }
                ]
            },
            {
                "token": "token2",
                "account_list": [
                    {
                        "account": "926@163.com"
                    },
                    {
                        "account": "1527000001"
                    }
                ]
            }
        ]
      }
    • Unbind token from an account
      {
        "operator_type": 3,
        "platform": "android",
        "token_accounts": [
            {
                "token": "token1",
                "account_list": [
                    {
                        "account": "926@126.com"
                    },
                    {
                        "account": "1527000000"
                    }
                ]
            },
            {
                "token": "token2",
                "account_list": [
                    {
                        "account": "926@163.com"
                    },
                    {
                        "account": "1527000001"
                    }
                ]
            }
        ]
      }
    • Unbinds token from all accounts
      {
        "operator_type": 4,
        "platform": "android",
        "token_list": [
            "token1",
            "token2",
            "token3"
        ]
      }
    • Unbinds account from all tokens
      {
        "operator_type": 5,
        "platform": "android",
        "account_list": [
            {
                "account": "926@126.com"
            },
            {
                "account": "1527000000"
            }
        ]
      }

    Sample return

    Binds token to an account

    {
        "result": [
            "ok",
            "ok"
        ],
        "ret_code": 0,
        "err_msg": "ok"
    }

    Was this page helpful?

    Was this page helpful?

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