API Guide

Prepared by:
Andrew Madison, Founder and CEO
Document date:
May 05, 2014
Document number:
20140505-­02
Software version:
1.0.0

Table of Contents:

  1. Introduction
    1. First step
    2. The basics
    3. Testing
  2. API Functions
    1. Authentication
    2. Methods
    3. Function list
    4. Company
    5. Users
    6. Files
    7. Templates
    8. Datacenters
    9. Devices
    10. Tickets

Introduction

The InfraTrack Application Programming Interface (API) is a set of methods that are exposed via HTTP or HTTPS. Those methods allow a programmer to develop a User Interface to facilitate the transfer of data between a client and the API server and underlying data storage (database).

Using the API, a developer will be able to:

In this document, you will learn about implemented standards, communication methods, interaction with the API and requirements.

First step

Before you can begin developing against the InfraTrack API, you will need to sign up for a 30 day trial at infra-track.com

Signing up is easy, free and does not require any commitment. We encourage everyone to use our API and learn more about its capabilities, ease of use and flexible standards.

Once your signup process is complete, you will receive information on how to connect to the API server. A 30 day license and administrative account will be provided together with this document.

At this point you may also chose to use our free InfraTrack Web portal application (free download at infra-track.com) or to develop your own interface. Latest documentation for InfraTrack Web portal application is available at here

If you decide to develop your own user interface, this document will help you understand the API functionality and capabilities.

The basics

InfraTrack API is based on one simple concept: a variable is defined by a name and a value. With this in mind the development process becomes very easy as long as all rules explained in this document are followed.

For ease of interaction and to preserve network bandwidth especially from mobile devices, we developed the API interface using JSON (JavaScript Object Notation) messages. While JSON is a very popular and light weight language, it also presents some challenges when transferring binary and large text streams. Those challenges and workarounds will be presented below.

Sample request

All requests must include a header authentication set of parameters and a data section which includes all required values for the function.

curl \
-H "Accept: application/json" \
-H "Content-type: application/json" \
-H "auth_head_user_name: your_username" \
-H "auth_head_password: your_password" \
-H "auth_head_company_id: a8c66258-2467-4c83-79ab-24671f4556cb" \
-d '{"company_id": "a8c66258-2467-4c83-79ab-24671f4556cb"}' \
https://sapi.infra-track.com:18892/company \
-X POST

Sample response

Object responses are returned as 2 parameters:

Example:

{
    "key": "a8c66258-2467-4c83-79ab-24671f4556cb",
    "property_list": [
        {
            "prop_name": "company_name",
            "prop_value": "Demo Company"
        },
...
        {
            "prop_name": "timezone",
            "prop_value": "America/Phoenix"
        }
    ]
}

List requests are being returned as arrays of item_list objects whereas above, each object has a key and property_list array.

Example:

{
    "item_list": [
    {
        "key": "92b65e76-b0ce-413f-ad36-7915522c3b74",
        "property_list": [
            {
                "prop_name": "active_yn",
                "prop_value": "True"
            },
...
            {
                "prop_name": "template_name",
                "prop_value": "Network Switch"
            }
        ]
    },
...
    {
        "key": "bad472f7-2c35-4af4-a2a3-341aa4aa2191",
        "property_list": [
            {
                "prop_name": "active_yn",
                "prop_value": "True"
            },
...
            {
                "prop_name": "template_name",
                "prop_value": "Storage"
            }
        ]
    }
    ]
}

Sample error

Errors are returned as a 2 parameter object containing the message and status code. Future releases of InfraTrack will contain an error code dictionary where each status value will represent a specific message.

Example:

{
    "message": "user not found",
    "status": 500
}

Default values

4 default values are added to all records regardless of their presence in the original input. The 4 values are:

Testing

This document is focused on interacting with the API using CURL

If other programming languages are to be used (e.g.: Java, .NET, Python), please follow the instructions provided by the framework which supports interaction with Restful Web services.

API Functions

Authentication

InfraTrack API uses 3 factor authentication. The authentication parameters are passed in the header message and must include values:

An example JSON call via CURL would look like:
curl \
-H "Accept: application/json" \
-H "Content-type: application/json" \
-H "auth_head_user_name: your_username" \
-H "auth_head_password: your_password" \
-H "auth_head_company_id: a8c66258-2467-4c83-79ab-24671f4556cb"

