Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

Code Block
languagephp
<?php
$url = 'https://opendata.metropolia.fi/r1/reservation/search';
$apiKey='myApiKeyHere:'; // required ':' after the api-key 
$query= "{
        \"startDate\":\"2013-11-22T09:00\",
        \"endDate\":\"2013-11-25T15:00\",
        \"room\":[\"U423\"]
}";
$session = curl_init($url); // set up session 
curl_setopt($session, 
CURLOPT_USERPWD, $apiKey); // authentication 
curl_setopt($session, CURLOPT_POSTFIELDS, $query); // add query entries 
$response = curl_exec($session); // execute and get response 
curl_close($session); //close session 
var_dump($response); 
?>

You can also add following parameters if necessaty (after curl_setopt -line):

curl_setopt($session, CURLOPT_SSL_VERIFYPEER, false); // skips verification if certificates cause problems

curl_setopt($session, CURLOPT_RETURNTRANSFER, true); // returns data as string