11. Get All Schedules in Account

11. Get All Schedules in Account

Definition

This  GET  API is used to fetch the details of all schedules/ test links in your account (such as schedule name, id, access key, access URL, assessment details along with the proctoring and security settings).
      *PDF documentation reference - Section 4.5 Get all schedules in an Account


Query Parameters

In our REST APIs, Query Parameters have to be URL encoded as the data is being transmitted in the request URL. This is especially important for the  asgn  parameter and any parameters with JSON as they always contain characters that need to be URL encoded. Since  ak  and  ts   parameters don't contain any characters that need to be URL encoded, URL encoding of these parameters can be skipped.

Mandatory parameters


Query Parameter


Description

ak

This is your Public-API-Key, which Mettl uses to identify your account.

ts

This is the current UNIX or Epoch Timestamp (the number of seconds between 1970-01-01 00:00:00 and current UTC Time). Any current generated Timestamp will be valid for 24 hours only.

asgn

This is a unique Signature which has to be generated for each API request.

The Signature is generated by creating a String-to-Sign and hashing it with your Private-API-Key using  the HMAC-SHA256 (for version v2 and v3) or HMAC-SHA1 (for v1) hashing algorithm with Base-64 and URL encoding.

Read more about the above Signature Generation Process in API Authentication and Signature Generation.


 GET  request syntax with mandatory parameters:
https://api.mettl.com/v2/assessments?ak={Public-Api-Key}&ts={Timestamp}&asgn={Signature}      

Optional parameters


Query Parameter


Description

limit

Number of schedules/ test links to fetch from your account.

You can input a value from 1 to 100, with the default value being 20.

offset

Returns the list of schedules/ test links starting from the offset position.

You can input a value from 0 to 1 less than the total number of  schedules/ test links in your account, with the default value being 0.

sort

Property used to sort the list of schedules/ test links.

You can input either createdAt, testTaken or name, with the default value being createdAt.

sort_order

Ascending or Descending order used to sort the list of schedules/ test links.

You can input either asc or desc, with the default value being desc.

filter

This is a JSON string containing details of schedules/ test links to be used as a filter from the list of all schedules/ test links in your account. The format for the JSON is given below.


 GET  request syntax with all parameters:
https://api.mettl.com/v2/assessments?ak={Public-Api-Key}&ts={Timestamp}&asgn={Signature}&limit={Limit}&offset={Offset}&sort={Sort}&sort_order={Sort-Order}&filter={Filter-JSON}

JSON ( filter )

Format of JSON string to be passed in query parameter  filter  can be found in the table below. This JSON describes the details of the Schedules/ Test Links to be filtered.  

PropertySub PropertySub PropertyDescription
visualProctoring

Filters for Advanced Visual Proctoring settings. This value is a nested JSON .
mode
Filters results where Advanced Visual Proctoring is enabled when "PHOTO" is chosen. This value is a string and only accepts "PHOTO" or "OFF".
options
Filters for additional settings of Advanced Visual Proctoring when enabled. This value is a nested JSON .                    

candidateScreenCaptureFilters results where screen-grabs of candidates test screen is enabled when true is chosen. This value is a boolean.

candidateAuthorizationFilters results where manual live authorization process is enabled for starting the test when true is chosen. This value is a boolean.
webProctoring

Filters for Browsing tolerance settings. This value is a nested JSON.
enabled
Filters results where Browsing tolerance is enabled when true is chosen. This value is a boolean and mandatory within webProctoring propertry.
count
Filter for the number of times a test taker is allowed to navigate away from the test window, before the test ends. This value is an integer and should be more than or equal to 0. 
showRemainingCounts
Filters results where showing remaining counts of Browsing tolerance is enabled when true is chosen. This value is a boolean.
type

Filters results for Open access or Private invitation only schedules/ test links. This value is a string and only accepts "OpenForAll" or "ByInvitation".
scheduleType

Filters results for access time settings in schedules/ test links. This value is a string and only accepts "AlwaysOn" or "Fixed".