In the above example, we are passing header variables using the -H flag as follows:

If the login is invalid, an error message will be returned:

{
    "message": "user not found",
    "status": 500
}

If any of the 3 required parameters are not passed, error messages indicating the missing parameter will be returned.

Missing auth_head_user_name parameter:

Missing auth_head_password parameter:

Missing auth_head_company_id parameter:

Example authentication error message (missing auth_head_user_name parameter):

{
    "message": "'HTTP_AUTH_HEAD_USER_NAME'",
    "status": 500
}

Note:
Authentication headers must be included in all requests to the API server.

Methods

Besides the regular HTTP methods (POST, DELETE, GET and PUT), two custom methods were implemented to support all functionality of the InfraTrack application. The custom methods are LIST and SUM.

The general purpose for each method is:

POSTUpdates or retrieves an object
DELETEDe-activates or removes a object
PUTInserts or updates an object
GETGets a specific object
SUMGets the sum of objects as a int. value
LISTGets a list of a specific object

Function list

Company:

HTTP Method URL:Details:
POST<api_url>:<api_port>/companyLists details about your current company

Users:

HTTP Method URL:Details:
LIST<api_url>:<api_port>/userLists all users in your company
PUT<api_url>:<api_port>/userAds or updates an existing user
GET<api_url>:<api_port>/userGets the profile information for the current logged on user
DELETE<api_url>:<api_port>/userDeactivates a user
POST<api_url>:<api_port>/userRetrieves a user object

Files:

HTTP Method URL:Details:
LIST<api_url>:<api_port>/filesGets a list of files for a particular device or datacenter (no actual binary data will be returned)
PUT<api_url>:<api_port>/filesInserts or updates a file object
GET<api_url>:<api_port>/filesGets file details and binary data
DELETE<api_url>:<api_port>/filesRemoves a file
SUM<api_url>:<api_port>/filesGets a total in bytes of all files stored on the database engine for your company

Templates:

HTTP Method URL:Details:
LIST<api_url>:<api_port>/templatesGets a list of templates
PUT<api_url>:<api_port>/templatesInserts or updates a template object
GET<api_url>:<api_port>/templatesGets a template object
DELETE<api_url>:<api_port>/templatesDeactivates a template

Datacenters:

HTTP Method URL:Details:
LIST<api_url>:<api_port>/datacentersGets a list of datacenter objects
PUT<api_url>:<api_port>/datacentersInserts or updates a datacenter object
GET<api_url>:<api_port>/datacentersGets a datacenter object
DELETE<api_url>:<api_port>/datacentersDeactivates a datacenter

Devices:

HTTP Method URL:Details:
LIST<api_url>:<api_port>/devicesLists all devices in your company
PUT<api_url>:<api_port>/devicesInserts or updates a device
GET<api_url>:<api_port>/devicesRetrieves a device object
DELETE<api_url>:<api_port>/devicesDeactivates a device

Tickets:

HTTP Method URL:Details:
PUT<api_url>:<api_port>/ticketsInserts or updates a ticket for an existing device
LIST<api_url>:<api_port>/ticketsGets a list of tickets for a device

Company

The company module is designed to retrieve licensing, utilization and management information about your company. Given that direct company modifications are not supported, only a "read-only" view function is supported.

Also, a user is only allowed to retrieve information about its own company.

POST method retrieves information about your company. A sample JSON via CURL request would look like:

curl \
-H "Accept: application/json" \
-H "Content-type: application/json" \
-H "auth_head_user_name: your_username" \
-H "auth_head_password: your_password" \
-H "auth_head_company_id: a8c66258-2467-4c83-79ab-24671f4556cb" \
-d '{"company_id": "a8c66258-2467-4c83-79ab-24671f4556cb"}' \
https://sapi.infra-track.com:18892/company \
-X POST

The only mandatory parameter is company_id and must match the auth_header_company_id value.

Users

This module is designed to provide a user management API framework.

POST method retrieves information about a given user id. A sample JSON via CURL request would look like:

