Scoilnet's API allows you to easily search resources from scoilnets database on you own site.
For full documentation, see Scoilnet's developer documentation
Also check out the Scoilnet PHP SDK Demo that you can install on your own server.
Installation is a quick 4 step process:
- Install ScoilnetSDK
- Create your cache folder
- Get API authentication keys from Scoilnet
- Configuration search paramaters.
The preferred way to install this library is to rely on Composer.
Just check on Packagist the version you want to install (in the following example, we used "dev-master") and add it to your composer.json
:
{
"require": {
// ...
"Scoilnet/PHPSDK": "dev-master"
}
}
Alternatively you can download the scoilnetsdk folder and add it to your project.
For best performance a cache folder should be created that php can write too, but is not accessible by the web server.
To use the api you will need to login too scoilnet and obtain a client id, client secret key and api key. Go to the [scoilnet api section] (https://www.scoilnet.ie/scoilnet-api) for more information on how to obtain the application keys.
For all requests, you must initialize the SDK with your Client ID, Client Secret and API Key.
<?php
require '../scoilnetsdk/ScoilnetClient.php';
$config = [
"client_id" =>"[YOUR CLIENT ID]",
"client_secret" =>"[YOUR CLIENT SECRET]",
"api_key" => "[YOUR API KEY]",
];
$this->scoilnetClient = new \ScoilnetSDK\ScoilnetClient($config);
//Set the cache folder that you created in step3
$this->scoilnetClient->setCacheFile("/var/www/searchAPI/Cache/");
//See [scoilnet search documentation] (https://www.scoilnet.ie/scoilnet-api/documentation) for list of possible paramater options
$params = array();
//Make a search request
$response = $this->scoilnetClient->search($params);