Get diplomas by filtering on user_id and/or participant_id using GET. At least one parameter is required.
Returns a list of diplomas with user, course, coursedate information and download links. You can filter by user_id to get all diplomas for a user, by participant_id to get the diploma for a specific course enrollment, or by both to get a specific diploma for a specific user.
For every API request you make, you'll need to present the API access key in the HTTP Header as X-API-Key to be authenticated.
| Name | Required | Value | Description |
|---|---|---|---|
| user_id | optional | integer | Filter diplomas by user ID. Can be combined with participant_id. |
| participant_id | optional | integer | Filter diplomas by participant ID (course enrollment). Can be combined with user_id. |
| ttl | optional | integer | Token expiry time in seconds (default: 900) |
$request_url = 'https://api.frontcore.com/v2/diplomas';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $request_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'X-API-Key: {your-api-key}',
'Accept: application/json',
));
$result = curl_exec($ch);
curl_close($ch);
If the method is successful it responds with an JSON structure, as it is shown below.
{
"success": "ok",
"items": [
{
"id": 12345,
"participant_id": 987654,
"user": {
"id": 289252,
"firstname": "John",
"lastname": "Doe",
"email": "john.doe@example.com",
"phone": "+47 12345678",
"date_of_birth": "1990-01-15",
"gender": "Male",
"nationality": "NO",
"national_identification_number": null,
"position": "Developer",
"company_employee_number": null,
"created_at": "2023-01-10 10:30:00",
"updated_at": "2024-03-15 14:20:00"
},
"course": {
"id": 44724,
"title": "Safety Training Course",
"reference": "SAFE-101",
"created_at": "2022-05-01 09:00:00",
"updated_at": "2024-01-20 11:00:00"
},
"coursedate": {
"id": 12654406,
"start_at": "2024-02-15 09:00:00",
"end_at": "2024-02-15 16:00:00",
"deadline_at": "2024-02-10 23:59:59",
"location": {
"id": 5678,
"title": "Training Center Oslo",
"address": "Example Street 123",
"zipcode": "0150",
"city": "Oslo",
"country": "NO"
}
},
"passed_note": "Excellent performance",
"is_participated": true,
"is_completed": true,
"is_passed": true,
"is_assessment_completed": true,
"is_diploma_printed": true,
"is_sent": true,
"random_certificate_number": "ABC123456",
"serial": "2024-SAFE-001",
"result_updated_at": "2024-02-16 10:00:00",
"created_at": "2024-02-15 16:30:00",
"updated_at": "2024-02-16 10:00:00",
"deleted_at": null,
"links": {
"download": "https://api.frontcore.com/v2/public/course-users/289252/diplomas/12345/download?token=eyJ0eXAiOiJKV1QiLCJhbGc...",
"stream": "https://api.frontcore.com/v2/course-users/289252/diplomas/12345/download?stream=true"
}
}
]
}
Unsuccessful response sample:
{
"error": "Wrong API Key"
}