Sample  filter  JSON with all properties:
{
"visualProctoring": {
"mode": "PHOTO",
"options": {
"candidateScreenCapture": true,
"candidateAuthorization": true
}
},
"webProctoring": {
"enabled": true,
"count": 10,
"showRemainingCounts": true
},
"type": "ByInvitation",
"scheduleType": "Fixed",
}

Examples

1) Request with only mandatory query parameters
Request without Signature
a.  GET  request URL, with queries  ak  and  ts  but without  asgn  (Signature)
https://api.mettl.com/v2/schedules?ak=ab12c345-6789-0123-456d-78e9f0123456&ts=1635976200

b. Creating a String-to-Sign, calculated with Method + Endpoint + Values of query parametersin new lines and in ascending order of the parameter name (i.e., the new line characters "\n" followed by values of  ak  and  ts  in order, for this example)
String-to-Sign = "GET" +  "https://api.mettl.com/v2/schedules"  + "\n" + "ab12c345-6789-0123-456d-78e9f0123456"  + "\n" + "1635976200"
c. Output of the Sting-to-Sign created above
ab12c345-6789-0123-456d-78e9f0123456
1635976200
d. Private-API-Key to sign/hash the above Sting-to-Sign using HMAC-SHA256 (since API version is v2)
zy98x765-4321-0987-654w-32v1u0987654
e. Output of the generated Signature for  asgn  using the Sting-to-Sign and your Private-API-Key, hashed with HMAC-SHA256 (Base-64 and URL Encoded)
7Q195BVtDVr6wDQGMAV0x50fftuu99HPo5CSPSHNLAY%3D
Read more about the above Signature Generation Process in API Authentication and Signature Generation

Request with Signature
f. Final  GET  request URL with queries  ak  ,  ts  and  asgn  (URL Encoded)
https://api.mettl.com/v2/schedules?ak=ab12c345-6789-0123-456d-78e9f0123456&ts=1635976200&asgn=7Q195BVtDVr6wDQGMAV0x50fftuu99HPo5CSPSHNLAY%3D

2) Request with all query parameters
Request without Signature
a. GET request URL, with queries  ak   ts  ,  limit  ,  offset  ,  sort  ,  sort_order  and  filter  but without  asgn  (Signature)
https://api.mettl.com/v2/schedules?ak=ab12c345-6789-0123-456d-78e9f0123456&ts=1635976200&limit=10&offset=20&sort=name&sort_order=asc&filter=%7B%22webProctoring%22%3A%7B%22enabled%22%3Atrue%7D%7D

b. Creating a String-to-Sign, calculated with Method + Endpoint + Values of query parametersin new lines and in ascending order of the parameter name (i.e., the new line characters "\n" followed by values of  ak  ,  filter  ,  limit  ,  offset  ,  sort  ,  sort_order  and  ts  in order, for this example)
String-to-Sign = "GET" +  "https://api.mettl.com/v2/schedules"  + "\n" + "ab12c345-6789-0123-456d-78e9f0123456"  + "\n" + "{"webProctoring":{"enabled":true}}" + "\n" + "10" + "\n" + "20" + "\n" + "name" + "\n" + "asc" + "\n" + "1635976200"
c. Output of the Sting-to-Sign created above
ab12c345-6789-0123-456d-78e9f0123456
{"webProctoring":{"enabled":true}}
10
20
name
asc
1635976200
d. Private-API-Key to sign/hash the above Sting-to-Sign using HMAC-SHA256 (since API version is v2)
zy98x765-4321-0987-654w-32v1u0987654
e. Output of the generated Signature for  asgn  using the Sting-to-Sign and your Private-API-Key, hashed with HMAC-SHA256 (Base-64 and URL Encoded)
B9V7AL%2FSUGWYyKBtY%2FSMwkhx2%2F%2FjvIvWkIVlOxCXHV8%3D
Read more about the above Signature Generation Process in API Authentication and Signature Generation

