Download current school info 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://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_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": { "title": "REST API Example School", "active": true, "reference": "FOR-NE-1001", "org_nr": "882 287 093", "phone": "+47 76 22 99 33", "email_admin": "post@spinnerlabs.no", "email_booking": "booking@spinnerlabs.no", "email_more_info": "merinfo@kursguiden.no", "post_address": { "address": "Fornebuveien 42", "zip": "1122", "city": "B\u00e6rum" }, "visit_address": { "address": "", "zip": "", "city": "" }, "web_address": "http:\/\/www.spinnerlabs.no\/", "text_tagline": "Simply the best.", "text_description": "<p>One of the top schools in the world. Learn about REST APIs.<\/p>", "created_at": "2015-01-21T00:00:00+01:00", "updated_at": "2021-01-28T18:54:22+01:00" } }
Unsuccessful response sample:
{ "error": "Wrong API Key" }