eLearning Course by ID API

eLearning

Use the eLearning Course by ID API to return a name of a course in JSON format for the specified ID. For the list of IDs for the courses available to your organization, use the Courses Available API.

Resource URL

https://api.veracode.com/elearning/v1/courses/ {course_id}

Table. Parameters
Name Query or Path Parameter Type Description
course_id * (required) Path String The course unique identifier.
Table. Response Codes
HTTP Code Description Type
200 Success. Returns a course for the specified ID. Course
400 Invalid request. Null
404 Not found. Null
403 Access denied. Null
500 Server-side error. Null

Example Request

The following 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 GetCourseClient {
        
    // 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/courses/CRLF");
        String authHeader = ClientCryptoLib.calculateAuthorizationHeader(ClientCryptoLib.VERACODE_HMAC_SHA_256, API_KEY,
          API_SECRET, uri.getHost(), uri.getPath(), 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

The following response conforms to the Hypertest Application Language content type (application/hal+json), which includes a link to the reportcards endpoint for the given course.

GET/elearning/v1/courses/{course_id}HTTP/1.1
        HTTP/1.1200OKContent-Type:application/json
{
    "_links": {
        "reportcards": {
            "templated": true,
            "href": "https://api.veracode.com/elearning/v1/reportcards?course_id=CRLF{&user_id,page,size}"
        },
        "self": {"href": "https://api.veracode.com/elearning/v1/courses/CRLF"}
    },
    "name": "AppSec Tutorials - CRLF Injection",
    "courseId": "CRLF"
}