Request with Signature
f. Final  GET  request URL with queries  ak  ,  ts   limit  ,  offset  ,  sort  ,  sort_order  ,  filter  and  asgn  (URL Encoded)
https://api.mettl.com/v2/schedules?ak=ab12c345-6789-0123-456d-78e9f0123456&ts=1635976200&limit=10&offset=20&sort=name&sort_order=asc&filter=%7B%22webProctoring%22%3A%7B%22enabled%22%3Atrue%7D%7D&asgn=B9V7AL%2FSUGWYyKBtY%2FSMwkhx2%2F%2FjvIvWkIVlOxCXHV8%3D

Response

Upon making a successful request, if there are no errors, you will receive a JSON in the given format
{
"status": "SUCCESS",
"schedules": [
{
"id": 7387795,
"name": "Test Link 1",
"accessKey": "0x0x0x0x0x",
"status": "ACTIVE",
"createdAt": "Tue, 08 Feb 2022 11:13:55 GMT",
"imageProctoring": false,
"webProctoring": {
"enabled": false
},
"scheduleType": "AlwaysOn",
"scheduleWindow": null,
"access": {
"type": "OpenForAll",
"candidates": null,
"sendEmail": null,
"sendReminders": null,
"isCandidateCrfPrefilled": false
},
"ipAccessRestriction": {
"enabled": false
},
"sourceApp": "Mettl",
"testStartNotificationUrl": null,
"testFinishNotificationUrl": null,
"testGradedNotificationUrl": null,
"testResumeEnabledForExpiredTestURL": null,
"isCandidateAuthProctored": false,
"testGradeNotification": {
"enabled": false,
"recipients": null
},
"visualProctoring": {
"options": {
"candidateScreenCapture": false,
"candidateAuthorization": false,
"audioOptional": true,
"isAudioProctoring": false
},
"mode": "OFF"
},
"allowTestResume": "UnSuperVised",
"secureBrowser": {
"enabled": false
},
"assessmentDetails": {
"id": 999999,
"duration": 5,
"name": "Assessment Name",
"instructions": "",
"createdAt": "Tue, 08 Feb 2022 11:13:55 GMT"
},
"protected": "NotEnabled"
},
{
"id": 7385005,
"name": "Test Link 2",
"accessKey": "x0x0x0x0x0",
"status": "ACTIVE",
"createdAt": "Tue, 08 Feb 2022 07:19:47 GMT",
"imageProctoring": true,
"webProctoring": {
"enabled": true,
"count": 10,
"showRemainingCounts": true
},
"scheduleType": "Fixed",
"scheduleWindow": {
"fixedAccessOption": "ExactTime",
"startsOnDate": "Tue, 08 Feb 2022",
"endsOnDate": "Wed, 09 Feb 2022",
"startsOnTime": "12:49:00",
"endsOnTime": "12:49:00",
"timeZone": "UTC+05:30",
"locationTimeZone": "Asia/Kolkata"
},
"access": {
"type": "ByInvitation",
"candidates": [
{
"name": "sample",
"submissionDate": null,
"email": "sample@email.com"
}
],
"sendEmail": false,
"sendReminders": false,
"isCandidateCrfPrefilled": false
},
"ipAccessRestriction": {
"enabled": false
},
"sourceApp": "Mettl",
"testStartNotificationUrl": null,
"testFinishNotificationUrl": null,
"testGradedNotificationUrl": null,
"testResumeEnabledForExpiredTestURL": null,
"isCandidateAuthProctored": true,
"testGradeNotification": {
"enabled": false,
"recipients": null
},
"visualProctoring": {
"options": {
"candidateScreenCapture": true,
"candidateAuthorization": true,
"audioOptional": true,
"isAudioProctoring": false
},
"mode": "PHOTO"
},
"allowTestResume": "UnSuperVised",
"secureBrowser": {
"enabled": true
},
"assessmentDetails": {
"id": 999999,
"duration": 5,
"name": "Assessment Name",
"instructions": "",
"createdAt": "Tue, 08 Feb 2022 07:19:47 GMT"
},
"protected": "NotEnabled"
}
]
}