Open API
This document covers advanced AE features and involves many technical details. It's intended as a reference for users who are experienced with the related features. If you have questions about the content, contact your data consultant for one-on-one assistance.
In addition to its powerful UI for analysis, AE provides a complete set of APIs.
- Model query API: Gets data through the model query API.
- Custom data query API: Gets data through SQL.
- Cohort and tag API: Mainly used to configure cohorts and tags.
- Dimension table API: Mainly used to configure dimension tables.
- Data table API: Mainly used to operate on data tables.
- SQL statement generation API: Mainly used to generate SQL statements.
- Metadata management API: Mainly used to manage metadata.
- Dashboard and report management API: Mainly used to manage dashboard and report data.
- User management API: Mainly used to manage user data.
- Project management API: Mainly used to manage project data.
- Metric query API: Queries the metric list or gets data through the metric query API
How to call
Generate a query key
To use the Open API, first generate a project key. There are two types of project keys, and the commands that generate them must be run in ta-tool
Log in to any AE server, run the su - ta command to switch to the ta user, and then run ta-tool
Generate a root key
ta-tool generate_root_secret
- This key applies to all projects
Generate a key for a single project
ta-tool generate_api_secret -appid TEST-APPID
- The parameter you pass in is the APPID of the project, and the key applies only to that project
- Special case: When you use a single-project key to call the custom data query API, you can query the data of all projects by default. To restrict this, contact ThinkingAI staff
Note: If you run the command to generate a key for the same project or the root key again, a new key is generated and the previous key becomes invalid
API call rules
API call requests are submitted with the HTTP GET or POST method. The call URL is:
Here, $HOST is the address of the private deployment cluster, usually ta1, and only intranet calls are supported by default. $API_PATH is the specific API path, such as open/event-analyze. $API_SECRET is the key.
API call requests are submitted with the GET or POST method. The body of a POST request is in JSON format. For the specific parameter configuration, see the related documents.
The response body is in JSON format, with the following basic structure:
{
"return_code": 0,
"return_message": "success",
"data": {...},
"stackMessage": "",
"showStackMessage": false
}
| Field | Description |
|---|---|
| return_code | Return code. 0 means success, and any other value means failure (see the table below for details) |
| return_message | Return message |
| data | Result data of the call |
| stackMessage | Exception stack on failure |
| showStackMessage | Used by the AE product frontend (can be ignored for OpenAPI calls). Indicates whether to show the copy button for the exception stack |
return_code details
| Return code | Description |
|---|---|
| 0 | Success |
| -1 | Failed |
| -1001 | Not logged in |
| -10012 | Login failed |
| -10013 | Logout failed |
| -1002 | Your account has been locked. Contact your administrator |
| -1003 | Incorrect username or password. Check them and log in again |
| -1004 | Something seems to have gone wrong with the system. Try again later or contact us |
| -1005 | Too many requests. Try again later |
| -1006 | You don't have permission to perform this operation |
| -1007 | SSO login failed |
| -1008 | Invalid parameters |
| -1009 | Username doesn't exist |
| -1010 | Illegal operation |
| -1011 | Data isn't ready yet |
| -1012 | Current query has no data |
| -1013 | Data is being prepared |
| -1014 | Invalid access |
| -1015 | Already exists |
| -1020 | Invalid phone number |
| -1021 | A member is already in this project |
| -1022 | Request canceled |
| -1023 | Target object no longer exists |
| -1099 | Custom event expression is incomplete or invalid |
| -1100 | Exceeded the number of objects that can be created |
| -1999 | Invalid user |
| -2000 | Unregistered user. Settings take effect after registration and activation |
| -2001 | Registered user. Settings take effect at the next login after activation |
| -2002 | The user is already in the project |
| -2003 | The operator's permissions can't be lower than those of the user being operated on |
| -2004 | Missing parameters. Contact your administrator |
| -2005 | You don't have permission for this operation |
| -2006 | Data has already been updated |
| -3000 | License authentication failed |
| -3001 | License verification failed. Contact ThinkingAI customer service |
| -3004 | Invalid project |
| -3005 | MFA verification failed. The MFA code is incorrect or expired |
| -3006 | Your company requires MFA virtual device login verification. Enable MFA |
| -3007 | The current user has already bound an MFA virtual device and can't bind another one |
| -3008 | The current user has enabled MFA virtual device login verification, but the MFA code is missing |
| -3009 | Operation not supported |

