Create Unit
Note:
- When creating a unit, duplicate names are not allowed. If there is already a unit with the same name under the course, regardless of whether it is in draft status, an error will be reported as
Unit already exists
.
URL
https://root_url/lms/unit/create
HTTP Request Methods
Request Data
Key |
Required |
Type |
Description |
X-EEO-SIGN |
Yes |
string |
Signature; see the rules here |
X-EEO-UID |
Yes |
string |
Institution's SID |
X-EEO-TS |
Yes |
string |
Timestamp |
Body Parameters
key |
Required |
Type |
Description |
Rules Description |
courseId |
Yes |
integer |
Class (Course) ID |
|
name |
Yes |
String |
Unit name |
Length must not exceed 50 characters. Note: Duplicate unit names are not allowed under the course. |
publishFlag |
Yes |
integer |
Publish status |
0 = Draft, 2 = Published (Visible to class members) |
content |
No |
String |
Unit introduction |
Defaults to empty if not provided |
Response Data
Parameter Name |
Type |
Example Value |
Description |
code |
integer |
1 |
Error code |
msg |
string |
"Execution successful" |
Error message |
data |
array |
[] |
Reponse array |
└ |
object |
|
Reponse object |
└ name |
integer |
Create Unit |
Unit name |
└ unitId |
integer |
26019953 |
Unit ID |
Example
POST /lms/unit/create HTTP/1.1
root_url
37471286c6cfb95c4afb899396b884e2
409864
1722937773
application/json
165
{
"courseId": 414193,
"name": "Create Unit",
"content": "Unit Description",
"publishFlag": 2
}
- Shell cURL analog request instruction
curl -X POST \
-H 'Host: root_url' \
-H 'X-EEO-SIGN: 37471286c6cfb95c4afb899396b884e2' \
-H 'X-EEO-UID: 409864' \
-H 'X-EEO-TS: 1722937773' \
-H 'Content-Type: application/json' \
-d '{"courseId": 414193, "name": "Create Unit", "content": "Unit Description", "publishFlag": 2}' \
'https://root_url/lms/unit/create'
Response sample(The normal return json packet example)
{
"code": 1,
"msg": "Execution successful",
"data": {
"name": "Create Unit",
"unitId": 26020895
}
}
Error Code Descriptions
Error Code |
Description |
147 |
No information for this class |
29200 |
Unit creation failed |
29208 |
Unit already exists |
29213 |
Unit created successfully |
40031 |
Exceeded the maximum number of units allowed in the class. |
21601030 |
Missing required parameters |
101001001 |
Parameter error |
101002005 |
Signature exception |
101002006 |
Timestamp expired |
101002008 |
Timestamp does not exist |
121601020 |
Business parameter error |
121601021 |
This class does not belong to the your Institution |
121601022 |
This is not a standard class |
121601023 |
This class has been dissolved and cannot be operated |