API Documentation
Starting with Impressum Plus 1.1.0, you can use the REST API of WordPress to query or change data of Impressum Plus.
Authentication
Impressum Plus adds an integrates Basic Authentification System. This works with the format Username:Password
or with a token that is the Base64 checksum of such a string, while Username
is the username of an administrator account and Password
the password of such an account.
Example:
curl -i -H "Authorization: Basic QmVudXR6ZXJuYW1lOlBhc3N3b3J0" https://www.domain.tld/wp-json/impressum-plus/v1/all
Code language: Bash (bash)
Structure
WordPress REST API always returns a JSON formatted string.
Error Handling
Impressum Plus uses the integrated error handling of REST API requests of WordPress. It always contains an error code and error message. Optionally, there are more data, e.g. the status code.
Example rest_not_found
:
{
"code": "rest_not_found",
"message": "Option "test" does not exist.",
"data": {
"status": 404
}
}
Code language: JSON / JSON with Comments (json)
GET Requests
Imprint Data
To get imprint data via API, the URL structure is:
/wp-json/impressum-plus/v1/<option>
Code language: Bash (bash)
<option>
can be one of the following strings:
all
– Returns all available values of the imprintcountry
– Returns the countrylegal_entity
– Returns the legal entityname
– Returns the nameaddress
– Returns the addressaddress_alternative
– Returns the alternative addressemail
– Returns the email addressphone
– Returns the phone numberfax
– Returns the fax numberpress_law_person
– Returns the responsible person for the contentvat_id
– Returns the VAT IDcoverage
– Returns the coveragefree_text
– Returns the free text fieldinspecting_authority
– Returns the inspecting authorityregister
– Returns the registerbusiness_id
– Returns the business IDrepresentative
– Returns the representative(s)capital_stock
– Returns the capital stockpending_deposits
– Returns the pending depositsprofessional_association
– Returns the professional associationlegal_job_title
– Returns the legal job titleprofessional_regulations
– Returns the professional regulationspress_law_checkbox
– Returns 1 if journalistic/editorial content is availabledata_protection_officer_name
– Returns the name of the data protection officerdata_protection_officer_address
– Returns the address of the data protection officerdata_protection_officer_email
– Returns the email address of the data protection officerdata_protection_officer_phone
– Returns the phone number of the data protection officersocial_media_facebook
– Returns the Facebook profile URLsocial_media_instagram
– Returns the Instagram profile URLsocial_media_pinterest
– Returns the Pinterest profile URLsocial_media_twitter
– Returns the Twitter profile URL
Example:
{
"country": "<string>",
"legal_entity": "<string>",
"name": "<string>",
"address": "<string>",
"address_alternative": "<string>",
"email": "<string>",
"phone": "<string>",
"fax": "<string>",
"press_law_person": "<string>",
"vat_id": "<string>",
"coverage": "<string>",
"free_text": "<string>",
"inspecting_authority": "<string>",
"register": "<string>",
"business_id": "<string>",
"representative": "<string>",
"capital_stock": "<string>",
"pending_deposits": "<string>",
"professional_association": "<string>",
"legal_job_title": "<string>",
"professional_regulations": "<string>",
"press_law_checkbox": "<string>",
"data_protection_officer_name": "<string>",
"data_protection_officer_address": "<string>",
"data_protection_officer_email": "<string>",
"data_protection_officer_phone": "<string>",
"social_media_facebook": "<string>",
"social_media_instagram": "<string>",
"social_media_pinterest": "<string>",
"social_media_twitter": "<string>"
}
Code language: JSON / JSON with Comments (json)
Privacy Policy Data
To get privacy policy data via API, the URL structure is:
/wp-json/impressum-plus/v1/privacy/<option>
Code language: Bash (bash)
<option>
can be one of the following strings:
all
– Returns all available values of the privacy policycookie_usage
– Returns 1 if cookies are usedlogfile_days
– Returns the amount of days the server logs are storedlogfile_ip_shortening
– Returns 1 if IP addresses in the server logs are shortenedcontact_form_usage
– Returns 1 if contact forms are usedcomment_usage
– Returns 1 if comments are usedcomment_subscription_usage
– Returns 1 if you can subscribe to commentsshop_usage
– Returns 1 if a shop system is usedcontract_usage
– Returns 1 if contracts are closed via the websitegoogle_analytics_usage
– Returns 1 if Google Analytics is usedgoogle_analytics_id
– Returns the Google Analytics IDgoogle_analytics_anonymize_ip
– Returns 1 if IP addresses are anonymized before sending them to Google Analyticsgoogle_analytics_remarketing_usage
– Returns 1 if Google Analytics Remarketing is usedgoogle_ads_usage
– Returns 1 if Google Ads is usedgoogle_adsense_usage
– Returns 1 if Google AdSense is usedgoogle_maps_usage
– Returns 1 if Google Maps is usedgoogle_fonts_usage
– Returns 1 if Google Fonts is usedmatomo_usage
– Returns 1 if Matomo is usedmatomo_url
– Returns the URL to the Matomo instancematomo_eu_server
– Returns 1 if Matomo is hosted inside the EUmatomo_anonymize_ip
– Returns 1 if IP addresses are anonymized within Matomofacebook_pixel_usage
– Returns 1 if the Facebook Pixel is usedad_tracking_usage
– Returns 1 if ads with tracking are usedad_tracking_text
– Returns the text for tracking adsapplicant_form_usage
– Returns 1 if forms for job applications are usedprofiling_usage
– Returns 1 if profiling is usedhealth_data_usage
– Returns 1 if health data are being collectedfacebook_social_sharing_usage
– Returns 1 if a Facebook social integration is usedpinterest_social_sharing_usage
– Returns 1 if a Pinterest social integration is usedtwitter_social_sharing_usage
– Returns 1 if a Twitter social integration is usedtumblr_social_sharing_usage
– Returns 1 if a Tumblr social integration is usednewsletter_usage
– Returns 1 if a newsletter system is usednewsletter_external_usage
– Returns the external newsletter provider, if any, ornone
newsletter_tracking_usage
– Returns 1 if the newsletter system uses trackingamazon_partner_usage
– Returns 1 if Amazon partner links are used
Example:
{
"cookie_usage": "<string>",
"logfile_days": "<string>",
"logfile_ip_shortening": "<string>",
"contact_form_usage": "<string>",
"comment_usage": "<string>",
"comment_subscription_usage": "<string>",
"shop_usage": "<string>",
"contract_usage": "<string>",
"google_analytics_usage": "<string>",
"google_analytics_id": "<string>",
"google_analytics_anonymize_ip": "<string>",
"google_analytics_remarketing_usage": "<string>",
"google_ads_usage": "<string>",
"google_adsense_usage": "<string>",
"google_maps_usage": "<string>",
"google_fonts_usage": "<string>",
"matomo_usage": "<string>",
"matomo_url": "<string>",
"matomo_eu_server": "<string>",
"matomo_anonymize_ip": "<string>",
"facebook_pixel_usage": "<string>",
"ad_tracking_usage": "<string>",
"ad_tracking_text": "<string>",
"applicant_form_usage": "<string>",
"profiling_usage": "<string>",
"health_data_usage": "<string>",
"facebook_social_sharing_usage": "<string>",
"pinterest_social_sharing_usage": "<string>",
"twitter_social_sharing_usage": "<string>",
"tumblr_social_sharing_usage": "<string>",
"newsletter_usage": "<string>",
"newsletter_external_usage": "<string>",
"newsletter_tracking_usage": "<string>",
"amazon_partner_usage": "<string>"
}
Code language: JSON / JSON with Comments (json)
POST Requests
Imprint Data
To change imprint data via API, the URL structure is the following:
/wp-json/impressum-plus/v1/options
Code language: Bash (bash)
Example:
curl -d "country=deu&legal_entity=self" -H "Content-Type: application/x-www-form-urlencoded" -H "Authorization: Basic QmVudXR6ZXJuYW1lOlBhc3N3b3J0" -X POST https://domain.tld/wp-json/impressum-plus/v1/options
Code language: Bash (bash)
As response you’ll receive a JSON string with the stored imprint data.
Imprint Titles
since Version 2.3.0
To change imprint titles via API, the URL structure is the following:
/wp-json/impressum-plus/v1/titles
Code language: Bash (bash)
Example:
curl -d "name=Individual+Name&address=My+Address" -H "Content-Type: application/x-www-form-urlencoded" -H "Authorization: Basic QmVudXR6ZXJuYW1lOlBhc3N3b3J0" -X POST https://domain.tld/wp-json/impressum-plus/v1/options
Code language: Bash (bash)
As response you’ll receive a JSON string with the stored imprint metadata.
{
"name": {
"name": "Individual Name"
},
"address": {
"name": "My Address"
}
}
Code language: JSON / JSON with Comments (json)
Privacy Policy Data
To change privacy policy data via API, the URL structure is the following:
/wp-json/impressum-plus/v1/privacy
Code language: Bash (bash)
Example:
curl -d "cookie_usage=1" -H "Content-Type: application/x-www-form-urlencoded" -H "Authorization: Basic QmVudXR6ZXJuYW1lOlBhc3N3b3J0" -X POST https://domain.tld/wp-json/impressum-plus/v1/privacy
Code language: Bash (bash)
As response you’ll receive a JSON string with the stored privacy policy data.
Server Requirements
Apache2
For Apache2, Impressum Plus already provides a functional .htaccess
content:
SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
Code language: JavaScript (javascript)
If you want to, you can also disable it.
nginx
You need to pass the following content in the global $_SERVER
variable (for instance via PHP-FPM):
$_SERVER['HTTP_AUTHORIZATION']
$_SERVER['REDIRECT_HTTP_AUTHORIZATION']
$_SERVER['PHP_AUTH_USER']
und $_SERVER['PHP_AUTH_PW']
Example configration of the FastCGI parameters:
location ~ (?U)\.php(/.*$|$) {
fastcgi_split_path_info ^((?U).+\.php)(/.+)?$;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
fastcgi_param PHP_AUTH_USER $remote_user if_not_empty;
fastcgi_param PHP_AUTH_PW $http_authorization if_not_empty;
fastcgi_param HTTPS $https if_not_empty;
# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
if (!-e $document_root$fastcgi_script_name) {
return 404;
}
fastcgi_read_timeout 300;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
}
Code language: Nginx (nginx)