How to Read Information via SUST API¶
v1.01. Written by: Zhang Cheng.
This system uses asymmetric encryption for data integration. RSA public and private keys are generated with OpenSSL and used for data encryption and decryption. The integration process is as follows.
1. Obtain the Public Key for Read API¶
Register in the student affairs system. The key is provided by the Information Section of the Student Affairs Department. You need to provide the application name, application URL, and required API names. The application URL is not required during testing, but it is required for production launch.
2. Obtain the Application ID for Read API¶
After application registration is complete, an application number is generated at the same time. This value is used as ClientId.
3. Read API Integration Endpoint¶
The unified read API endpoint is:
Public network:
domain/openapi/api/indexPrivate network:
http://ip/xgb/index.php/openapi/api/index
Request method: GET.
4. Read API Integration Method¶
Request parameters:
Parameter |
Required |
Description |
|---|---|---|
|
Yes |
Application ID |
|
Yes |
Permission and timestamp verification code. See below. |
AuthStr is a global authentication variable. It contains information such as the API name and timestamp verification. Generate it as follows:
Build the string as
ApiName×tamp.Encrypt the string with the public key.
Run
base64_encodeon the encrypted value before transmission.
Example: to access the student list, the API name is StudentList, and the current timestamp is assumed to be 1730189433.
Build the string:
StudentList&1730189433.Encrypt with the public key:
sadsadjsldjljflcvjlcvjlxcvjlxcvjlxcvj.Encode with
base64_encode:fgldjflgjfdlgjdljasdhkjasdhas.Access:
openapi/api/index?ClientId=xxxx&AuthStr=fgldjflgjfdlgjdljasdhkjasdhas&other_parameters
The server verifies permissions and whether the timestamp has expired. If an error occurs, the corresponding error message is displayed.
5. API Endpoints¶
5.1 Student Information List¶
API name: StudentList.
Extended parameters:
Parameter |
Required |
Description |
|---|---|---|
|
No |
Student ID |
|
No |
Name |
|
No |
Page number. Default: page 1. |
|
No |
Page size. Default: 1000 records. |
|
No |
Incremental or changed-data reference date, for example |
Returned parameter descriptions:
Parameter |
Description |
|---|---|
|
Name |
|
Student ID |
|
Class name |
|
Major name |
|
College name |
|
Grade |
|
Ethnicity code |
|
Political status code |
|
Length of schooling |
|
Training level |
|
Student status. |
|
Update time |
5.2 Teacher Information List¶
API name: TeacherList.
Extended parameters:
Parameter |
Required |
Description |
|---|---|---|
|
No |
Staff ID |
|
No |
Name |
|
No |
Page number. Default: page 1. |
|
No |
Page size. Default: 1000 records. |
|
No |
Incremental or changed-data reference date, for example |
Returned parameter descriptions:
Parameter |
Description |
|---|---|
|
Name |
|
Student ID |
|
College name |
|
|
|
Update time |
5.3 Teacher Class Permission Lookup¶
API name: Teacher2Class.
Extended parameters:
Parameter |
Required |
Description |
|---|---|---|
|
No |
Staff ID |
|
No |
Name |
|
No |
Page number. Default: page 1. |
|
No |
Page size. Default: 1000 records. |
|
No |
Incremental or changed-data reference date, for example |
Returned parameter descriptions:
Parameter |
Description |
|---|---|
|
Name |
|
Student ID |
|
College name |
|
|
|
Managed class list |
|
Update time |
5.4 Message Push¶
API name: SendMsg.
Extended parameters:
Parameter |
Required |
Description |
|---|---|---|
|
Yes |
Staff ID or student ID |
|
Yes |
Message content. HTML is supported. |
|
No |
Link URL |
Simple HTML example:
Hello, please click <a href="https://www.sust.edu.cn">here</a> to visit the university website. Thank you!\r\n Thank you for supporting the work of the Information Section of the Student Affairs Department.
\r\n is the newline sequence.
5.5 Leave Information¶
API name: LeaveList.
Extended parameters:
Parameter |
Required |
Description |
|---|---|---|
|
No |
Student ID |
|
No |
Name |
|
No |
Page number. Default: page 1. |
|
No |
Page size. Default: 1000 records. |
|
No |
Incremental or changed-data reference date, for example |
Returned parameter descriptions:
Parameter |
Description |
|---|---|
|
Incremental ID |
|
Name |
|
Student ID |
|
Start time |
|
End time |
|
Leave cancellation time. If present, this field is used as the end time. |
|
Update time |
5.6 Student On-Campus Status¶
API name: StudentStatus.
Extended parameters:
Parameter |
Required |
Description |
|---|---|---|
|
No |
Student ID |
|
No |
Name |
|
No |
Page number. Default: page 1. |
|
No |
Page size. Default: 1000 records. |
|
No |
Incremental or changed-data reference date, for example |
Returned parameter descriptions:
Parameter |
Description |
|---|---|
|
Incremental ID |
|
Name |
|
Student ID |
|
Off-campus start time, dynamically adjusted by administrators |
|
Off-campus end time, dynamically adjusted by administrators |
|
Update time |