curl \
-H "Accept: application/json" \
-H "Content-type: application/json" \
-H "auth_head_user_name: your_username" \
-H "auth_head_password: your_password" \
-H "auth_head_company_id: a8c66258-2467-4c83-79ab-24671f4556cb" \
-d '{"user_id": "eb23cab8-c596-4c41-a14b-c6b5bd07d206"}' \
https://sapi.infra-track.com:18892/user \
-X POST

In this call, we passed a user id value of eb23cab8-c596-4c41-a14b-c6b5bd07d206

In return, we received a standard user object in format:

Passing an invalid user_id will return a "user not found" error.

PUT method ads or updates a user. To add a user, first create a JSON file containing the following elements:

{
  "key": "00000000-0000-0000-0000-000000000000",
  "property_list":
  [
    {"prop_name": "access_level", "prop_value": "MANAGER"},
    {"prop_name": "password", "prop_value": "337cf3ec15ad335759eed1e9a3afd487"},
    {"prop_name": "user_name", "prop_value": "demomanager" }
  ]
}

The only required fields are key, access_level, user_name and password.

To add a user via JSON data file (add_user.json in our example), call CURL command:

curl \
-H "Accept: application/json" \
-H "Content-type: application/json" \
-H "auth_head_user_name: your_username" \
-H "auth_head_password: your_password" \
-H "auth_head_company_id: a8c66258-2467-4c83-79ab-24671f4556cb" \
-d @add_user.json \
https://sapi.infra-track.com:18892/user \
-X PUT

To update an existing user, simply use the same approach as adding a user, but this time by using the real "key" value for the user to be updated.

Notes:
Providing company_id, created_on, created_by, modified_on and modified_by values will be ignored as they are set based on the user requesting the method.
If no active_yn value is provided, the default "True" setting will be used.
Users are bound by the company's purchased "max_users" license. Exceeding the max users value will result in an error when adding a new user or activating previously deactivated users.

DELETE method does not remove an user. Instead, the user status (active_yn) is being set to "False" which disables the user's ability to login and frees one user license. To activate a user, simply use the PUT method with a active_yn property value of True.

Deactivate sample call CURL command:

curl \
-H "Accept: application/json" \
-H "Content-type: application/json" \
-H "auth_head_user_name: your_username" \
-H "auth_head_password: your_password" \
-H "auth_head_company_id: a8c66258-2467-4c83-79ab-24671f4556cb" \
-d '{"user_id": "36c4dcfc-f34a-4727-b614-88c4630620f4"}' \
https://sapi.infra-track.com:18892/user \
-X DELETE

LIST method is designed to return a list of users for a given company. This list is returned as an array of user objects as explained in "Sample Responses" section of this document.

company_id is the only required object to be passed in the list request.

Sample list call CURL command:

curl \
-H "Accept: application/json" \
-H "Content-type: application/json" \
-H "auth_head_user_name: your_username" \
-H "auth_head_password: your_password" \
-H "auth_head_company_id: a8c66258-2467-4c83-79ab-24671f4556cb" \
-d '{"company_id": "a8c66258-2467-4c83-79ab-24671f4556cb"}' \
https://sapi.infra-track.com:18892/user \
-X LIST

GET method's purpose is not to get a specific user's details (POST is used for this purpose) but rather to validate and retrieve a user's information at login time via a GUI.

This function takes no parameters and it only relies on the 3 header authentication parameters that are mandatory in all REST calls.

Sample GET CURL command:

curl \
-H "Accept: application/json" \
-H "Content-type: application/json" \
-H "auth_head_user_name: your_username" \
-H "auth_head_password: your_password" \
-H "auth_head_company_id: a8c66258-2467-4c83-79ab-24671f4556cb" \
https://sapi.infra-track.com:18892/user \
-X GET

Files

LIST method provides functionality for retrieval of files for a given company and device or datacenter.

The following data parameters are required:

Sample LIST CURL command:

curl \
-H "Accept: application/json" \
-H "Content-type: application/json" \
-H "auth_head_user_name: your_username" \
-H "auth_head_password: your_password" \
-H "auth_head_company_id: a8c66258-2467-4c83-79ab-24671f4556cb" \
-d '{"company_id": "a8c66258-2467-4c83-79ab-24671f4556cb","file_class": "DATACENTER", "class_id": "892f596a-87c0-4f27-8c28-f5b283b6c4c8"}' \
https://sapi.infra-track.com:18892/files -X LIST
If no records are found, an empty properly list array will be returned:
{
    "item_list": []
}

