API Calls
API Structure
AlphaTouch API Calls pass data in three different methods:
1. URL Parameters:

These are parameters sent within the URL itself. Essentially each call you make will have a different URL as its endpoint, depending on what you are trying to do.

Base API URL:
https://www.alphatouch.info/v1
API URL Format:
https://www.alphatouch.info/v1/object/action/[param1]/[param2] ...
/* Example URL To fetch a list of system administrators. */
$url = 'https://www.alphatouch.info/v1/administrator/list'; 

/* Example URL To fetch a specific resident by their ID.  */
$url = 'https://www.alphatouch.info/v1/resident/get/RESIDENT_ID';    
2. Header Parameters:

These are parameters sent via the header of the request. Essentially only the API Key is sent through the Header Parameters.

curl_setopt($ch, CURLOPT_HTTPHEADER, array (
    "api-key: UNIQUE_API_KEY"
    "accept: application/json",
));
3. POST Parameters:

In some cases, large amounts of data need to be sent to the API in relation to the action taken. For example, if you are updating an entity, you'd pass the entity data through the POST parameters as JSON.

curl_setopt($ch, CURLOPT_POSTFIELDS, {"title":"New Panel Title"});
curl_setopt($ch, CURLOPT_POST, 1);
Sandboxing

The Objects & APIs pages within this documentation each have a sandboxing area where you can explore the API Calls provided for them. You can also select the installation you are working with in these sandboxing areas.

Each installation is also equipped with a sandboxing area where you can explore all of the various API Calls using the Installation's Data.

Please Login to View Links for your Installation Sandboxes

Full Example

Below is a PHP example that utilizes all three parameter types.

Please view the SANDBOX area of the API Settings in your installation(s) for examples in other programming languages.

/////////////////////////////////////////////////////////////////////
// INITIALIZE REQUEST AND SET URL PARAMETERS
/////////////////////////////////////////////////////////////////////
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://www.alphatouch.info/v1/panel/update/PANEL_ID");

/////////////////////////////////////////////////////////////////////
// SET HEADER PARAMETERS
/////////////////////////////////////////////////////////////////////
curl_setopt($ch, CURLOPT_HTTPHEADER, array (
    "api-key: UNIQUE_API_KEY",
    "accept: application/json"
));  

/////////////////////////////////////////////////////////////////////
// SET POST DATA
/////////////////////////////////////////////////////////////////////
curl_setopt($ch, CURLOPT_POSTFIELDS, {"title":"New Panel Title"});
curl_setopt($ch, CURLOPT_POST, 1);

/////////////////////////////////////////////////////////////////////
// FETCH AND PROCESS RETURNED DATA
/////////////////////////////////////////////////////////////////////
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
curl_close($ch);
Success Response

Below is an example of a success response. It consists of 3 top-level objects.

  1. success: Boolean value which is always true for success responses
  2. data: Object containing the requested payload
  3. meta: Object containing information about the request/response itself such as result time and request/server IP Addresses
{
    "data": {
        "admin_type": "admin",
        "email": "fakeadmin@alphatouch.info",
        "email_id": 4530,
        "id": "admin_4530",
        "profile_photo": "https://www.alphatouch.info/user_photos/profile_blank.jpg",
        "title": "Fake Admin"
    },
    "meta": {
        "remote_address": "000.000.000.000",
        "local_address": "111.111.111.111",
        "result_time": 0.084688901901245
    },
    "success": true
}
Error Response

Below is an example of a success response. It consists of 2 top-level objects.

  1. success: Boolean value which is always false for error responses
  2. error: Object containing information about the error
{
    "error": {
        "description": "IP Address 123.123.123.123 not Whitelisted"
    },
    "success": false
}

Copyright© 2018-2024 Alpha Communications. All rights reserved.
Amazon, Echo, Alexa, and all related logos are trademarks of Amazon.com, Inc. or its affiliates.
Google LLC All rights reserved. Google and the Google logo are registered trademarks of Google LLC.