Maximize Your WordPress Experience with WP Ultimo API Integration

Authentication

The endpoint is https://yourdomain.com/wp-json/wu/v2/auth

In order to authenticate, you need to have use Authorization : Basic <base64 apikey:apisecret>

What this means is you need to run base64_encode to generate the strings.

$string = base64_encode(“[apikey]:[apisecret]”);

Then replace <base64 apikey:apisecret> with $string.

In curl

curl --location 'https://gtmanga.com/wp-json/wu/v2/auth' \
--header 'Authorization: Basic [string here]' \
--header 'Accept: application/json' \
--data ''

In PHP

<?php

$curl = curl_init();
$string = base64_encode("[apikey]:[apisecret]");
curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://yourdomain.com/wp-json/wu/v2/auth',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'Authorization: Basic '.$string,
    'Accept: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

Similar Posts