Users

Create a new user

POST /api/users/create
Query Parameters
  • fullname (string) – Client’s Full Name

  • email (string) – Client’s Email address

  • notify (boolean) – 1 = Client will receive an email with login information

Example request:

cURL

curl \
-X POST \
-H 'Token: <token>' https://demo.helpdeskz.com/api/users/ \
-F 'fullname="John Doe"' \
-F 'email="john.doe@demo.com"' \
-F 'notify="0"'

PHP

<?php
$curl = curl_init();
curl_setopt_array($curl, array(
  CURLOPT_URL => 'http://helpdeskz.web/api/users/create',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS => array('fullname' => 'John Doe','email' => 'john.doe@demo.com','notify' => '1'),
  CURLOPT_HTTPHEADER => array(
    'Token: <token>'
  ),
));
$response = curl_exec($curl);
curl_close($curl);

Example response:

{
    "success": 1,
    "user_id": 1,
    "message": "User account was created."
}

Retrieve a list of all users

GET /api/users/
Query Parameters
  • email (string) – Find a client by email

  • page (numeric) – Page query is used to view next page

Example request:

cURL

curl \
-H 'Token: <token>' https://demo.helpdeskz.com/api/users

PHP

<?php
$curl = curl_init();
curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://demo.helpdeskz.com/api/users',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'Token: <token>'
  ),
));
$response = curl_exec($curl);
curl_close($curl);

Example response:

{
    "success": 1,
    "total_users": 2,
    "total_pages": 1,
    "users": [
        {
            "id": "2",
            "fullname": "John Doe",
            "email": "john.doe@demo.com"
        },
        {
            "id": "1",
            "fullname": "John Doe",
            "email": "john.doe123@demo.com"
        }
    ]
}

Retrieve details of user by ID

GET /api/users/show/<user_id>

Example request:

cURL

curl \
-H 'Token: <token>' https://demo.helpdeskz.com/api/users/show/1

PHP

<?php
$curl = curl_init();
curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://demo.helpdeskz.com/api/users/show/1',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'Token: <token>'
  ),
));
$response = curl_exec($curl);
curl_close($curl);

Example response:

{
    "success": 1,
    "user_data": {
        "id": "1",
        "fullname": "John Doe",
        "email": "john.doe@demo.com"
    }
}

Update user account

POST /api/users/update/<user_id>
Query Parameters
  • new_email (string) – New client’s email address

Example request:

cURL

curl \
-X POST \
-H 'Token: <token>' https://demo.helpdeskz.com/api/users/update/1 \
-F 'new_email="john.doe123@demo.com"'

PHP

<?php
$curl = curl_init();
curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://demo.helpdeskz.com/api/users/update/1',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS => array('new_email' => 'john.doe123@demo.com'),
  CURLOPT_HTTPHEADER => array(
    'Token: <token>'
  ),
));
$response = curl_exec($curl);
curl_close($curl);

Example response:

{
    "success": 1,
    "message": "Email was changed."
}

Delete user account

POST /api/users/delete/<user_id>

Example request:

cURL

curl \
-X POST \
-H 'Token: <token>' https://demo.helpdeskz.com/api/users/delete/1

PHP

<?php
$curl = curl_init();
curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://demo.helpdeskz.com/api/users/delete/1',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_HTTPHEADER => array(
    'Token: <token>'
  ),
));
$response = curl_exec($curl);
curl_close($curl);

Example response:

{
    "success": 1,
    "message": "Account was removed."
}