See 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://www.kursguiden.no/api/v1/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.
{ "status": "success", "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>" } }
Unsuccessful response sample:
{ "status": "failure", "message": "Wrong API Key" }