Home Making an API Request

Making an API Request

   BM :: Platform

Making a Request

All requests are posted to an API endpoint with a BeliefMedia API Key and API Secret. In some cases, either key may have an expiry date.

The Requests library , available from Github, is required. It is used by default in WordPress (since version 4.6) so the WP plugin doesn’t require its inclusion. If used outside of WordPress, remove the $options = get_option('beliefmedia_admin'); line and replace with your own keys.

The beliefmedia_post() function below returns an array of data from our system. It will return false on failure.

Basic encryption is applied to the query data supplied to us. The common function below is not a bullet proof means of data protection but it’s more than suitable for our application. The secret key (which is not transported) is used to restore the JSON string on our end.

The secret key is used on both ends to unwrap responses. It should never be shared.


  • All requests must be made to the https: domain. Any non-secure URL will not provide a response after January 14th, 2019.