API documentation for connection
As soon as a service (data protection, legal notice, terms and conditions, …) has been activated for a domain in the dashboard, all necessary data for the integration of the Consent Manager, data protection declaration, terms and conditions, … are delivered for this domain via the API.
If you have not yet created a domain or configured services for it, you must do this first. You can find a quick start guide here: Quick start
It is generally recommended to use legalweb.io via an existing plugin. Alternatively, all data and functions can be accessed via the REST API.
API Request
The API can be accessed at the following URL:
https://dashboard.legalweb.io/api/legalwebapi
The GUID and the callback URL must be transferred in the HEADER for every API request. The content type of the request must be “application/x-www-form-urlencoded”.
API requests are only permitted for the purpose of updating locally stored data. Time-controlled API requests for the purpose of updates are permitted at most every 24 hours.
All data obtained from the API must be saved/cached locally.
Example: API call via Curl in PHP
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => 'https://dashboard.legalweb.io/api/legalwebapi',
CURLOPT_POST => 1,
CURLOPT_HTTPHEADER => array(
"content-type: application/x-www-form-urlencoded",
"Guid: ihre-guid",
"Callback: https://meine-webseite.com/?cb=legalwebxyz",
)
]);
$resp = curl_exec($curl);
curl_close($curl);
// var_dump($resp); // hier könnte der gesamte json string ausgegeben werden
$apiData = json_decode ($resp); // der komplette Response müsste nun zwischengespeichert werden (zB. in der Db, in einem File,...)
$css = $apiData->services->dppopupcss;
$js = $apiData->services->dppopupjs;
$popup_de = $apiData->services->dppopup->de;
$spDsgvoGeneralConfig = $apiData->services->dppopupconfig->spDsgvoGeneralConfig;
$spDsgvoIntegrationConfig = $apiData->services->dppopupconfig->spDsgvoIntegrationConfig;
?>
<!DOCTYPE html>
<html>
<head>
<style>
<?= $css ?>;
</style>
</head>
<body>
<h1>This is a test page</h1>
<script>
var spDsgvoGeneralConfig = JSON.parse('<?php echo json_encode($spDsgvoGeneralConfig); ?>');
var spDsgvoIntegrationConfig = JSON.parse('<?php echo json_encode($spDsgvoIntegrationConfig); ?>');
<?= $js; ?>
</script>
<?= $popup_de ?>;
</body>
</html>
API Result
The API is output in JSON format. The complete data set is always delivered. There are currently no plans to query individual services, as the desired services have already been configured in the backend.
{
"lw_api": {
"mode": "",
"version": "",
"description": "API of legalweb.io",
"url": "https://dashboard.legalweb.io/api/legalwebapi",
"documentation": "https://legalweb.io/support/api",
"terms": "https://legalweb.io/shop/agb/"
},
"domain": {
"domain_id": "",
"domain_guid": "",
"domain_url": "",
"domain_callback": "",
"organisation": "",
"address": "",
"city": "",
"zip": "",
"country": "",
"phone": "",
"email": ""
},
"services": {
"imprint": {
"de": "",
"en": ""
},
"dpstatement": {
"de": "",
"en": ""
},
"dppopup": {
"de": "",
"en": ""
},
"dppopupcss": ""
,
"dppopupjs": ""
,
"dppopupconfig": {
"spDsgvoGeneralConfig": {},
"spDsgvoIntegrationConfig": {}
},
"contractterms": {
"de": "",
"en": ""
},
"contractcheckout": {
"de": "",
"en": ""
},
"contractwithdrawaldigital": {
"de": "",
"en": ""
},
"contractwithdrawalservice": {
"de": "",
"en": ""
},
"guetesiegel": {
"de": ""
},
"messages": [{
"id": "",
"msg": ""
}
]
}
}
Field description
- imprint: Imprint as HTML. The plugin has to insert the imprint in the correct language version on the correct page. Domains whose responsible person is located in Austria display imprintat, those whose responsible person is located in Germany display imprintde.
- dpstatement: Privacy policy as HTML. The plugin has to insert the privacy policy in the correct language version on the correct page.
- dppopup: HTML code of the popup. The plugin has to insert the HTML in the correct language version in the template.
- dppopupcss: CSS code of the popup. The plugin has to insert the CSS in the template.
- dppopupjs: JS of the popup. The plugin has to insert the JS in the template.
- dppopupconfig: Two JS variables are transferred here that are required by “dppopupjs”. These JS variables must be output before “dppopupjs” is output.
- contractterms: AGB as HTML. The plugin has to insert the HTML in the correct language version on the correct page.
- contractcheckout: Terms and conditions, revocation and data protection clause for the checkout.
- contractwithdrawaldigital: Withdrawal waiver clause for digital products for the checkout as a txt string.
- contractwithdrawalservice: Withdrawal waiver clause for services for the checkout as a txt string.
- seal: HTML code for da legal web seal. This is a graphic that should/can be displayed anywhere.
- messages: Admin-Backend Notes.