menu
Is this helpful?

# Open API

This document describes the advanced usage functions of TE, involving more technical details, and is a reference for users who are familiar with relevant functions. If you have any questions about this document, please contact your data consultant to obtain one-to-one support.

In addition to a powerful UI analysis interface, TE also provides well-developed APIs.

# Call Method

# Generate Query Key

The project key should be generated first before using Open API. There are two types of project keys. The command used to generate project keys should be executed in ta-tool.

Log in to any TA server to execute the "su - ta" command to switch to ta user to execute ta-tool

Generate Root Key

ta-tool generate_root_secret
  • This key would be applied to all projects

Generate Keys for a Single Project

ta-tool generate_api_secret -appid TEST-APPID
  • The argument passed is the APPID of corresponding project. And the generated key could only be used for the corresponding project.

Note: When the same project or root key has been executed repeatedly, a new key would be generated, while the previous key would become invalid.

# API Call Rules

The API submits the call request using the HTTP GET or POST method, and the URL of the call is:

http://$HOST:8992/$API_PATH?token=$API_SECRET

$HOST refers to Server address, and its value is usually ta2. $API_PATH refers to a specific API route, e.g., open/event-analyze. $API_SECRET is the key.

The API submits the call request using the HTTP GET or POST method. The POST request message body is in JSON format. For detailed parameters configuration, please check relevant documents.

The response message body is in JSON format, and the basic structure is as follows.

{
  "return_code": 0,
  "return_message": "success",
  "data": {...},
  "stackMessage": "",
  "showStackMessage": false
}
Field Description
return_code Return code 0 means success, while others indicate failure (detailed instructions are as shown in the following table)
return_message Return message
data Call result data
stackMessage Abnormal stack upon failure
showStackMessage Used by the front end of the TA product(OpenAPI call could ignore this field); indicating whether the copy button of the abnormal stack should be displayed

return_code return code details

Return code Instructions on return code
0 Executed successfully
-1 Failed to be executed
-1001 Unlogged in
-10012 Failed to log in
-10013 Failed to log out
-1002 Your account has been locked. Please contact the admin to solve the problem
-1003 User name or password errors. Please confirm and log in again
-1004 Something is wrong with the problem. Please try again later or contact us
-1005 Requested too frequently. Please try again later
-1006 You do not have the operation permission
-1007 SSO login failed
-1008 Parameter error
-1009 Username not existed
-1010 Illegal operation
-1011 Data not prepared
-1012 No data currently
-1013 Data being prepared
-1014 Invalid access
-1015 Already exist
-1020 The phone number is wrong
-1021 Members in this project already
-1022 Request canceled
-1023 The target object does not exist
-1099 The self-defined event expression is incomplete or illegal
-1100 Exceed the number of objects that could be created
-1999 Invalid user
-2000 Unregistered user, becoming valid after being registered and activated
-2001 Registered user, becoming valid upon the next login after being activated
-2002 The user is in the project
-2003 The permission of the operator shall not be lower than that of the operated
-2004 Parameter lost, please contact the manager
-2005 You do not have the operation permission
-2006 The data has been updated
-3000 License certification failed
-3001 License certification failed. Please contact the TA customer service to solve the problem
-3004 Invalid project
-3005 MFA verification failed, the wrong or expired MFA verification code
-3006 Current enterprise has enabled mandatory login verification for MFA virtual device. Please bind the device
-3007 Current user has bound the MFA virtual device. The binding process could not be performed repeatedly
-3008 Current user has enabled login verification for MFA virtual device; lack MFA verification code
-3009 The operator is not supported