# Enterprise Edition OpenAPI
# Login Interface
| Interface Address | Request Method | Content-Type |
|---|---|---|
| /user/login | POST | application/x-www-form-urlencoded |
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| username | string | Yes | Username |
| password | string | Yes | Password |
- Accessing the login interface can obtain a token
- All OpenAPIs (except the login interface) require authentication
- Authentication method is to carry the Authorization field in the request header, whose value is the token
# Create Data Source
| Interface Address | Request Method | Content-Type |
|---|---|---|
| /datasource/add | POST | application/json |
- Parameter Example
{
"note": "local",
"name": "local-mysql",
"detail": {
"type": "mysql",
"url": "jdbc:mysql://localhost:3306/test?useSSL=false&characterEncoding=UTF-8&serverTimezone=GMT%2B8",
"username": "root",
"password": "root",
"edit_password": true,
"driver": "com.mysql.cj.jdbc.Driver",
"druidProperties": "druid.testWhileIdle=true\ndruid.breakAfterAcquireFailure=true\ndruid.connectionErrorRetryAttempts=3",
"tableSql": "show tables"
},
"type": "jdbc"
}
# Delete Data Source
| Interface Address | Request Method | Content-Type |
|---|---|---|
| /datasource/delete/{id} | POST | application/x-www-form-urlencoded |
# Create Group
| Interface Address | Request Method | Content-Type |
|---|---|---|
| /group/create | POST | application/x-www-form-urlencoded |
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| name | string | Yes | Group Name |
# Delete Group
| Interface Address | Request Method | Content-Type |
|---|---|---|
| /group/delete/{id} | POST | application/x-www-form-urlencoded |
# Create API
| Interface Address | Request Method | Content-Type |
|---|---|---|
| /apiConfig/add | POST | application/json |
- Parameter Example
{
"note": "Query student data",
"cachePlugin": {
"pluginType": 1
},
"access": 1,
"paramsJson": [
{
"name": "id",
"type": "bigint",
"note": "Student ID"
}
],
"taskJson": [
{
"taskType": 1,
"sqlList": [
{
"sqlText": "select * from student where id = #{id}"
}
],
"transaction": 0,
"datasourceId": "5iaIut1Z"
}
],
"paramRules": [
{
"apiId": "J3z0SP59",
"script": "id > 0",
"type": "JavaScript",
"message": "ID must be a positive number"
}
],
"groupId": "leqbGt5S",
"globalTransformPlugin": {
"pluginType": 3
},
"path": "student/all",
"name": "Query Data",
"alarmPlugins": [
{
"pluginType": 2
}
],
"transformScript": {
"type": "JavaScript"
},
"contentType": "application/x-www-form-urlencoded",
"jsonParam": "{}"
}
# Update API
| Interface Address | Request Method | Content-Type |
|---|---|---|
| /apiConfig/update | POST | application/json |
- Parameter Example
{
"note": "Query student data",
"cachePlugin": {
"pluginType": 1,
"apiId": "J3z0SP59"
},
"access": 1,
"paramsJson": [
{
"note": "Student ID",
"name": "id",
"type": "bigint"
}
],
"taskJson": [
{
"taskType": 1,
"sqlList": [
{
"sqlText": "select * from student where id = #{id}"
}
],
"transaction": 0,
"datasourceId": "5iaIut1Z"
}
],
"paramRules": [
{
"id": 1,
"apiId": "J3z0SP59",
"script": "id > 0",
"type": "JavaScript",
"message": "ID must be a positive number"
}
],
"groupId": "leqbGt5S",
"globalTransformPlugin": {
"pluginType": 3,
"apiId": "J3z0SP59"
},
"path": "student/all",
"name": "Query Data",
"alarmPlugins": [
{
"pluginType": 2,
"apiId": "J3z0SP59"
}
],
"transformScript": {
"apiId": "J3z0SP59",
"type": "JavaScript"
},
"id": "J3z0SP59",
"contentType": "application/x-www-form-urlencoded"
}
# Publish API
| Interface Address | Request Method | Content-Type |
|---|---|---|
| /apiConfig/online/{id} | POST | application/x-www-form-urlencoded |
# Unpublish API
| Interface Address | Request Method | Content-Type |
|---|---|---|
| /apiConfig/offline/{id} | POST | application/x-www-form-urlencoded |