12. Get Schedule

12. Get Schedule

Definition

This  GET  API is used to fetch the details of a particular schedule/ test link 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.6 Get details of a particular schedule in an account

Endpoints

  1. https://api.mettl.com/v2/schedules/{access-key}
  2. https://api.mettl.com/v1/schedules/{access-key}
where, access-key is the unique key of schedule/ test link you want to fetch the details of.

You can get an access-key from the test link settings in your dashboard (alphanumeric key at the end of the 'Link to Share') or via API by using Create Schedule API , Get All Schedules in Assessment API or Get All Schedules in Account API.

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}      

Example

Request without Signature
a.  GET  request URL, with queries  ak  and  ts  but without  asgn  (Signature)
https://api.mettl.com/v2/schedules/0x0x0x0x0x?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/0x0x0x0x0x"  + "\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)
mKc4j8sgE0%2B97AnyL07vnJ%2Felk1n%2BvA%2B9ru4aCxvJqw%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/0x0x0x0x0x?ak=ab12c345-6789-0123-456d-78e9f0123456&ts=1635976200&asgn=mKc4j8sgE0%2B97AnyL07vnJ%2Felk1n%2BvA%2B9ru4aCxvJqw%3D

Response

Upon making a successful request, if there are no errors, you will receive a JSON in the given format
{
"status": "SUCCESS",
"schedule": {
"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": 699545,
"duration": 5,
"name": "Assessment Name",
"instructions": "",
"createdAt": "Tue, 08 Feb 2022 11:13:55 GMT"
},
"protected": "NotEnabled"
}
}