Get eLearning progress reports with the REST API
Use the eLearning API to return a collection of progress status report cards, in JSON format, for the eLearning users you manage. The response includes report cards of all eLearning users in your organization.
Resource URL
https://api.veracode.com/elearning/v1/reportcards
Parameters
Name | Query or Path Parameter | Type | Description |
---|---|---|---|
user_id | Query | String | Optional. User identifier. |
course_id | Query | String | Optional. Course identifier. |
page | Query | Integer | Optional. Page number. Default is 0 . |
size | Query | Integer | Optional. Page size. Default is 50 users per page, maximum is 500 users per page. |
HTTP codes
HTTP Code | Description | Type |
---|---|---|
200 | Success. Array of progress status report cards. | Object |
400 | Invalid request. | Null |
403 | Access denied. | Null |
404 | Not found. | Null |
500 | Server-side error. | Null |
Example request
This example assumes you have correctly configured your credentials and configured any required HMAC authentication libraries.
import java.net.URI;
import org.apache.http.HttpEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.json.JSONObject;
import com.veracode.security.apisigning.ClientCryptoLib;
public class GetReportCardsClient {
// An API Id for authentication
private final static String API_KEY = "API_KEY_GOES_HERE";
// The secret key corresponding to the API Id
private final static String API_SECRET = "API_SECRET_GOES_HERE";
public static void main(String[] args) throws Exception {
URI uri = URI.create(
"https://api.veracode.com/elearning/v1/reportcards?course_id=CRLF&user_id=jsmith");
String authHeader = ClientCryptoLib.calculateAuthorizationHeader(ClientCryptoLib.VERACODE_HMAC_SHA_256, API_KEY,
API_SECRET, uri.getHost(), uri.getPath().concat("?"+uri.getQuery()), HttpGet.METHOD_NAME);
HttpGet request = new HttpGet(uri);
request.addHeader("Authorization", authHeader);
CloseableHttpResponse response = HttpClients.createDefault().execute(request);
HttpEntity entity = response.getEntity();
JSONObject json = new JSONObject(EntityUtils.toString(entity, "UTF-8"));
System.out.println(json.toString(4));
}
}
Example response
This example response conforms to the Hypertext Application Language content type application/hal+json
, which includes a link to the learner
endpoint and course
endpoint.
HTTP/1.1 200 OK
Content-Type: application/json
{
"_embedded": {"reportcards": [{
"timeSpentOnCourse": 0.24,
"_links": {
"learner": {"href": "https://api.veracode.com/elearning/v1/learners/jsmith"},
"course": {"href": "https://api.veracode.com/elearning/v1/courses/CRLF"}
},
"courseStartedDate": "2018-05-11T00:00:00.000Z",
"courseStatus": "Passed",
"progressPercent": 100,
"numberOfAttempts": 1,
"courseCompletedDate": "2018-05-11T00:00:00.000Z"
}]},
"_links": {"self": {"href": "https://api.veracode.com/elearning/v1/reportcards?user_id=jsmith&course_id=CRLF&page=0&size=50"}},
"page": {
"number": 0,
"size": 50,
"totalPages": 1,
"totalElements": 1
}
}