Otherwise, an array of file objects will be returned.

Note:
To preserve bandwidth, no file binary data is returned in the list. To retrieve the actual data for a file, use the GET method.

PUT method is designed to add a new file or update an existing file. Like the user PUT method, a new file addition will require a key with value 00000000-0000-0000-0000-000000000000 while a update will require the actual file key identifier. All binary file data must be converted to base64 before upload. Failing to do so may result in API errors due to unexpected line breaks especially in ASCII text files.

Generate the base64 string of a file with command (openssl must be installed) and also capture the file's mime type:

cat myfile.ext | openssl base64 -e
file -b --mime-type myfile.ext

Use the resulting string to generate a .JSON file (add_file.json) with content:

{
  "key": "00000000-0000-0000-0000-000000000000", 
  "property_list": [ 
    { "prop_name": "class_id", "prop_value": "892f596a-87c0-4f27-8c28-f5b283b6c4c8" }, 
    { "prop_name": "company_id", "prop_value": "a8c66258-2467-4c83-79ab-24671f4556cb" }, 
    { "prop_name": "file_class", "prop_value": "DATACENTER" }, 
    { "prop_name": "file_data", "prop_value": "OEJQUwABAAAA ... QCBAIEA=" },
    { "prop_name": "file_type", "prop_value": "application/pdf"},
    { "prop_name": "file_description", "prop_value": "Test file" }, 
    { "prop_name": "file_item", "prop_value": "Testing" }, 
    { "prop_name": "file_name", "prop_value": "test01.ext" }
  ] 
}

Now, pass the created JSON file to the API using command:

curl \
-H "Accept: application/json" \
-H "Content-type: application/json" \
-H "auth_head_user_name: your_username" \
-H "auth_head_password: your_password" \
-H "auth_head_company_id: a8c66258-2467-4c83-79ab-24671f4556cb" \
-d @add_file.json \
https://sapi.infra-track.com:18892/files \
-X PUT

Upon successful addition of the file, a file object will be returned including the new key value and file_data base64 encoded binary stream.

To update an existing file, use the same process as above but this time by using the actual key value for the file to be updated.

GET method purpose is for retrieval of existing files. The only required parameter is file_id.

This will retrieve the full file information including the base64 encoded binary stream (file_data variable).

curl \
-H "Accept: application/json" \
-H "Content-type: application/json" \
-H "auth_head_user_name: your_username" \
-H "auth_head_password: your_password" \
-H "auth_head_company_id: a8c66258-2467-4c83-79ab-24671f4556cb" \
-d '{"file_id": "6a6c5b69-3f63-426c-9d76-1f6fc99b1697"}' \
https://sapi.infra-track.com:18892/files \
-X GET

DELETE method will permanently remove a file from the database. The only required parameter is file_id.

Sample DETELE CURL command:

curl \
-H "Accept: application/json" \
-H "Content-type: application/json" \
-H "auth_head_user_name: your_username" \
-H "auth_head_password: your_password" \
-H "auth_head_company_id: a8c66258-2467-4c83-79ab-24671f4556cb" \
-d '{"file_id": "6a6c5b69-3f63-426c-9d76-1f6fc99b1697"}' \
https://sapi.infra-track.com:18892/files \
-X DELETE

Given that the file record is permanently removed, no JSON data is being returned after this action.

SUM method is mostly a reporting function that returns the bytes sum of all files associated with your company.

Sample SUM CURL command:

curl \
-H "Accept: application/json" \
-H "Content-type: application/json" \
-H "auth_head_user_name: your_username" \
-H "auth_head_password: your_password" \
-H "auth_head_company_id: a8c66258-2467-4c83-79ab-24671f4556cb" \
https://sapi.infra-track.com:18892/files \
-X SUM

The return parameter is a simple object with parameter "size" and represents the total used storage in bytes.

Example:

{"size":"131493"}

Templates

LIST method retrieves a list of templates. By default, 4 templates are included in all new deployments:

The following data parameter is required:

Call the LIST method using CURL command:

