AOPS API
Základní dotazování na content api servírované přes AOPS.
Endpoints
Přístup k projektu
GET
https://aops.cz/api/vase_project_id
Přístup ke všem kolekcím.
Příklady
GET /api/your_project_id HTTP/1.1a
Host: aops.cz
Accept: application/json
Authorization: Bearer your_access_token
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://aops.cz/api/your_project_id',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'Accept: application/json',
'Authorization: Bearer your_access_token'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var myHeaders = new Headers();
myHeaders.append("Accept", "application/json");
myHeaders.append("Authorization", "Bearer your_access_token");
var requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://aops.cz/api/your_project_id", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
Get Entries
GET
https://aops.cz/api/vase_project_id/collection
Získá všechny záznamy přidané ke kolekci.
Příklady
GET /api/your_project_id/your_collection HTTP/1.1
Host: aops.cz
Accept: application/json
Authorization: Bearer your_access_token
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://aops.cz/api/your_project_id/your_collection',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'Accept: application/json',
'Authorization: Bearer your_access_token'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var myHeaders = new Headers();
myHeaders.append("Accept", "application/json");
myHeaders.append("Authorization", "Bearer your_access_token");
var requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://aops.cz/api/your_project_id/your_collection", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
Get One Entry
GET
https://aops.cz/api/vase_project_id/collection/{content_id}
Získá konkrétní záznam podle zadaného ID.
Příklady
GET /api/your_project_id/your_collection/{content_id} HTTP/1.1
Host: aops.cz
Accept: application/json
Authorization: Bearer your_access_token
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://aops.cz/api/your_project_id/your_collection/{content_id}',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'Accept: application/json',
'Authorization: Bearer your_access_token'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var myHeaders = new Headers();
myHeaders.append("Accept", "application/json");
myHeaders.append("Authorization", "Bearer your_access_token");
var requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://aops.cz/api/your_project_id/your_collection/{content_id}", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
Get Project Media
GET
https://aops.cz/api/vase_project_id/project-media
Získá všechna multimédia přiřazená k projektu.
Příklady
GET /api/your_project_id/project-media HTTP/1.1
Host: aops.cz
Accept: application/json
Authorization: Bearer your_access_token
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://aops.cz/api/your_project_id/project-media',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'Accept: application/json',
'Authorization: Bearer your_access_token'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var myHeaders = new Headers();
myHeaders.append("Accept", "application/json");
myHeaders.append("Authorization", "Bearer your_access_token");
var requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://aops.cz/api/your_project_id/project-media", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
Parameters
Where Clauses
K filtrování výsledků můžete použít klauzule where.
Příklad
https://aops.cz/api/your_project_id/posts?where[id]=1
Single Where Clause
?where[created_at]=2021-11-25
?where[updated_at]=2021-11-25
?where[published_at]=2021-11-25
Get the first result
https://aops.cz/api/vase_project_id/posts?first
like operator
?where[title][like]=about
not operator
in and not_in operators
lt and lte operators
less than
less than or equal to
gt and gte operators
greater than
greater than or equal to
null and not_null operators
between and not_between operators
?where[price][between]=20,21
?where[price][not_between]=20,21
Combining where clauses
?where[][price]=200&where[][name]=Watch
OR
?where[][price]=200&where[or][price]=300