api_docs

Flextory API Documentation

Introduction

The Flextory API allows you to query and manipulate items via simple url calls. The API can be used to integrate the data you have in Flextory with other applications and scripts. Some examples of how the Flextory API could be useful are as follows:

  • Have your DNS server only allow machines that are listed in your Flextory account
  • Import data from another database or source
  • Export data to another source
  • Create new interfaces/software to manipulate data you have listed in Flextory
  • Automatically add data to your Flextory account based on events in your custom software
  • Whatever else you can imagine

Usage Limits

Your use of the Flextory API is limited by the plan in which you are subscribed to and the terms listed in the Service Agreement. Excessive or abusive usage of the Flextory API may result in warnings and or suspension of your account. If you have concerns about your particular use of the API, please contact support@flextory.com.

What You Will Need

  • Your Flextory Private Key
    • A private key is automatically generated for each new Flextory user. Click on your name (User Profile) while logged into Flextory to retrieve your private key.
  • A Language with an implementation of HMAC with support for SHA512

Basic Usage

You'll first have to build a query string. For example, the following query string finds all items that have the Item Type, 'Desktop':

userName=api&search=true&itemType=Desktop

You then have to use the HMAC method on your query string to generate your public key for this request. In PHP, you would do the following:

$publicKey = hash_hmac('sha512', 'userName=api&search=true&itemType=Desktop', '[Private Key Here]');

You then need to add your public key to the end of your query string like so:

userName=api&search=true&itemType=Desktop&publicKey=$publicKey

Finally, you can put the entire url together like so:

http://home.codingbychris.com:82/inventory/inventory/dataHandlers/api.php?userName=api&search=true&itemType=Desktop&publicKey=$publicKey

Make use of https: instead of http: to use a secure connection if your language supports it. Consult your language's documentation on how to configure and use https.

The server will then return a JSON object. If the 'success' variable is true, then the query was successful. An example response can be seen below.

{
  "items": [
    {
      "assetType": "Desktop", 
      "attributes": {
        "OS": "Windows", 
        "IP": "192.168.1.232", 
        "End User": "Fred", 
      }, 
      "barcode": "4334433434", 
      "dateAdded": "2012-03-09 10:28:29", 
      "dateModified": "2012-03-09 10:28:29", 
      "id": 29, 
      "name": "Glados"
    }, 
    {
      "assetType": "Desktop", 
      "attributes": {
        "OS": "Linux", 
        "IP": "192.168.1.222", 
        "End User": "Chris", 
      }, 
      "barcode": "34453344", 
      "dateAdded": "2012-03-09 10:29:27", 
      "dateModified": "2012-03-09 10:29:27", 
      "id": 34, 
      "name": "Pixie"
    }
  ], 
  "success": "true"
}

Available Operations

Item Retrieval

Operation Description Example
id Retrieve an item by its id.
id=23
barcode Retrieve an item by its barcode.
barcode=AB293F3
search Perform a search of all items in your inventory
search=true
category Search for items in a particular category id
search=true&category=23
attributeValues[] Search for items that have particular attribute values. * can be used as a wildcard.
search=true&attributeValues[]=value1&attributeValues[]=value2
attributePairValues Search for attribute/value pairs. Must be used with attributePairTitles. * can be used as a wildcard.
search=true&attributePairValues[]=val1&attributePairTitles[]=title1&attributePairValues[]=val2&attributePairTitles[]=title2
name Search for items with a particular name. * can be used as a wildcard.
search=true&name=someName
offset Retrieve items past a certain offset for pagination type activities.
search=true&attributeValues[]=red&offset=10
itemsWanted Limit the amount of returned results.
search=true&attributeValues[]=red&itemsWanted=5

Item Manipulation & Creation

Operation Description Example
editItem Contains the id of the item you wish to edit
editItem=42
newItem Use when you want to make a new item
newItem=true
attributeTitles[] titles of attributes you wish to modify or add. Must combine with attributeValues!
attributeTitles[]=Color&attributeValues[]=Red&attributeTitles[]=Shape&attributeValues[]=Square
name name for item
name=Pancakes
barcode barcode for item
barcode=abc123
category category id for item
category=23
links[] array of item ids to link to this item
links[]=23&links[]=53&links[]=42
itemType Item Type Id for item
itemType=11
deleteAttributes[] Titles of attributes you wish to remove from the item
deleteAttributes[]=Color&deleteAttributes[]=Shape
api_docs.txt · Last modified: 2013/01/29 00:35 by cbeley