265 lines
7.6 KiB
PHP
265 lines
7.6 KiB
PHP
<?php
|
|
$domain = 'cms.nasle.eu:88';
|
|
$endpoints = [
|
|
/*
|
|
'categories' => [
|
|
'Domain' => $domain,
|
|
'Url' => '/api/categories',
|
|
'Method' => 'GET'
|
|
],
|
|
'categories-tree' => [
|
|
'Domain' => $domain,
|
|
'Url' => '/api/categories-tree/',
|
|
'Method' => 'GET'
|
|
],
|
|
'object-types' => [
|
|
'Domain' => $domain,
|
|
'Url' => '/api/object-types/',
|
|
'Method' => 'GET',
|
|
'Required parameters' => 'sub_category_id'
|
|
],
|
|
'object-template-create' => [
|
|
'Domain' => $domain,
|
|
'Url' => '/api/object-template/create/',
|
|
'Method' => 'POST',
|
|
'Content type' => 'json',
|
|
'Header parameters' => 'api_token',
|
|
'Required format' => '
|
|
{
|
|
"rr_category_id": (int),
|
|
"name":"(string)",
|
|
"name_en":"(string)"
|
|
}',
|
|
'Response' => '{"success": 1}'
|
|
],
|
|
*/
|
|
'main-category-create' => [
|
|
'Domain' => $domain,
|
|
'Url' => '/api-sync/main-category/create/',
|
|
'Method' => 'POST',
|
|
'Content type' => 'json',
|
|
'Header parameters' => 'api_token',
|
|
'Required format' => '
|
|
{
|
|
"rr_category_id": (int),
|
|
"name":"(string)",
|
|
"name_en":"(string)"
|
|
}',
|
|
'Response' => '{"success": 1}'
|
|
],
|
|
'main-category-update' => [
|
|
'Domain' => $domain,
|
|
'Url' => '/api-sync/main-category/update/',
|
|
'Method' => 'POST',
|
|
'Content type' => 'json',
|
|
'Header parameters' => 'api_token',
|
|
'Required format' => '
|
|
{
|
|
"rr_category_id": (int),
|
|
"name":"(string)",
|
|
"name_en":"(string)"
|
|
}',
|
|
'Response' => '{"success": 1}'
|
|
],
|
|
'main-category-delete' => [
|
|
'Domain' => $domain,
|
|
'Url' => '/api-sync/main-category/delete/',
|
|
'Method' => 'POST',
|
|
'Content type' => 'json',
|
|
'Header parameters' => 'api_token',
|
|
'Required format' => '
|
|
{
|
|
"rr_category_id": (int),
|
|
}',
|
|
'Response' => '{"success": 1}'
|
|
],
|
|
'sub-category-create' => [
|
|
'Domain' => $domain,
|
|
'Url' => '/api-sync/sub-category/create/',
|
|
'Method' => 'POST',
|
|
'Content type' => 'json',
|
|
'Header parameters' => 'api_token',
|
|
'Required format' => '
|
|
{
|
|
"rr_category_id": (int),
|
|
"rr_sub_category_id": (int),
|
|
"name":"(string)",
|
|
"name_en":"(string)"
|
|
}',
|
|
'Response' => '{"success": 1}'
|
|
],
|
|
'sub-category-update' => [
|
|
'Domain' => $domain,
|
|
'Url' => '/api-sync/sub-category/update/',
|
|
'Method' => 'POST',
|
|
'Content type' => 'json',
|
|
'Header parameters' => 'api_token',
|
|
'Required format' => '
|
|
{
|
|
"rr_sub_category_id": (int),
|
|
"name":"(string)",
|
|
"name_en":"(string)"
|
|
}',
|
|
'Response' => '{"success": 1}'
|
|
],
|
|
'sub-category-delete' => [
|
|
'Domain' => $domain,
|
|
'Url' => '/api-sync/sub-category/delete/',
|
|
'Method' => 'POST',
|
|
'Content type' => 'json',
|
|
'Header parameters' => 'api_token',
|
|
'Required format' => '
|
|
{
|
|
"rr_sub_category_id": (int),
|
|
"name":"(string)",
|
|
"name_en":"(string)"
|
|
}',
|
|
'Response' => '{"success": 1}'
|
|
]
|
|
,'object-template-create' => [
|
|
'Domain' => $domain,
|
|
'Url' => '/api-sync/object-template/create/',
|
|
'Method' => 'POST',
|
|
'Content type' => 'json',
|
|
'Header parameters' => 'api_token',
|
|
'Required format' => '
|
|
{
|
|
"rr_ot_id": (int),
|
|
"heritage_type": (int),
|
|
"name":"(string)",
|
|
"name_en":"(string)"
|
|
}',
|
|
'Response' => '{"success": 1}',
|
|
'Info' => "
|
|
<strong>heritage_type options:</strong>
|
|
|
|
1 => 'Недвижимо наследсвто',
|
|
2 => 'Движимо материално наследство',
|
|
3 => 'Движимо нематериално наследство',
|
|
4 => 'Природно наследство'
|
|
"],
|
|
'object-template-update' => [
|
|
'Domain' => $domain,
|
|
'Url' => '/api-sync/object-template/update/',
|
|
'Method' => 'POST',
|
|
'Content type' => 'json',
|
|
'Header parameters' => 'api_token',
|
|
'Required format' => '
|
|
{
|
|
"rr_ot_id": (int),
|
|
"heritage_type": (int),
|
|
"name":"(string)",
|
|
"name_en":"(string)"
|
|
}',
|
|
'Response' => '{"success": 1}',
|
|
],
|
|
'object-template-delete' => [
|
|
'Domain' => $domain,
|
|
'Url' => '/api-sync/object-template/delete/',
|
|
'Method' => 'POST',
|
|
'Content type' => 'json',
|
|
'Header parameters' => 'api_token',
|
|
'Required format' => '
|
|
{
|
|
"rr_ot_id": (int)
|
|
}',
|
|
'Response' => '{"success": 1}'
|
|
]
|
|
/*
|
|
'object-create' => [
|
|
'Domain' => $domain,
|
|
'Url' => '/api/object-create/',
|
|
'Method' => 'POST',
|
|
'Content type' => 'json',
|
|
'Required format' => 'register_id, '
|
|
],
|
|
'object-retrieve' => [
|
|
'Domain' => $domain,
|
|
'Url' => '/api/object-retrieve/',
|
|
'Method' => 'GET',
|
|
'Required parameters' => 'id'
|
|
],
|
|
'object-update' => [
|
|
'Domain' => $domain,
|
|
'Url' => '/api/object-update/',
|
|
'Method' => 'POST',
|
|
'Content type' => 'json',
|
|
'Required format' => ''
|
|
],
|
|
'object-delete' => [
|
|
'Domain' => $domain,
|
|
'Url' => '/api/object-delete/',
|
|
'Method' => 'POST',
|
|
'Required parameter' => 'register_id'
|
|
]
|
|
*/
|
|
];
|
|
?>
|
|
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport"
|
|
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
|
<title>Nasledstvo Api</title>
|
|
<link href="/_public/assets/css/api.css" rel="stylesheet">
|
|
<script src="/_public/assets/js/api.js"></script>
|
|
</head>
|
|
<body>
|
|
<div class="page">
|
|
<div class="left-navbar">
|
|
<div class="left-bar-header">Nasledstvo Api</div>
|
|
<?php foreach ($endpoints as $id => $endpoint): ?>
|
|
<a onclick="setActive()" data-id="<?= $id ?>" class="link-to" href="#<?= $id ?>"><?= $id ?></a>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
<div class="content">
|
|
<?php foreach ($endpoints as $id => $endpoint): ?>
|
|
<div id="<?= $id ?>" class="endpoint-container">
|
|
<div class="endpoint">
|
|
<div class="header"><?= $id ?></div>
|
|
<div class="body">
|
|
<?php foreach ($endpoint as $key => $value): ?>
|
|
<div class="row">
|
|
<div class="key"><?= $key ?></div>
|
|
<?php if ($key == 'Required format' || $key == 'Response' || $key == 'Info'): ?>
|
|
<div class="value json-format">
|
|
<pre><?= $value ?></pre>
|
|
</div>
|
|
<?php else: ?>
|
|
<div class="value <?= $value == 'GET' || 'POST' ? $value : '' ?>"><?= $value ?></div>
|
|
<?php endif; ?>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
</div>
|
|
<script>
|
|
|
|
window.addEventListener('load', () => {
|
|
setActive();
|
|
})
|
|
|
|
function setActive() {
|
|
setTimeout(function () {
|
|
const url = window.location.href.split('#');
|
|
console.log(url)
|
|
document.querySelectorAll('.link-to').forEach(e => {
|
|
if (url[1] && e.dataset.id === url[1]) {
|
|
e.classList.add('active')
|
|
} else {
|
|
e.classList.remove('active')
|
|
}
|
|
})
|
|
}, 10)
|
|
|
|
}
|
|
|
|
</script>
|
|
</body>
|
|
</html>
|