Get a list of supported durations
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/durations';
$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.
[
{
"id": "7",
"code": "minutes",
"title": "Minutt",
"title_plural": "Minutter"
},
{
"id": "6",
"code": "hours",
"title": "Time",
"title_plural": "Timer"
},
{
"id": "1",
"code": "days",
"title": "Dag",
"title_plural": "Dager"
},
{
"id": "2",
"code": "weeks",
"title": "Uke",
"title_plural": "Uker"
},
{
"id": "3",
"code": "months",
"title": "M\u00e5ned",
"title_plural": "M\u00e5neder"
},
{
"id": "4",
"code": "semester",
"title": "Semester",
"title_plural": "Semester"
},
{
"id": "5",
"code": "years",
"title": "\u00c5r",
"title_plural": "\u00c5r"
}
]
Unsuccessful response sample:
{
"error": "Wrong API Key"
}