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 imprint
  • country – Returns the country
  • legal_entity – Returns the legal entity
  • name – Returns the name
  • address – Returns the address
  • address_alternative – Returns the alternative address
  • email – Returns the email address
  • phone – Returns the phone number
  • fax – Returns the fax number
  • press_law_person – Returns the responsible person for the content
  • vat_id – Returns the VAT ID
  • coverage – Returns the coverage
  • free_text – Returns the free text field
  • inspecting_authority – Returns the inspecting authority
  • register – Returns the register
  • business_id – Returns the business ID
  • representative – Returns the representative(s)
  • capital_stock – Returns the capital stock
  • pending_deposits – Returns the pending deposits
  • professional_association – Returns the professional association
  • legal_job_title – Returns the legal job title
  • professional_regulations – Returns the professional regulations
  • press_law_checkbox – Returns 1 if journalistic/editorial content is available
  • data_protection_officer_name – Returns the name of the data protection officer
  • data_protection_officer_address – Returns the address of the data protection officer
  • data_protection_officer_email – Returns the email address of the data protection officer
  • data_protection_officer_phone – Returns the phone number of the data protection officer
  • social_media_facebook – Returns the Facebook profile URL
  • social_media_instagram – Returns the Instagram profile URL
  • social_media_pinterest – Returns the Pinterest profile URL
  • social_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 policy
  • cookie_usage – Returns 1 if cookies are used
  • logfile_days – Returns the amount of days the server logs are stored
  • logfile_ip_shortening – Returns 1 if IP addresses in the server logs are shortened
  • contact_form_usage – Returns 1 if contact forms are used
  • comment_usage – Returns 1 if comments are used
  • comment_subscription_usage – Returns 1 if you can subscribe to comments
  • shop_usage – Returns 1 if a shop system is used
  • contract_usage – Returns 1 if contracts are closed via the website
  • google_analytics_usage – Returns 1 if Google Analytics is used
  • google_analytics_id – Returns the Google Analytics ID
  • google_analytics_anonymize_ip – Returns 1 if IP addresses are anonymized before sending them to Google Analytics
  • google_analytics_remarketing_usage – Returns 1 if Google Analytics Remarketing is used
  • google_ads_usage – Returns 1 if Google Ads is used
  • google_adsense_usage – Returns 1 if Google AdSense is used
  • google_maps_usage – Returns 1 if Google Maps is used
  • google_fonts_usage – Returns 1 if Google Fonts is used
  • matomo_usage – Returns 1 if Matomo is used
  • matomo_url – Returns the URL to the Matomo instance
  • matomo_eu_server – Returns 1 if Matomo is hosted inside the EU
  • matomo_anonymize_ip – Returns 1 if IP addresses are anonymized within Matomo
  • facebook_pixel_usage – Returns 1 if the Facebook Pixel is used
  • ad_tracking_usage – Returns 1 if ads with tracking are used
  • ad_tracking_text – Returns the text for tracking ads
  • applicant_form_usage – Returns 1 if forms for job applications are used
  • profiling_usage – Returns 1 if profiling is used
  • health_data_usage – Returns 1 if health data are being collected
  • facebook_social_sharing_usage – Returns 1 if a Facebook social integration is used
  • pinterest_social_sharing_usage – Returns 1 if a Pinterest social integration is used
  • twitter_social_sharing_usage – Returns 1 if a Twitter social integration is used
  • tumblr_social_sharing_usage – Returns 1 if a Tumblr social integration is used
  • newsletter_usage – Returns 1 if a newsletter system is used
  • newsletter_external_usage – Returns the external newsletter provider, if any, or none
  • newsletter_tracking_usage – Returns 1 if the newsletter system uses tracking
  • amazon_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; fastcgi_param PHP_AUTH_PW $http_authorization; fastcgi_param HTTPS $https; # 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)