1. Home
  2. Docs
  3. Beaver Builder Templates Inserter
  4. How To Make an API Call

How To Make an API Call

When you have opened the plugin code, please navigate to admin > Settings > Templates > Clients.

How To Make an API Call via JWT Auth

Here is an example of API call with JWT Auth

$tokenArgs = array(
    ‘iss’ => trim( esc_url_raw( get_home_url() ) ),
    ‘data’ => array(
        ‘client’ => array(
            ‘public_id’     => $public_key,
            ‘page_slug’     => ‘WaaSTest’,
            ‘site_id’       =>  1,
            ‘template_id’   =>  6,
            ‘template_type’ => ‘core’,
            ‘action’        => 1
        ),
    )
);

$token = Token::encode( apply_filters( ‘template_hero_auth_token_before_sign’, $tokenArgs ), trim( $private_key ) );

EndPoint for JWT Auth : https://xyz.com/wp-json/waashero/v0/bb-templatesinsert

Response Call: $url = ‘http://testsite2.local/wp-json/waashero/v0/bb-templatesinsert-nocheck‘;
$response  = wp_remote_post( $url, [
    ‘timeout’ => 70,
    ‘body’    => $body_args,

How To Make an API Call without JWT Auth

Here is an example of API call without JWT Auth

$tokenArgs = array(
    ‘iss’ => trim( esc_url_raw( get_home_url() ) ),
    ‘data’ => array(
        ‘page_slug’     => ‘WaaSTest’,
        ‘site_id’       =>  1,
        ‘template_id’   =>  6,
        ‘template_type’ => ‘core’,
        ‘action’        => 1 
    )
);

Endpoint for without JWT Auth
https://xyz.com/wp-json/waashero/v0/bb-templatesinsert-nocheck

Response Call: $url = ‘http://testsite2.local/wp-json/waashero/v0/bb-templatesinsert-nocheck‘;
$response  = wp_remote_post( $url, [
    ‘timeout’ => 70,
    ‘body’    => $body_args,

Was this article helpful to you? Yes No

How can we help?