curl \
-H "Accept: application/json" \
-H "Content-type: application/json" \
-H "auth_head_user_name: your_username" \
-H "auth_head_password: your_password" \
-H "auth_head_company_id: a8c66258-2467-4c83-79ab-24671f4556cb" \
-d '{"company_id": "a8c66258-2467-4c83-79ab-24671f4556cb"}' \
https://sapi.infra-track.com:18892/templates \
-X LIST

An array of template objects will be returned.

Note:
Template code will be returned as a base64 encoded string.

PUT method is designed to add or update an existing template. At a minimum, the following parameters are required to add a new template:

Also note that template code and template name must be unique values. Also, the status of an existing template cannot be changed to False if the template is used in existing devices.

Start by generating a JSON file with content:

{
"key": "00000000-0000-0000-0000-000000000000",
    "property_list": [
        {
            "prop_name": "active_yn",
            "prop_value": "True"
        },
        {
            "prop_name": "template_code",
            "prop_value": "PD94 . . . ZXQ+"
        },
        {
            "prop_name": "template_name",
            "prop_value": "Test01"
        }
    ]
}

Save the file as add_template.json and load it using command:

curl \
-H "Accept: application/json" \
-H "Content-type: application/json" \
-H "auth_head_user_name: your_username" \
-H "auth_head_password: your_password" \
-H "auth_head_company_id: a8c66258-2467-4c83-79ab-24671f4556cb" \
-d @add_template.json \
https://sapi.infra-track.com:18892/templates \
-X PUT

Upon successful submission, a template object will be returned. Follow the same process to update an existing template, this time by using a valid key value.

GET method will retrieve the template object for a given key.

Required parameter:

Sample GET CURL request:

curl \
-H "Accept: application/json" \
-H "Content-type: application/json" \
-H "auth_head_user_name: your_username" \
-H "auth_head_password: your_password" \
-H "auth_head_company_id: a8c66258-2467-4c83-79ab-24671f4556cb" \
-d '{"template_id": "f5685102-2e32-403b-af8b-48ec8d3661a1"}' \
https://sapi.infra-track.com:18892/templates \
-X GET

DELETE method is a method that deactivates an existing template. Note that templates which are in use by devices cannot be deactivated.

Sample DELETE CURL request:

curl \
-H "Accept: application/json" \
-H "Content-type: application/json" \
-H "auth_head_user_name: your_username" \
-H "auth_head_password: your_password" \
-H "auth_head_company_id: a8c66258-2467-4c83-79ab-24671f4556cb" \
-d '{"template_id": "f5685102-2e32-403b-af8b-48ec8d3661a1"}' \
https://sapi.infra-track.com:18892/templates \
-X DELETE

The return will be a template object which will show the updated active_yn parameter.

Deactivating a template with active devices will return an error code similar to:

{
    "message": "template has active devices and cannot be de-activated",
    "status": 500
}

Datacenters

LIST method returns a list of datacenters.

The following data parameter is required:

Call the LIST method using CURL command:

curl \
-H "Accept: application/json" \
-H "Content-type: application/json" \
-H "auth_head_user_name: your_username" \
-H "auth_head_password: your_password" \
-H "auth_head_company_id: a8c66258-2467-4c83-79ab-24671f4556cb" \
-d '{"company_id": "a8c66258-2467-4c83-79ab-24671f4556cb"}' \
https://sapi.infra-track.com:18892/datacenters \
-X LIST

An array of datacenter objects will be returned.

PUT method is designed to add or update an existing datacenter. At a minimum, the following parameters are required to add a new datacenter:

Also note that datacenter code and datacenter name must be unique values

Generate a JSON file with content required for a new datacenter. Example:

{
    "key": "00000000-0000-0000-0000-000000000000",
    "property_list": [
        {
            "prop_name": "active_yn",
            "prop_value": "True"
        },
        {
            "prop_name": "company_id",
            "prop_value": "a8c66258-2467-4c83-79ab-24671f4556cb"
        },
        {
            "prop_name": "datacenter_name",
            "prop_value": "Test DC"
        },
        {
            "prop_name": "datacenter_address",
            "prop_value": "3080 OGDEN AVE, LISLE, IL 60532 USA"
        },
        {
            "prop_name": "datacenter_code",
            "prop_value": "DCT01"
        }
    ]
}

