Download course ID, title, duration, price and other attributes using GET.
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.
$request_url = 'https://www.kursguiden.no/api/v1/courses';
$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.
{
"status": "success",
"courses": {
"22353": {
"id": 22353,
"title": "Learn REST API",
"reference": "RESTAPI-CA-1001",
"is_active": true,
"kursguiden_url": "https:\/\/www.kursguiden.no\/kurs\/\u00d8kologisk-matkurs\/Learn-REST-API\/",
"is_full_time": false,
"is_part_time": true,
"level": {
"id": 6,
"title": "Kurs"
},
"form_of_teaching": {
"id": 1,
"title": "Klasserom"
},
"teaching_language": {
"id": "no",
"title": "Norsk"
},
"time_of_day": {
"id": 2,
"title": "Kveldskurs"
},
"duration": {
"value": 6,
"unit": "Time(r)"
},
"price": {
"value": 1500,
"currency": "NOK",
"comment": "Includes a free beer."
},
"categories": [
{
"id": 1075,
"title": "\u00d8kologisk matkurs",
"idParent": 1456,
"titleParent": "Matkurs"
},
{
"id": 1473,
"title": "Norsk mat",
"idParent": 1456,
"titleParent": "Matkurs"
}
],
"descriptions": {
"lead": "REST API is very useful.",
"description": "<p>REST API is a easy way of sharing information between sites.<\/p>",
"place": "<p>At IT Fornebu.<\/p>",
"prerequisites": "<p>Normal programming skills.<\/p>",
"duration": "<p>2 sessions. Each session is 3 hours.<\/p>",
"credits": "<p>No credts.<\/p>",
"submissions": "<p>Two tasks to be submitted online.<\/p>",
"hotelInfo": "<p>Scandic Fornebu.<\/p>",
"audience": "<p>Programmers and web developers.<\/p>"
},
"lead_settings": {
"email_booking": "booking@exampleschool.no",
"email_more_info": "more.info@exampleschool.no"
}
}
}
}
Unsuccessful response sample:
{
"status": "failure",
"message": "Wrong API Key"
}