目录
此内容是否有帮助?

# Open API

The content described in this document belongs to the advanced use functions of TA, involving more technical details, and is suitable for users with experience in related functions. If you have doubts about the content of the doc, please consult your data consultant for one-on-one assistance.

In addition to the powerful UI analysis interface, TA also provides a complete API.

# Call Method

# Generate Query Key

If you need to use the Open API, you first need to generate a project key. There are two types of project keys, and the command to generate the key needs to be executed in ta-tool

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

Generate **R**oot **K**ey

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

Generate **K**eys for a **S**ingle **P**roject

ta-tool generate_api_secret -appid TEST-APPID
  • The parameter passed in is the corresponding project APPID, and the key can only be applied to this project

Note: When repeated execution generates the same project or root key, a new key will be generated, and the previous key will be invalidated**.**

# 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

Where $HOST is the privatized cluster address, usually ta2. $API_PATH represents a specific API path, such as open/event-analyze. $API_SECRET is the key.

The API submits the call request with the GET method or POST method. The POST request message body is in JSON format, please refer to the relevant doc for specific parameter configuration.

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 indicates success, others indicate failure (see the table below for details)
return_message
Return message
data
Call result data
stackMessage
Exception stack on failure
showStackMessage
TA product front-end use (OpenAPI calls can ignore this field), indicating whether the copy button of the exception stack should be displayed

return_code return code details

Return code
Return code description
0
Successful execution
-1
Execution failed
-1001
Not logged in
-10012
Login failed
-10013
Logout failed
-1002
Your account has been locked, please contact the administrator to solve
-1003
Incorrect username or password, please confirm and log in again
-1004
There seems to be some problems with the system, please try again later or contact us
-1005
The request frequency is too fast, please try again later
-1006
You do not have permission to operate
-1007
SSO login failed
-1008
Parameter error
-1009
User name does not exist
-1010
Illegal operation
-1011
The data is not yet ready
-1012
No data for current query
-1013
Data is being prepared
-1014
Invalid access
-1015
Already exists
-1020
Wrong phone number
-1021
Some members are already in this project
-1022
Request cancelled
-1023
Target object no longer exists
-1099
Incomplete or invalid custom event expression
-1100
Exceeding the number of objects that can be created
-1999
Invalid user
-2000
For unregistered users, the settings will take effect after registration is activated
-2001
Registered user, the next login setting takes effect after activation
-2002
The user is already in the project
-2003
The operator's authority cannot be lower than the operator's authority
-2004
Parameter missing, please contact administrator
-2005
You do not have the operation permission
-2006
The data has been updated
-3000
License authentication failed
-3001
License verification failed, please contact TA customer service personnel to solve
-3004
Invalid item
-3005
MFA verification failed, error or expired MFA verification code
-3006
The current enterprise has started mandatory MFA virtual device login verification, please bind
-3007
The current user has bound the MFA virtual device and cannot repeat the binding
-3008
The current user has opened the MFA virtual device login verification, missing the MFA verification code
-3009
Operation not supported