Add a course

Adds a course using POST.

- Will return an error if an active course with equal title already exists.
- Frontcore staff will categorize the course within a few working days.

Request

POST https://www.kursguiden.no/api/v2/courses

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.

Parameters

Name Required Value Description
title required string Title of the course
active optional bool Default is 1
reference optional string Your own reference, if needed.
is_full_time optional bool Default is null (not set)
is_part_time optional bool Default is null (not set)
level optional integer Default is 6 ("Courses")
  • 1 = University
  • 2 = College
  • 3 = Vocational school
  • 6 = Courses
  • 8 = Other education
  • 9 = Provider
  • 10 = Folk High School
  • 11 = Courses with credits
  • 12 = Breakfast meeting
  • 13 = Seminar
  • 14 = Conference
  • 15 = Corporate training
  • 16 = Lecture
  • 18 = Meet-up
  • 19 = Workshop
  • 20 = Treatment
  • 21 = Event
form_of_teaching optional integer Default is 1 ("Classroom")
  • 1 = Classroom
  • 2 = Online Course
  • 13 = Online study
  • 18 = Virtual classroom
  • 21 = Webinar
  • 22 = Webinar + online course
  • 10 = Classroom + online course
  • 12 = Classroom + practice
  • 17 = Practice + Online course
  • 9 = Recreation classes
  • 11 = Practice
  • 19 = Virtual or in-person
  • 8 = Corporate training
  • 5 = Others
teaching_language optional string Default is no ('no' as in Norwegian)
  • be-BY = Belarusian
  • bg-BG = Bulgarian
  • ch-ZN = Chinese Simplified
  • cs-CZ = Czech
  • et-EE = Estonian
  • el-GR = Greek
  • he-IL = Hebrew
  • hi-IN = Hindi
  • hu-HU = Hungarian
  • id-ID = Indonesian
  • it-IT = Italian
  • ja-JP = Japanese
  • ko-KR = Korean
  • lt-LT = Lithuanian
  • mk-MK = Macedonian
  • ms-MY = Malay
  • fa-TJ = Persian
  • pt-PT = Portuguese
  • ro-RO = Romanian
  • ru-RU = Russian
  • sr-CS = Serbian (Latin)
  • sgn = Sign language
  • th = Thai
  • tr = Turkish
  • uk = Ukrainian
  • vi = Vietnamese
  • da = Danish
  • nl-NL = Dutch
  • en = English
  • fi = Finnish
  • fr-FR = French
  • de-DE = German
  • no = Norwegian
  • pl-PL = Polish
  • es-ES = Spanish
  • sv-SE = Swedish
time_of_day optional integer Default is null (not set)
  • 1 = Daytime
  • 2 = Evening class
  • 3 = Weekend course
duration_value optional integer Default is null (not set)
duration_unit optional integer Default is null (not set)
  • 7 = Minute
  • 6 = Hour
  • 1 = Day
  • 2 = Week
  • 3 = Month
  • 4 = Semester
  • 5 = Year
price_value optional integer Default is null (not set)
price_currency optional string Default is NOK
price_comment optional string
text_lead optional string ~170 characters are visible on Kursguidens listing pages.
text_description optional string Can contain HTML
text_place optional string Can contain HTML
text_prerequisites optional string Can contain HTML
text_duration optional string Can contain HTML
text_credits optional string Can contain HTML
text_submissions optional string Can contain HTML
text_hotel_info optional string Can contain HTML
text_audience optional string Can contain HTML
email_booking optional string E-mail address
email_more_info optional string E-mail address
external_booking_url optional string Lead form - booking registration.
external_more_info_url optional string Lead form - request for more info.

Example code in PHP

$post_params = array();
$post_params['title'] = 'Learn REST API';
$post_params['active'] = '1';
$post_params['reference'] = 'RESTAPI-CA-1001';
$post_params['is_full_time'] = '0';
$post_params['is_part_time'] = '1';
$post_params['level'] = '6';
$post_params['form_of_teaching'] = '1';
$post_params['teaching_language'] = 'no';
$post_params['time_of_day'] = '2';
$post_params['duration_value'] = '6';
$post_params['duration_unit'] = '6';
$post_params['price_value'] = '1500';
$post_params['price_currency'] = 'NOK';
$post_params['price_comment'] = 'Includes a free beer.';
$post_params['text_lead'] = 'REST API is very useful.';
$post_params['text_description'] = '<p>REST API is a easy way of sharing information between sites.</p>';
$post_params['text_place'] = '<p>At IT Fornebu.</p>';
$post_params['text_prerequisites'] = '<p>Normal programming skills.</p>';
$post_params['text_duration'] = '<p>2 sessions. Each session is 3 hours.</p>';
$post_params['text_credits'] = '<p>No credts.</p>';
$post_params['text_submissions'] = '<p>Two tasks to be submitted online.</p>';
$post_params['text_hotel_info'] = '<p>Scandic Fornebu.</p>';
$post_params['text_audience'] = '<p>Programmers and web developers.</p>';
$post_params['email_booking'] = 'booking@exampleschool.no';
$post_params['email_more_info'] = 'more.info@exampleschool.no';

$request_url = 'https://www.kursguiden.no/api/v2/courses';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $request_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_params);

curl_setopt($ch, CURLOPT_HTTPHEADER, array(
  'X-API-Key: {your-api-key}',
  'Accept: application/json',
));
$result = curl_exec($ch);
curl_close($ch);
               

Response

If the method is successful it responds with an JSON structure, as it is shown below.

{
    
    "course_id": 22357
}

Unsuccessful response sample:

{
    "error": "Required field 'title' is missing"
}      
© 2024 FrontCore