Introduction

The REST API is provided to update the value of the Components created on the Page and send (New) Push Notifications to moible.

Five types of components are supported.

  • Horizontal Box
  • Vertical Box
  • New - Bar Chart
  • New - Line Chart
  • New - Pie Chart

Important All users are granted BETA account during BETA period which has 50,000 api call limits per day.

Update a component

Modify the content of the component on the fly.

POST
https://kpicat.com/api/component

Headers

Content-Type: application/json

Five types of components

1. Horizontal Box


Request

{
  "componentId": "@component id - string",
  "apiKey": "@account api key - string",
  "timestamp": @unix timestamp - number,
  "data": {
    "backgroundColor": "@hex color - string",
    "type": "@component type - string. Use horizontalBox here",
    "leftText": {
      "value": "@text value - string",
      "size": @font size - int,
      "color": "@hex color - string"
    },
    "middleText": {
      "value": "@text value - string",
      "size": @font size - int,
      "color": "@hex color - string"
    },
    "rightText": {
      "value": "@text value - string",
      "size": @font size - int,
      "color": "@hex color - string"
    }
  }
}       

Example

{
  "apiKey": "api_0ZR8SpfUT5Ww_1MUKPgJuQ",
  "componentId": "com_gL4Q28SKSyWRvy1B0TWSiA",
  "timestamp": 1483228800,
  "data": {
    "backgroundColor": "#ffffff",
    "type": "horizontalBox",
    "leftText": {
      "value": "LEFT",
      "size": 24,
      "color": "#00a8e8"
    },
    "middleText": {
      "value": "MIDDLE",
      "size": 24,
      "color": "#ff3b3f"
    },
    "rightText": {
      "value": "RIGHT",
      "size": 24,
      "color": "#57bc90"
    }
  }
}       

2. Vertical Box


Request

{
  "componentId": "@component id - string",
  "apiKey": "@account api key - string",
  "timestamp": @unix timestamp - number,
  "data": {
    "backgroundColor": "@hex color - string.",
    "type": "@component type - string. Use verticalBox here",
    "topText": {
      "value": "@text value - string",
      "size":  @font size - int,
      "color": "@hex color - string",
    },
    "bottomText": {
      "value": "@text value - string",
      "size":  @font size - int,
      "color": "@hex color - string",
    }
  }
}        

Example

{
  "apiKey": "api_0ZR8SpfUT5Ww_1MUKPgJuQ",
  "componentId": "com_gL6Q2BSKSyWRvyqB0TWSiA",
  "timestamp": 1483228800,
  "data": {
    "backgroundColor": "#fcb064",
    "type": "verticalBox",
    "topText": {
      "value": "TOP",
      "size": 16,
      "color": "#123456"
    },
    "bottomText": {
      "value": "BOTTOM",
      "size": 16,
      "color": "#fcec64"
    }
  }
}       

3. Bar Chart


Request

{
  "componentId": "@component id - string",
  "apiKey": "@account api key - string",
  "timestamp": @unix timestamp - number,
  "data": {
    "backgroundColor": "@hex color - string",
    "type": "@component type - string. Use barChart here",
    "xNumber": "@if X-axis is number or string - boolean",
    "height": "@chart height - int",
    "points": [
      {
        "x": "@X-axis value - string",
        "y": "@Y-axis value - float",
        "color": "@hex color - string"
      },
      ......
      ......
    ]
  }
}       

Example

{
  "componentId": "com_SoU6DT2RSFWrMX2sLylKvA",
  "apiKey": "api_0ZR9SpfUTlWw_8MUKPgJuQ",
  "timestamp": 1483228800,
  "data": {
    "backgroundColor": "#FFFFFF",
    "type": "barChart",
    "xNumber": false,
    "height": 600,
    "points": [
      {
        "x": "Jan",
        "y": 20.0,
        "color": "#123456"
      },
      {
        "x": "Feb",
        "y": 25.0,
        "color": "#123456"
      },
      {
        "x": "Mar",
        "y": 15.0,
        "color": "#123456"
      }
    ]
  }
}       

4. Line Chart


Request

{
  "componentId": "@component id - string",
  "apiKey": "@account api key - string",
  "timestamp": @unix timestamp - number,
  "data": {
    "backgroundColor": "@hex color - string",
    "type": "@component type - string. Use lineChart here",
    "cubic": "@if it is a cubic curve - boolean",
    "xNumber": "@if X-axis is number or string - boolean",
    "fillColor": "@hex color - string"
    "height": "@chart height - int",
    "points": [
      {
        "x": "@X-axis value - string",
        "y": "@Y-axis value - float",
        "color": "@hex color - string"
      },
      ......
      ......
    ]
  }
}       

Example

{
  "componentId": "com_SoU6DT2RSFWrMX2sLylKvA",
  "apiKey": "api_0ZR9SpfUTlWw_8MUKPgJuQ",
  "timestamp": 1483228800,
  "data": {
    "backgroundColor": "#eff9f9",
    "type": "lineChart",
    "cubic": true,
    "xNumber": true,
    "fillColor": "#9bf8ff",
    "height": 600,
    "points": [
      {
        "x": "0",
        "y": 73.0,
        "color": "#123456"
      },
      {
        "x": "1",
        "y": 26.0,
        "color": "#123456"
      },
      {
        "x": "2",
        "y": 76.0,
        "color": "#123456"
      }
    ]
  }
}       

5. Pie Chart


Request

{
  "componentId": "@component id - string",
  "apiKey": "@account api key - string",
  "timestamp": @unix timestamp - number,
  "data": {
    "backgroundColor": "@hex color - string",
    "type": "@component type - string. Use pieChart here",
    "height": "@chart height - int",
    "points": [
      {
        "x": "@X-axis value - string",
        "y": "@Y-axis value - float",
        "color": "@hex color - string"
      },
      ......
      ......
    ]
  }
}       

Example

{
  "componentId": "com_SoU6DT2RSFWrMX2sLylKvA",
  "apiKey": "api_0ZR9SpfUTlWw_8MUKPgJuQ",
  "timestamp": 1483228800,
  "data": {
    "backgroundColor": "#FFFFFF",
    "type": "pieChart",
    "height": 600,
    "points": [
      {
        "x": "Jan",
        "y": 20.0,
        "color": ""
      },
      {
        "x": "Feb",
        "y": 25.0,
        "color": ""
      },
      {
        "x": "Mar",
        "y": 15.0,
        "color": ""
      }
    ]
  }
}       

Response

{
  "message":"updateSuccess",
  "limitRemaining":21
}       

Push notification

Send a notification to all the users that have access to the page within the corporation.

POST
https://kpicat.com/api/message

Headers

Content-Type: application/json

Request

{
  "apiKey": "@account api key - string",
  "pageName": "@page name - string",
  "message": "@message - string"
}      

Example

{
  "apiKey": "api_0ZR9SpfUTlWw_8MUKPgJuQ",
  "pageName": "NYC-DB-1",
  "message": "CPU running at 100%"
}     

Response

Message sent successfully.