1. Home
  2. Knowledge Base
  3. REST API
  4. API Basics – REST API

API Basics – REST API

To get started, the owner of an account must first generate a new API key from the website.
Settings > Account > API Key

Libib rate limits requests to the API. Currently you may hit the API once every 2 seconds.

In the basic sample code below, you would replace YOUR_API_KEY and YOUR_API_USER with the generated user id and API key from your account.

All sample code will be in PHP.

The code below doesn’t do very much, but it will allow you to test the connection and confirm access.

<?php
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.libib.com",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_CONNECTTIMEOUT => 5,
  CURLOPT_TIMEOUT => 15,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "x-api-key: YOUR_API_KEY",
    "x-api-user: YOUR_API_USER"
  ),
));

$response = curl_exec($curl);
$http_code = curl_getinfo($curl, CURLINFO_HTTP_CODE);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  // Valid responses are always in JSON, so we convert to an object here.
  $obj = json_decode($response);
}
If you are developing for our Multi-account “Ultimate” version of Libib, there are slightly different authentication requirements, which are explained in detail on the Ultimate Dashboard API page.

You must include 3 x-api-* variables to authenticate:
x-api-ultimate is the ULTIMATE API ID.
x-api-key is the ULTIMATE API KEY.
x-api-user is the account API ID which you will be making changes to.
Updated on October 21, 2024
Was this article helpful?

Related Articles