POST /managers – REST API

Create a Manager: POST /managers

Create a completely new manager in the account. Must have open manager seats for this method to succeed.

URL Parameters
Values should be paramaterized such as using http_build_query() as per example below. All field are required.

  • first_name: REQUIRED – Manager’s first name.
  • last_name: REQUIRED – Manager’s last name.
  • email: REQUIRED – Manager’s email, must be unique.
  • username: REQUIRED – Manager’s username, must be unique. Will be part of the published library URL. Alphanumeric only, 2-15 characters, no spaces.
  • password: REQUIRED – Manager’s password. Minimum 8 characters.
  • role: REQUIRED – Manager’s role in the account. If assigned as a basic manager, library assignment must be completed by the account owner using the website. Allowed values: admin, basic

JSON Result Details
Password is never returned in result set.

  • first_name: Manager’s first name.
  • last_name: Manager’s last name.
  • email: Manager’s email.
  • username: Manager’s username.
  • role: The managerial role for this user.
<?php
$curl = curl_init();

$params = array(
  'first_name' => 'Scott',
  'last_name' => 'Pilgrim',
  'email' => 'sbobomb@example.com',
  'username' => 'spilgrim1',
  'password' => 'aqbq340as94ikd242ffp',
  'role' => 'admin'
);

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

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  $obj = json_decode($response);
}
{
    "first_name": "Scott",
    "last_name": "Pilgrim",
    "email": "sbobomb@example.com",
    "username": "spilgrim1",
    "role": "admin"
}

Was this article helpful?

Related Articles