Edit Post Learning Activity - Online Test
This API is used to edit online test that is part of the course learning activities in LMS
Request URL:
https://people.zoho.com/api/v1/courses/<courseId>/settings/postcourseactivities/onlineTests/<testId>?onlineTestData ={"name" : <name> , "duration" : <duration>, "durationFor" : <durationFor>, "description" : "<description>","questionsPerPage" : <questionsPerPage>, "isMandatory" : <isMandatory> , "shuffleQuestions" : <shuffleQuestions>, "showMarksToLearner" : <showMarksToLearner>, "gradeCategoryId" : <gradeCategoryId>}
Header:
Authorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxx9be93.9b8xxxxxxf
Scope:
ZOHOPEOPLE.training.ALL
OR
ZOHOPEOPLE.training.UPDATE
Possible Operation Types:
ALL - Complete access to data
UPDATE - Only to update data
Method:
PATCH
Request Parameters
Parameters | Values Allowed | Default Value | Description |
*onlineTestData | <parameters in JSON Object> | JSON Input |
Parameters | Values Allowed | Default Value | Description |
name | <Online test name> | <Mandatory> | Specify the online test name |
durationFor | <none|test|question> | <Mandatory> | Specify the duration |
duration | <Duration in minutes> | <Mandatory if duration is not none> | Specify the duration |
maximumAttemptsAllowed | 1-10|unlimited | <Mandatory> | Specify the maximum allowed attempts value |
questionPerPage | all|one | <Mandatory> | Specify the questions per page |
passPercentage | 1-100 | - | Specify the pass percentage |
shuffleQuestions | true|false | - | Specify the shuffle questions |
showMarksToLearner | true|false | - | Specify if marks must be showed to learners at the end of the test |
description | <Description> | - | Specify the description |
isMandatory | true|false | true | Specify if the test is mandatory or not |
lockUntil | <lockUntil date in DD-MM-YYYY format> | - | Specify the lockUntil date |
gradeCategoryId | <Grade category id> | - | Specify the Grade category id |
resources | <files> | - | Specify resources |
*mandatory parameters
Error Codes and Descriptions
Status Codes | Description |
---|---|
400 | Invalid parameter value/input parameter missing |
403 | Sorry! You are not authorized to do this operation |
404 | Not found |
422 | Maximum limit exceeded |
500 | Sorry! Server error occured |
View complete list of LMS API error codes
Threshold Limit: 30 requests | Lock period: 5 minutes
Threshold Limit - Number of API calls allowed within a minute.
Lock Period - Wait time before consecutive API requests.
Request
Copiedimport okhttp3.*;
public class Main {
public static void main(String[] args) throws Exception {
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://people.zoho.com/api/v1/courses/478346000019328001/settings/postcourseactivities/onlineTests/478346000019579015?onlineTestData=%7B%22name%22%20%3A%20%22updateOnline%20test%20API%20testing%22%2C%20%22duration%22%20%3A%2035%2C%20%22durationFor%22%20%3A%20%22test%22%2C%20%22description%22%20%3A%20%22API%20Testing%22%2C%20%22lockUntil%22%20%3A%20%2204-01-2022%22%2C%20%22maximumAttemptsAllowed%22%20%3A%20%222%22%2C%22questionsPerPage%22%20%3A%20%22all%22%2C%20%22isMandatory%22%20%3A%20true%2C%20%22passPercentage%22%20%3A%2080%2C%20%22shuffleQuestions%22%20%3A%20true%2C%20%22showMarksToLearner%22%20%3A%20true%2C%20%22gradeCategoryId%22%20%3A%20478346000019558215%7D&durationFor=test&maximumAttemptsAllowed=3&questionsPerPage=all")
.patch(RequestBody.create("", null))
.build();
Response response = client.newCall(request).execute();
System.out.println(response.body().string());
}
}
Copiedfetch("https://people.zoho.com/api/v1/courses/478346000019328001/settings/postcourseactivities/onlineTests/478346000019579015?onlineTestData=%7B%22name%22%20%3A%20%22updateOnline%20test%20API%20testing%22%2C%20%22duration%22%20%3A%2035%2C%20%22durationFor%22%20%3A%20%22test%22%2C%20%22description%22%20%3A%20%22API%20Testing%22%2C%20%22lockUntil%22%20%3A%20%2204-01-2022%22%2C%20%22maximumAttemptsAllowed%22%20%3A%20%222%22%2C%22questionsPerPage%22%20%3A%20%22all%22%2C%20%22isMandatory%22%20%3A%20true%2C%20%22passPercentage%22%20%3A%2080%2C%20%22shuffleQuestions%22%20%3A%20true%2C%20%22showMarksToLearner%22%20%3A%20true%2C%20%22gradeCategoryId%22%20%3A%20478346000019558215%7D&durationFor=test&maximumAttemptsAllowed=3&questionsPerPage=all", {
method: "PATCH"
})
.then(response => response.text())
.then(data => console.log(data))
.catch(error => console.error("Error:", error));
Copied curl --location --request PATCH 'https://people.zoho.com/api/v1/courses/478346000019328001/settings/postcourseactivities/onlineTests/478346000019579015?onlineTestData=%7B%22name%22%20%3A%20%22updateOnline%20test%20API%20testing%22%2C%20%22duration%22%20%3A%2035%2C%20%22durationFor%22%20%3A%20%22test%22%2C%20%22description%22%20%3A%20%22API%20Testing%22%2C%20%22lockUntil%22%20%3A%20%2204-01-2022%22%2C%20%22maximumAttemptsAllowed%22%20%3A%20%222%22%2C%22questionsPerPage%22%20%3A%20%22all%22%2C%20%22isMandatory%22%20%3A%20true%2C%20%22passPercentage%22%20%3A%2080%2C%20%22shuffleQuestions%22%20%3A%20true%2C%20%22showMarksToLearner%22%20%3A%20true%2C%20%22gradeCategoryId%22%20%3A%20478346000019558215%7D&durationFor=test&maximumAttemptsAllowed=3&questionsPerPage=all'
Copiedtry
{
response = invokeUrl
[
url: "https://people.zoho.com/api/v1/courses/478346000019328001/settings/postcourseactivities/onlineTests/478346000019579015?onlineTestData=%7B%22name%22%20%3A%20%22updateOnline%20test%20API%20testing%22%2C%20%22duration%22%20%3A%2035%2C%20%22durationFor%22%20%3A%20%22test%22%2C%20%22description%22%20%3A%20%22API%20Testing%22%2C%20%22lockUntil%22%20%3A%20%2204-01-2022%22%2C%20%22maximumAttemptsAllowed%22%20%3A%20%222%22%2C%22questionsPerPage%22%20%3A%20%22all%22%2C%20%22isMandatory%22%20%3A%20true%2C%20%22passPercentage%22%20%3A%2080%2C%20%22shuffleQuestions%22%20%3A%20true%2C%20%22showMarksToLearner%22%20%3A%20true%2C%20%22gradeCategoryId%22%20%3A%20478346000019558215%7D&durationFor=test&maximumAttemptsAllowed=3&questionsPerPage=all"
type: PATCH
];
}
catch(e)
{
info "Exception while making the API request.";
}
Copiedimport requests
url = "https://people.zoho.com/api/v1/courses/478346000019328001/settings/postcourseactivities/onlineTests/478346000019579015?onlineTestData=%7B%22name%22%20%3A%20%22updateOnline%20test%20API%20testing%22%2C%20%22duration%22%20%3A%2035%2C%20%22durationFor%22%20%3A%20%22test%22%2C%20%22description%22%20%3A%20%22API%20Testing%22%2C%20%22lockUntil%22%20%3A%20%2204-01-2022%22%2C%20%22maximumAttemptsAllowed%22%20%3A%20%222%22%2C%22questionsPerPage%22%20%3A%20%22all%22%2C%20%22isMandatory%22%20%3A%20true%2C%20%22passPercentage%22%20%3A%2080%2C%20%22shuffleQuestions%22%20%3A%20true%2C%20%22showMarksToLearner%22%20%3A%20true%2C%20%22gradeCategoryId%22%20%3A%20478346000019558215%7D&durationFor=test&maximumAttemptsAllowed=3&questionsPerPage=all"
response = requests.patch(url)
print(response.text)
Header
CopiedAuthorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxx9be93.9b8xxxxxxf
Respomse
Copied{
"code": "200",
"message": "success",
"onlineTest": {
"previewURL": "https://people.zoho.com/peoplelms/assessments/219225000000671069/preview",
"showMarksToLearner": "Yes",
"totalLearnersCount": 0,
"resources": [],
"canUserDelete": true,
"duration": "35 minutes",
"isMandatoryTest": false,
"lockUntil": "",
"gradeCategoryName": "",
"completedLearnersCount": 0,
"isLocked": false,
"maximumAttemptsAllowed": 1,
"testId": "219225000000671061",
"canUserEdit": true,
"moduleId": 0,
"testMark": "1.0",
"testName": "Online test One_Update",
"status": "Not ready"
}
}