Advanced feature: Adds a sub-school using POST.
The school will be connected to your school as a sub-school
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 |
---|---|---|---|
title | required | string | Title of the course |
active | optional | bool | Default is 1 |
org_nr | required | string | Organization number |
reference | optional | string | Your own reference, if needed. |
type | optional | string | School or Company. Default: School |
phone | required | string | Phone |
email_admin | required | string | Login e-mail address |
optional | string | Schools e-mail address | |
email_booking | optional | string | Default e-mail address for bookings |
email_more_info | optional | string | Default e-mail address for more info requests |
post_address | required | string | Post address |
post_zip | required | string | Post zp number |
post_city | required | string | Post city |
visit_address | optional | string | Visit address |
visit_zip | optional | string | Visit zip number |
visit_city | optional | string | Visit city |
web_address | optional | string | Website address |
text_tagline | optional | string | ~120 characters. Visible on school profile at Kursguiden |
text_description | optional | string | Complete school description. Can contain HTML |
$post_params = array();
$post_params['title'] = 'REST API Example School';
$post_params['active'] = '1';
$post_params['reference'] = 'FOR-NE-1001';
$post_params['org_nr'] = '882 287 093';
$post_params['phone'] = '+47 76 22 99 33';
$post_params['post_address'] = 'Fornebuveien 42';
$post_params['post_zip'] = '1122';
$post_params['post_city'] = 'Bærum';
$post_params['text_lead'] = 'REST API is very useful.';
$post_params['web_address'] = 'http://www.spinnerlabs.no/';
$post_params['text_tagline'] = '<p>Simply the best.</p>';
$post_params['text_description'] = '<p>One of the top schools in the world. Learn about REST APIs.</p>';
$post_params['email_admin'] = 'post@spinnerlabs.no';
$post_params['email_booking'] = 'booking@spinnerlabs.no';
$post_params['email_more_info'] = 'more.info@spinnerlabs.no';
$request_url = 'https://api.frontcore.com/v2/schools';
$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);
If the method is successful it responds with an JSON structure, as it is shown below.
{ "school_id": 2904,"api_key": "vaLs7h5x1uwN2PURBGlvtpEg98oyFMzTk" }
Unsuccessful response sample:
{ "error": "Wrong API Key" }