load.php will perform a require_once for all necessary files in the lib-folder.
This step is crutial all the other functions to work.
$client = new Yesplan\Client(YESPLAN_DOMAIN, YESPLAN_API_KEY);
Where YESPLAN_DOMAIN should be your Yespan domain, without http:// and trailing .yesplan.be. If your domain is http://rockit.yesplan.be, rockit should be your domain.
YESPLAN API key should be a valid key, generated by your Yesplan install.
For getting data we're using the same method for all edpoints.
Note: not all available endpoints in the Yesplan API are yet available in this repository.
If you'd like to use an endpoint which is nog included, you can use the Url endpoint.
Yesplan\Endpoints\Url::get($client, $full_request_url_without_api_key);
Generation a data result from a dataview and retreiving the data. https://manual.yesplan.be/nl/developers/dataviews/
Give a command to collect data.
Yesplan\Endpoints\Dataviews::compute($client, $dataview_id, $parameters, $callback_url);
*$dataview_id: the ID of the dataview you'd like to use.
$parameters: should be an array like this:
Array
(
[filter_keyword] => filter_value
)
$callback_url: is the full URL Yesplan will use to notify when the data is collected and ready to be retreived.
This function will return a JSON response with the current status of the dataview. This status should be running. When the data is collected, Yesplan wil send a POST request to the given callback URL. This request will contain the dataview ID and the full API URL to retreive the data. This will look something like this:
POST /yesplan-dataview-result-ready/123 HTTP/1.1
Host: ticketing.system.com
Accept: */*
Content-type: application/json
Content-Length: 189
{
"id": "335990017",
"url": "https://theater.yesplan.be/api/dataviewresult/289503489-1510822734/json/335990017",
"creationtime": "2017-12-06T09:18:32.48699498176575+01:00"
}
Get the status of a dataview request.
Yesplan\Endpoints\Dataviews::status($client, $dataview_id, $result_id);
This function was made for testing. In normal situations you'll not need this one.
Get the collected data from a dataview request.
Yesplan\Endpoints\Dataviews::get($client, $dataview_id, $result_id);
This function is the one you'll need in your callback file. The post data of Yesplan will contain the result ID. However, you still need the dataview ID.
In the case you don't want to specify the dataview ID again in the callback file, you can simply use the Url function.
Yesplan\Endpoints\Url::get($client, POST_DATA->url);
For directly getting data from events.
This function will give a list of events for a given Yesplan search query.
Yesplan\Endpoints\Events::getList($client, $searchquery);
Get all data from an event.
Yesplan\Endpoints\Events::get($client, $event_id);
Get schedule data from an event.
Yesplan\Endpoints\Events::getSchedule($client, $event_id);
Get all attachments from an event.
Yesplan\Endpoints\Events::getAttachments($client, $event_id);
Get custom data from an event.
Yesplan\Endpoints\Events::getCustomdata($client, $event_id, $keywords);
Where $keywords can either be an array or a list of komma separated Yesplan keywords.
Get all custom data from an event.
Yesplan\Endpoints\Events::getCustomdataValuesOnly($client, $event_id);
Get all resoursebookings from an event.
Yesplan\Endpoints\Events::getResourcebookings($client, $event_id);
Writes custom data into Yesplan.
Yesplan\Endpoints\Events::putCustomdata($client, $event_id, $data);
Where $data should be formatted like this:
$data[] = (object) [
'keyword' => 'YESPLAN_KEYWORD',
'value' => 'VALUE'
];
### Events
For directly getting data from events.
This function will give a list of groups for a given Yesplan search query.
Yesplan\Endpoints\Groups::getList($client, $searchquery);
This is not tested yet.
Get all data from a group.
Yesplan\Endpoints\Groups::get($client, $group_id);
Get schedule data from a group.
Yesplan\Endpoints\Groups::getSchedule($client, $group_id);
Get all attachments from a group.
Yesplan\Endpoints\Groups::getAttachments($client, $group_id);
Get custom data from a group.
Yesplan\Endpoints\Groups::getCustomdata($client, $group_id, $keywords);
Where $keywords can either be an array or a list of komma separated Yesplan keywords.
Get all custom data from a group.
Yesplan\Endpoints\Groups::getCustomdataValuesOnly($client, $group_id);
Get all resoursebookings from a group.
Yesplan\Endpoints\Groups::getResourcebookings($client, $group_id);
Writes custom data into Yesplan.
Yesplan\Endpoints\Groups::putCustomdata($client, $group_id, $data);
Where $data should be formatted like this:
$data[] = (object) [
'keyword' => 'YESPLAN_KEYWORD',
'value' => 'VALUE'
];
This function will give a list of profiles for a given Yesplan search query.
Yesplan\Endpoints\Profiles::getList($client, $searchquery);
Get all data of a profile.
Yesplan\Endpoints\Profiles::get($client, $profile_id);
This function will give a list of statuses for a given Yesplan search query.
Yesplan\Endpoints\Statuses::getList($client, $searchquery);
Get all data of a status.
Yesplan\Endpoints\Statuses::get($client, $status_id);
This function will give a list of locations for a given Yesplan search query.
Yesplan\Endpoints\Locations::getList($client, $searchquery);
Get all data of a location.
Yesplan\Endpoints\Locations::get($client, $location_id);
Get custom data from an event.
Yesplan\Endpoints\Locations::getCustomdata($client, $location_id, $keywords);
Where $keywords can either be an array or a list of komma separated Yesplan keywords.
Get all custom data from a location.
Yesplan\Endpoints\Locations::getCustomdataValuesOnly($client, $location_id);
This function will give a list of locations for a given Yesplan search query.
Yesplan\Endpoints\Tasks::getList($client, $searchquery);
Get all data of a task.
Yesplan\Endpoints\Tasks::get($client, $location_id);
Creates a new object with given custom data object where data is sorted by keyword. This way it's easier to get custom data values.
Yesplan\Filter::customdataByKey($customdata);
getCustomdata will output somthing like this:
Array
(
[0] => stdClass Object
(
[name] => Titel
[keyword] => production_title
[type] => String
[value] => Exil
)
[1] => stdClass Object
(
[name] => Uitvoerder
[keyword] => production_performer
[type] => String
[value] => Axelle Red
)
)
After running this through the customdataByKey function you'll get something like this.
stdClass Object
(
[production_title] => Exil
[production_performer] => Axelle Red
)
Filters resoursebookings by type. Second parameter is optional, default type is "human".
Yesplan\Filter::resourcebookingsByType($resourcebookings, $resource_type);
Written by Sil Verdickt.
Feel free to contact me if needed.