API CLIENT FOR WORDPRESS GUIDE

Configuring The Catenis API Client for WordPress

The Catenis API Client can be configured at the WordPress Site level (called  global settings) so it can be easily loaded on any WordPress page to share the same virtual device across pages. Alternatively, it can be configured at the page specific level.  This allows you to use different Catenis Virtual devices on different WordPress pages. A step by step guide of each configuration is below.

WordPress Site Level Configuration

Image Description
  1. Navigate to your WordPress dashboard, then click on “Settings” in your left-hand Navbar. This will expand the settings section. 
  2. Click on the “Catenis API Client” link and you will be presented with the Catenis API Client site-level settings page.
Site Level WordPress API Client Configuration
  1. In the “Device ID” field Enter your virtual device ID.
  2. In the “API Access Secret” field enter your API access secret.
  3. In the “Host” field enter the hostname as “catenis.io”.
  4. In the “Environment” field select “Sandbox” for accounts that use the Bitcoin testnet for development or choose production for paid accounts that use the production Bitcoin blockchain.
  5. The “Secure Connection” field should always be set to “On”. It ensures communication between your WordPress site and that the Catenis APIs travel securely over HTTPS.
  6. In the “Compression Threshold” field you can set a minimum amount of bytes before catenis starts to compress the content being transmitted. Leaving this field blank is recommended as the minimum threshold is already set to 1024 bytes. Compressing smaller amounts of data can have the reverse effect and create a larger data payload. 
  7. Click ”Save Settings” to make sure your information is saved.

Using The Site Level Configuration

Create a new WordPress page. After creating a new page you will be presented with a checkbox that allows you to load the Catenis API Client on that page.

Site Level WordPress API Client Configuration
  1. Tick off the checkbox that says “Load Catenis API Client”.  Make sure to leave all other fields blank if you want to use the site level global configuration you previously set up.

Now you can use any plugin or Gutenberg Block that allows you to write javascript and HTML code and place it on the page to interact with the Catenis APIs. Once enabled, a global JavaScript variable named ctnApiProxy is made available on the page. That variable holds an object that functions as a proxy to the instantiated Catenis API client.

Use the ctnApiProxy variable to call the Catenis Enterprise API methods by invoking the corresponding method on that object.

For a reference of all of the available methods, please refer to the Catenis API JavaScript Client as it is functionally identical to the Catenis API Client for WordPress, except for notifications support and error handling.

WordPress Page Level Configuration

You can choose to have a different Catenis virtual device configured for each individual page instead of using the site level configuration. After creating a new WordPress page you will be presented with a checkbox that allows you to load the Catenis API Client on that page. You are required to fill out the Client Credentials and Client options section if you want to load the page-level configuration.

Site Level WordPress API Client Configuration
  1. Tick off the checkbox that says “Load Catenis API Client”. This will load the client side Catenis library and store your Virtual device credentials server-side. 
  2. Click the enter Credentials link to expand the credentials box.
Site Level WordPress API Client Configuration
  1. In the “Device ID” field Enter your virtual device ID.
  2. In the “API Access Secret” field enter your API access secret.
  3. In the “Host” field enter the hostname as “catenis.io”.
  4. In the “Environment” field select “Sandbox” for accounts that use the Bitcoin testnet for development or choose “production” for paid accounts that use the production Bitcoin blockchain.
  5. The “Secure Connection” field should always be set to “On”.It ensures communication between your WordPress site and that the Catenis APIs travel securely over HTTPS.
  6. In the “Compression Threshold” field you can set a minimum amount of bytes before catenis starts to compress the content being transmitted. Leaving this field blank is recommended as the minimum threshold is already set to 1024 bytes. Compressing smaller amounts of data can have the reverse effect and create a larger data payload.

Publish your page and the JavaScript code you have written to make use of the Catenis API, which will now use the page level device configuration. Once enabled, a global JavaScript variable named ctnApiProxy is made available on the page. That variable holds an object that functions as a proxy to the instantiated Catenis API client.

Use the ctnApiProxy variable to call the Catenis Enterprise API methods by invoking the corresponding method on that object.

For a reference of all of the available methods, please refer to the Catenis API JavaScript Client as it is functionally identical to the Catenis API Client for WordPress, except for notifications support and error handling.

Note: You can set the global site-level configuration virtual device configuration and have different pages set with different page-level configurations at the same time. Each page can only use one configuration.

Related Articles

CompanyElement_SM_LightBackgrounds
How can we make things Better for you?
  • Accepted file types: jpg, gif, png, pdf.
  • This field is for validation purposes and should be left unchanged.