Skip to content

2.9. Gateway Configuration Interface

The gateway function interface is used to command the gateway to perform specific functions, with base address /api/config.

2.9.1.1. gateway-info Get Gateway Information

Section titled “2.9.1.1. gateway-info Get Gateway Information”

This interface has no request parameters.

GET /api/config/gateway-info

Response example

{
"hid": "XXXXXX-XXXXXX-XXXXXX-XXXXXX",
"uid": "XXXXXX-XXXXXX-XXXXXX-XXXXXX",
"alias": "iotgw"
}
Response Parameter Type Description
hid String (Required) Gateway hardware ID
uid String (Required) Gateway UID
alias String (Required) Gateway name

2.9.1.2. settings Get Gateway Global Settings

Section titled “2.9.1.2. settings Get Gateway Global Settings”

This interface has no request parameters.

GET /api/config/settings

Response example

{
"version": "1.19.3.102",
"enableLocalCaching": true,
"enableRemoteService": true,
"enableLan2Setup": false,
"timeServerAddress": "ntp1.aliyun.com;ntp2.aliyun.com;ntp3.aliyun.com;ntp4.aliyun.com;"
}
Response Parameter Type Description
version String (Required) Settings version
enableLocalCaching Bool (Required) Enable local caching
enableRemoteService Bool (Required) Enable remote assistance
enableLan2Setup Bool (Required) Enable LAN2 setup
timeServerAddress String (Required) Time server address

2.9.1.3. update-settings Update Gateway Global Settings

Section titled “2.9.1.3. update-settings Update Gateway Global Settings”
POST /api/config/update-settings

Request body example application/json

{
"enableLocalCaching": true,
"enableRemoteService": true,
"enableLan2Setup": false,
"timeServerAddress": "ntp1.aliyun.com;ntp2.aliyun.com;ntp3.aliyun.com;ntp4.aliyun.com;"
}
Request Parameter Type Description
enableLocalCaching Bool Enable local caching
enableRemoteService Bool Enable remote assistance
enableLan2Setup Bool Enable LAN2 setup
timeServerAddress String Time server address

Response example

{
"version": "1.19.3.102",
"enableLocalCaching": true,
"enableRemoteService": true,
"enableLan2Setup": false,
"timeServerAddress": "ntp1.aliyun.com;ntp2.aliyun.com;ntp3.aliyun.com;ntp4.aliyun.com;"
}
Response Parameter Type Description
version String (Required) Settings version
enableLocalCaching Bool (Required) Enable local caching
enableRemoteService Bool (Required) Enable remote assistance
enableLan2Setup Bool (Required) Enable LAN2 setup
timeServerAddress String (Required) Time server address

2.9.1.4. security Get Gateway Global Security Settings

Section titled “2.9.1.4. security Get Gateway Global Security Settings”

This interface has no request parameters.

GET /api/config/security

Response example

{
"enable": true,
"protectedApi": "exact,/cnc/writeOffsetData;exact,/cnc/writePlcData"
}
Response Parameter Type Description
enable Bool (Required) Enable global security control
protectedApi String Protected APIs, i.e. APIs forbidden to all users. Not returned means not set. For the API command format, see API Command Format.
API Command Type exact prefix
Description Specifies a single, exact API address Specifies all API addresses sharing the given prefix
Example exact,/cnc/writePlcData prefix,/db

The API address starts right after /api. prefix,/ represents all API addresses.

Multiple API address commands are separated by ;.

2.9.1.5. update-security Update Global Security Settings

Section titled “2.9.1.5. update-security Update Global Security Settings”
POST /api/config/update-security

Request body example application/json

{
"enable": true,
"protectedApi": "exact,/cnc/writeOffsetData;exact,/cnc/writePlcData"
}
Request Parameter Type Description
enable Bool (Required) Enable global security control
protectedApi String Protected APIs, i.e. APIs forbidden to all users. For the API command format, see API Command Format.

Response example

{
"enable": true,
"protectedApi": "exact,/cnc/writeOffsetData;exact,/cnc/writePlcData"
}
Response Parameter Type Description
enable Bool (Required) Enable global security control
protectedApi String Protected APIs, i.e. APIs forbidden to all users. Not returned means not set. For the API command format, see API Command Format.

2.9.1.6. backup Back Up Gateway Configuration

Section titled “2.9.1.6. backup Back Up Gateway Configuration”

Exports the current gateway configuration file. The returned string is the input of the 2.9.1.7. restore Restore Gateway Configuration interface.

This interface has no request parameters.

GET /api/config/backup

Response example

{
"base64": "XXXXXXXXXXXXXXXXXXXX"
}
Response Parameter Type Description
base64 String (Required) Encrypted gateway configuration file content, Base64 encoded.

When the configuration file cannot be read, GENERAL_CANNOT_ACCESS_CONFIG is returned.

2.9.1.7. restore Restore Gateway Configuration

Section titled “2.9.1.7. restore Restore Gateway Configuration”
POST /api/config/restore

Request body example application/json

{
"base64": "XXXXXXXXXXXXXXXXXXXX"
}
Request Parameter Type Description
base64 String (Required) Backed-up gateway configuration file content, i.e. the content returned by the 2.9.1.6. backup Back Up Gateway Configuration interface.

On success, no content is returned.

Response example

{
"errorCode": 0,
"errorMsg": "Success"
}
Response Parameter Type Description
errorCode Int32 (Required) Error code, 0 indicates success.
errorMsg String (Required) Error message

When the content is empty or cannot be decrypted, GENERAL_API_INVALID_REQUEST is returned; when the configuration file is not accessible, GENERAL_CANNOT_ACCESS_CONFIG is returned.

2.9.1.8. reset Reset Gateway Configuration

Section titled “2.9.1.8. reset Reset Gateway Configuration”

This interface has no request parameters.

GET /api/config/reset

On success, no content is returned.

Response example

{
"errorCode": 0,
"errorMsg": "Success"
}
Response Parameter Type Description
errorCode Int32 (Required) Error code, 0 indicates success.
errorMsg String (Required) Error message