Save the file as add_dc.json and load it with command:

curl \
-H "Accept: application/json" \
-H "Content-type: application/json" \
-H "auth_head_user_name: your_username" \
-H "auth_head_password: your_password" \
-H "auth_head_company_id: a8c66258-2467-4c83-79ab-24671f4556cb" \
-d @add_dc.json \
https://sapi.infra-track.com:18892/datacenters \
-X PUT

Upon successful submission, a datacenter object will be returned. Follow the same process to update an existing datacenter, this time by using a valid key value.

GET method will retrieve the datacenter object for a given key.

Required parameter:

Sample GET CURL command:

curl \
-H "Accept: application/json" \
-H "Content-type: application/json" \
-H "auth_head_user_name: your_username" \
-H "auth_head_password: your_password" \
-H "auth_head_company_id: a8c66258-2467-4c83-79ab-24671f4556cb" \
-d ‘{"datacenter_id": "39d0dda5-cd67-437d-af8b-48ec8d3661a1"}' \
https://sapi.infra-track.com:18892/datacenters \
-X GET

DELETE method is a method that deactivates an existing datacenter. Note that datacenters which have active devices cannot be deactivated.

Sample DELETE CURL request:

curl \
-H "Accept: application/json" \
-H "Content-type: application/json" \
-H "auth_head_user_name: your_username" \
-H "auth_head_password: your_password" \
-H "auth_head_company_id: a8c66258-2467-4c83-79ab-24671f4556cb" \
-d ‘{"datacenter_id": "39d0dda5-cd67-437d-af8b-48ec8d3661a1"}' \
https://sapi.infra-track.com:18892/datacenters \
-X DELETE

Note:
An already inactive datacenter will be activated if the delete request is executed.

Devices

LIST method returns the full list of devices for your entire enterprise.

The following data parameter is required:

Call the LIST method using CURL command:

curl \
-H "Accept: application/json" \
-H "Content-type: application/json" \
-H "auth_head_user_name: your_username" \
-H "auth_head_password: your_password" \
-H "auth_head_company_id: a8c66258-2467-4c83-79ab-24671f4556cb" \
-d '{"company_id": "a8c66258-2467-4c83-79ab-24671f4556cb"}' \
https://sapi.infra-track.com:18892/devices \
-X LIST

An array of device objects will be returned.

PUT method is designed to add or update an existing device. At a minimum, the following parameters are required to add a new device:

Generate a JSON file with content required for a new device.

Example:

{
    "key": "00000000-0000-0000-0000-000000000000",
    "property_list": [
        {
            "prop_name": "active_yn",
            "prop_value": "False"
        },
        {
            "prop_name": "company_id",
            "prop_value": "a8c66258-2467-4c83-79ab-24671f4556cb"
        },
        {
            "prop_name": "device_name",
            "prop_value": "test01"
        },
        {
            "prop_name": "device_domain",
            "prop_value": "none"
        },
        {
            "prop_name": "device_tag",
            "prop_value": "none"
        },
        {
            "prop_name": "datacenter_id",
            "prop_value": "eb2892fa-d5b2-4464-9874-11dfd3723863"
        },
        {
            "prop_name": "template_id",
            "prop_value": "21a9d9d1-371e-45fb-be0e-3db8dff0fee5"
        }
    ]
}

Save the file as add_device.json and load it with command:

curl \
-H "Accept: application/json" \
-H "Content-type: application/json" \
-H "auth_head_user_name: your_username" \
-H "auth_head_password: your_password" \
-H "auth_head_company_id: a8c66258-2467-4c83-79ab-24671f4556cb" \
-d @add_device.json \
https://sapi.infra-track.com:18892/devices \
-X PUT

Upon successful submission, a device object will be returned. Follow the same process to update an existing device, this time by using a valid key value.

GET method will retrieve the device object for a given key.

Required parameter:

Sample GET CURL command:

curl \
-H "Accept: application/json" \
-H "Content-type: application/json" \
-H "auth_head_user_name: your_username" \
-H "auth_head_password: your_password" \
-H "auth_head_company_id: a8c66258-2467-4c83-79ab-24671f4556cb" \
-d '{"device_id": "5704ddf7-cfca-467e-b88a-b8134b4742f3"}' \
https://sapi.infra-track.com:18892/devices \
-X GET

DELETE method is a method that deactivates an existing device.

Sample DELETE CURL request:

curl \
-H "Accept: application/json" \
-H "Content-type: application/json" \
-H "auth_head_user_name: your_username" \
-H "auth_head_password: your_password" \
-H "auth_head_company_id: a8c66258-2467-4c83-79ab-24671f4556cb" \
-d '{"device_id": "5704ddf7-cfca-467e-b88a-b8134b4742f3"}' \
https://sapi.infra-track.com:18892/devices \
-X DELETE

Note:
An already inactive device will be activated if the delete request is executed.

Tickets

PUT method is designed to add or update an existing ticket for a specific device. At a minimum, the following parameters are required to add a new ticket:

Generate a JSON file with content required for a new ticket.

Example:

{
  "key": "00000000-0000-0000-0000-000000000000", 
  "property_list": [ 
    { "prop_name": "active_yn", "prop_value": "True" }, 
    { "prop_name": "device_id", "prop_value": "5704ddf7-cfca-467e-b88a-b8134b4742f3" }, 
    { "prop_name": "ticket_issue", "prop_value": "Y3JlYX...Y2s=" }, 
    { "prop_name": "ticket_link", "prop_value": "#" }, 
    { "prop_name": "ticket_number", "prop_value": "1398489379" }, 
    { "prop_name": "ticket_reported_by", "prop_value": "Andrew Madison" }
  ] 
}

Save the file as add_ticket.json and load it with command:

curl \
-H "Accept: application/json" \
-H "Content-type: application/json" \
-H "auth_head_user_name: your_username" \
-H "auth_head_password: your_password" \
-H "auth_head_company_id: a8c66258-2467-4c83-79ab-24671f4556cb" \
-d @add_ticket.json \
https://sapi.infra-track.com:18892/tickets \
-X PUT

Updating a ticket follow the same process as adding a ticket, but this time the ticket_number and key parameters must be treated as unique identifiers (unlike the other records where the key was the only identifier).

Create a new ticket JSON file with the following content:

{
  "key": "51345798-e039-433b-a51b-4cc52b62855b", 
  "property_list": [ 
    { "prop_name": "active_yn", "prop_value": "True" }, 
    { "prop_name": "device_id", "prop_value": "5704ddf7-cfca-467e-b88a-b8134b4742f3" }, 
    { "prop_name": "ticket_issue", "prop_value": "Y3JlYXRl . . . IHNydHJhY2s=" }, 
    { "prop_name": "ticket_link", "prop_value": "#" }, 
    { "prop_name": "ticket_number", "prop_value": "1398489379" }, 
    { "prop_name": "ticket_reported_by", "prop_value": "Andrew Madison" }, 
    { "prop_name": "ticket_solution", "prop_value": "QWNjb3VudCBjcmV . . . m1c2VyLg==" }, 
    { "prop_name": "ticket_solved_by", "prop_value": "Andrew Madison" } 
  ] 
}

Save the file as update_ticket.json and load it with command:

curl \
-H "Accept: application/json" \
-H "Content-type: application/json" \
-H "auth_head_user_name: your_username" \
-H "auth_head_password: your_password" \
-H "auth_head_company_id: a8c66258-2467-4c83-79ab-24671f4556cb" \
-d @update_ticket.json \
https://sapi.infra-track.com:18892/tickets \
-X PUT

Note:
A ticket_issue and ticket_solution must be submitted as base64 encoded strings.

LIST method retrieves all tickets for a given device and company.

Sample ticket LIST request:

curl \
-H "Accept: application/json" \
-H "Content-type: application/json" \
-H "auth_head_user_name: your_username" \
-H "auth_head_password: your_password" \
-H "auth_head_company_id: a8c66258-2467-4c83-79ab-24671f4556cb" \
-d '{"device_id": "5704ddf7-cfca-467e-b88a-b8134b4742f3", "company_id": "a8c66258-2467-4c83-79ab-24671f4556cb"}' \
https://sapi.infra-track.com:18892/tickets \
-X LIST

A list of ticket objects will be returned.