Introduction

To use a REST API, your application will make a HTTP or CURL request and parse the response. The response format is JSON.  


Your methods will be the standard HTTP methods like GET, PUT, POST and DELETE. Because the REST API is based on open standards, you can use any web development language to access the API.


With REST API you can,

  • Create reports for visualization tools like Kibana/Grafana
  • Get all the reports
  • Generate and send the reports via Mail and Slack
  • Schedule a report
  • Configure report action(Mail/Slack) for the created reports.


Rest API Overview


How to call Rest API

Skedler REST API supports standard HTTP/CURL along with basic authentication if you are using Kibana Shield Plugin or Grafana


This example uses CURL without basic authentication,


This example uses CURL with basic auth if your are using Kibana Shield Plugin or Grafana


Rest API Details


Get all reports

Content
Description
Title
Get all reports
URL

/api/reports/getallreports

Method
GET
URL param
None
Data param
None
Success response
Status success and list of created reports
{
    "status": "success",
    "data": [<list of created reports>]
}
Error response
Status error and the error message
{

    "status": "error",

    "error": <error message>

}

Sample call
curl -H "Content-Type: application/json" -X GET  http://<your_skedler_server>:<your_skedler_port>/api/reports/getallreports

Example
curl -H "Content-Type: application/json" -X GET http://localhost:300/api/reports/getallreports
Notes


Get a report

Content
Description
Title
Get a report
URL

/api/reports/getreport/<reportID>

Method
PUT
URL param
reportID of the scheduled report
Data param
None
Success response
Status success and list the scheduled report
{
    "status": "success",
    "data": [<report detail>]
}
Error response
Status error and the error message
{

    "status": "error",

    "error": <error message>

}

Sample call
curl -H "Content-Type: application/json" -X PUT  http://<your_skedler_server>:<your_skedler_port>/api/reports/getareport/<reportID>

Example
curl -H "Content-Type: application/json" -X PUT http://localhost:3000/api/reports/getreport/AWBToHPhr0bqwPiV283_
Notes


Create a report

Content
Description
Title
Create a report
URL
/api/reports/create
Method
POST
URL param
None
Data param
Mandatory fields:
{
    "reportName": [string] Report name,
    "dashboardID/searchID": [string] Dashboard ID/Search ID of the visualization tools Kibana and Grafana
}

Optional fields:

By default the optional fields are set as follows,

    source - kibana

    reportTags - Not set

    folderPath - default location skedler_home/reports

    reportFormat - pdf    

    layout - layout type as A4, orienation as portrait and smartLayout is set

    schedule - Not enabled

    useDashboardTime/timeWindow - If dashbaord has the stored time useDashboardTime is enabled by default /Last 15 minuets

    filterName - No filter

    email - Not configured

    slack - Not configured

Detailed explanation of optional fields,
{
    "source": [string] "kibana/grafana",
    "reportTags": [array of string separated by comma],
    "folderPath": [string] - Path to store the report,
    "reportFormat": [array of string separated by comma] ["pdf", "excel", "csv"],
    "layout":{

        "reportTitle": [string],

        "layoutType": [string] "DefaultFont/A4/A3/Letter/Tabloid/Legal",

        "smartLayout": [boolean] true/false,
        "orientation": [string] "portrait/landscape",
        "reportFont": [string],

        "reportLogo": [string] "noLogo/defaultLogo",

    },

    "schedule": {

        "type": [string] - "hourly/daily/weekly/monthly/yearly",

        "interval": [string] - [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31],
        "minutes": [string], - [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59],
        "hours": [string], -  [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23],
        "months": [string] - [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
        "days": [string] - ["mon","tue","wed","thu","fri","sat","sun","monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"]
        "everyWeekdays": [boolean] - true/false
    },
    "useDashbaordTime": [boolean] true/false (or) "timeWindow":{
        <Quick>
        "type": [string] "quick",
        "val": [string] ["Last 15 Minutes/Last 30 Minutes/Last 1 Hour/Last 4 Hours/Last 12 Hours/Last 24 Hours/Last 7 Days/Last 30 Days/Last 60 Days/Last 90 Days/Last 6 Months/Last 1 Year/Last 2 Years/Last 5 Years/Today/This Week/This Month/This Year/The day so far/Week to date/Month to date/Year to date/Yesterday/Day before yesterday/This day last week/Previous week/Previous month/Previous year"]
        <Relative/Absolute>

        "type": [string], relative/absolute

        "from": {

            "val": [string],
            "type": [string] "hours/days/weeks/months/years"
        },
        "to": {
            "val": [string],
            "type": [string] "hours/days/weeks/months/years"
        },

        "roundOff": [boolean] true/flase

    },
    "filterName": [string]- filtername,
    "email":{

        "to": [array of string separated by comma],

        "cc": [array of string separated by comma],

        "subject": [string],

        "message": [string] 

    },
    "slack":{
        "channel": [string],
        "message": [string],
        "addInfo": [array of string separated by comma] ["${ReportName}","${TimeWindow}","${DashboardURL}"]
    }
}
Success response
Status success and the reportID of the created report
{
    "status": "success",
    "reportID": <reportID>
}
Error response
Status error and the error message
{

    "status": "error",

    "error": <error message>

}

Sample call

curl -H  "Accept:application/json" -X POST  http://<your_skedler_server>:<your_skedler_port>/api/reports/create -d <Data param>


Example
curl -H  "Accept:application/json" -X POST  http://localhost:3001/api/reports/create -d 

{  
   "reportName":"Twitter request report",
   "dashboardID":"AV9cMDDVFUzUz_51uSvi",
   "reportTags":[  
      "twitter",
      "request"
   ],
   "layout":{  
      "layoutType":"A4",
      "orientation":"landscape",
      "smartLayout":true
   },
   "timeWindow":{  
      "type":"quick",
      "val":"Last 5 Years"
   },
   "email":{  
      "to":[  
         "skedlerinfo@guidanz.com"
      ]
   }
}

Notes


Generate a scheduled report with reportID

Content
Description
Title
Generate a schedulde report with reportID
URL
/api/reports/generate
Method
POST
URL param
None
Data param
Mandatory fields:
{
    "reportID": [string] Report ID of the scheduled report,
}

Optional fields:

By default the optional fields are set to the value that is configured for the scheduled report.

You can change the optional fields as required and generate the report,

    source - Visualization tool for which the report need to be generated

    dashboardID/searchID - Dashboard/search that is present in the visualization tool
    reportName - Specify a reportName for the generated report
    reportTags - 

    folderPath - Folder path in which the generated report needs to be saved

    reportFormat - Output format of the generated report

    layout - Customize the report

    timeWindow - Time window in which the report needs to be generated

    filterName - Specify filter for the report

    email - To which the generated report needs to be sent

    slack - To which the generated report needs to be sent

Detailed explanation of optional fields,
{
    "source": [string] "kibana/grafana",
    "dashboardID/searchID": [string] DashboardID/searchID for which the report needs to be generated,
    "reportName": [string] Report name for the generated report
    "reportTags": [array of string separated by comma],
    "folderPath": [string] - Path to store the report,
    "reportFormat": [array of string separated by comma] ["pdf", "excel", "csv"],
    "layout":{

        "reportTitle": [string],

        "layoutType": [string] "DefaultFont/A4/A3/Letter/Tabloid/Legal",

        "smartLayout": [boolean] true/false,
        "orientation": [string] "portrait/landscape",
        "reportFont": [string],

        "reportLogo": [string] "noLogo/defaultLogo",

    },
    "useDashbaordTime": [boolean] true/false (or) "timeWindow":{
        <Quick>
        "type": [string] "quick",
        "val": [string] ["Last 15 Minutes/Last 30 Minutes/Last 1 Hour/Last 4 Hours/Last 12 Hours/Last 24 Hours/Last 7 Days/Last 30 Days/Last 60 Days/Last 90 Days/Last 6 Months/Last 1 Year/Last 2 Years/Last 5 Years/Today/This Week/This Month/This Year/The day so far/Week to date/Month to date/Year to date/Yesterday/Day before yesterday/This day last week/Previous week/Previous month/Previous year"]
        <Relative/Absolute>

        "type": [string], relative/absolute

        "from": {

            "val": [string],
            "type": [string] "hours/days/weeks/months/years"
        },
        "to": {
            "val": [string],
            "type": [string] "hours/days/weeks/months/years"
        },

        "roundOff": [boolean] true/flase

    },
    "filterName": [string]- filtername,
    "email":{

        "to": [array of string separated by comma],

        "cc": [array of string separated by comma],

        "subject": [string],

        "message": [string] 

    },
    "slack":{
        "channel": [string],
        "message": [string],
        "addInfo": [array of string separated by comma] ["${ReportName}","${TimeWindow}","${DashboardURL}"]
    }
}
Success response
Status success and the generated URL with the location of the generated report
{
    "status": "success",
    "url": <report generation URL>,
    "fileLocation": [<location of the generated report>]
}
Error response
Status error and the error message
{

    "status": "error",

    "error": <error message>

}

Sample call

curl -H  "Accept:application/json" -X POST http://<your_skedler_server>:<your_skedler_port>/api/reports/generate -d <Data param>


Example
curl -H  "Accept:application/json" -X POST http://localhost:3001/api/reports/generate -d 

{  
   "reportID":"AWBToHPhr0bqwPiV283_",
   "layout":{  
      "layoutType":"A4",
      "smartLayout":true,
      "orientation":"landscape"
   },
   "timeWindow":{  
      "type":"relative",
      "from":{  
         "val":"15",
         "type":"minutes"
      },
      "to":{  
         "val":"0",
         "type":"minutes"
      }
   },
   "email":{  
      "to":[  
         "skedlerinfo@guidanz.com"
      ]
   }
}

Notes


Generate a report with dashbaordID/searchID

Content
Description
Title
Generate a report with dasboardID/searchID
URL

/api/reports/generate

Method
POST
URL param
None
Data param
Mandatory fields:
{
    "dashboardID/searchID": [string] DashboardID/searchID for which the report needs to be generated
}

Optional fields:

By default the optional fields are set to the value that is configured for the scheduled report.

You can change the optional fields as required and generate the report,

    source - Visualization tool for which the report need to be generated

    reportName - Specify a reportName for the generated report
    reportTags - 

    folderPath - Folder path in which the generated report needs to be saved

    reportFormat - Output format of the generated report

    layout - Customize the report

    timeWindow - Time window in which the report needs to be generated

    filterName - Specify filter for the report

    email - To which the generated report needs to be sent

    slack - To which the generated report needs to be sent

Detailed explanation of optional fields,
{
    "source": [string] "kibana/grafana",
    "reportTags": [array of string separated by comma],
    "folderPath": [string] - Path to store the report,
    "reportFormat": [array of string separated by comma] ["pdf", "excel", "csv"],
    "layout":{

        "reportTitle": [string],

        "layoutType": [string] "DefaultFont/A4/A3/Letter/Tabloid/Legal",

        "smartLayout": [boolean] true/false,
        "orientation": [string] "portrait/landscape",
        "reportFont": [string],

        "reportLogo": [string] "noLogo/defaultLogo",

    },
    "useDashbaordTime": [boolean] true/false (or) "timeWindow":{
        <Quick>
        "type": [string] "quick",
        "val": [string] ["Last 15 Minutes/Last 30 Minutes/Last 1 Hour/Last 4 Hours/Last 12 Hours/Last 24 Hours/Last 7 Days/Last 30 Days/Last 60 Days/Last 90 Days/Last 6 Months/Last 1 Year/Last 2 Years/Last 5 Years/Today/This Week/This Month/This Year/The day so far/Week to date/Month to date/Year to date/Yesterday/Day before yesterday/This day last week/Previous week/Previous month/Previous year"]
        <Relative/Absolute>

        "type": [string], relative/absolute

        "from": {

            "val": [string],
            "type": [string] "hours/days/weeks/months/years"
        },
        "to": {
            "val": [string],
            "type": [string] "hours/days/weeks/months/years"
        },

        "roundOff": [boolean] true/flase

    },
    "filterName": [string]- filtername,
    "email":{

        "to": [array of string separated by comma],

        "cc": [array of string separated by comma],

        "subject": [string],

        "message": [string] 

    },
    "slack":{
        "channel": [string],
        "message": [string],
        "addInfo": [array of string separated by comma] ["${ReportName}","${TimeWindow}","${DashboardURL}"]
    }
}
Success response
Status success and the generated URL with the location of the generated report
{
    "status": "success",
    "url": <report generation URL>,
    "fileLocation": [<location of the generated report>]
}
Error response
Status error and the error message
{

    "status": "error",

    "error": <error message>

}

Sample call

curl -H  "Accept:application/json" -X POST  http://<your_skedler_server>:<your_skedler_port>/api/reports/generate -d <Data param>


Example
curl -H  "Accept:application/json" -X POST http://localhost:3001/api/reports/generate -d 

{  
   "dashboardID":"AWA1CegCUiGwC100XUGY",
   "layout":{  
      "layoutType":"A4",
      "smartLayout":false,
      "orientation":"landscape"
   },
   "timeWindow":{  
      "type":"relative",
      "from":{  
         "val":"15",
         "type":"minutes"
      },
      "to":{  
         "val":"0",
         "type":"minutes"
      }
   },
   "email":{  
      "to":[  
         "skedlerinfo@guidanz.com"
      ]
   }
}

Notes


Update a report

Content
Description
Title
Update a report
URL

/api/reports/update

Method
POST
URL param
None
Data param
Mandatory fields:
{
    "reportID": [string] Report ID of the scheduled report,
}

With reportID, you can update the report with any of the following fields for the scheduled report,

    source - Visualization tool for which the report need to be generated

    dashboardID/searchID - Dashboard/search that is present in the visualization tool
    reportName - Specify a reportName for the generated report
    reportTags - 

    folderPath - Folder path in which the generated report needs to be saved

    reportFormat - Output format of the generated report

    layout - Customize the report

    timeWindow - Time window in which the report needs to be generated

    filterName - Specify filter for the report

    email - To which the generated report needs to be sent

    slack - To which the generated report needs to be sent

Detailed explanation of the fields,
{
    "source": [string] "kibana/grafana",
    "dashboardID/searchID": [string] DashboardID/searchID for which the report needs to be generated,
    "reportName": [string] Report name for the generated report
    "reportTags": [array of string separated by comma],
    "folderPath": [string] - Path to store the report,
    "reportFormat": [array of string separated by comma] ["pdf", "excel", "csv"],
    "layout":{

        "reportTitle": [string],

        "layoutType": [string] "DefaultFont/A4/A3/Letter/Tabloid/Legal",

        "smartLayout": [boolean] true/false,
        "orientation": [string] "portrait/landscape",
        "reportFont": [string],

        "reportLogo": [string] "noLogo/defaultLogo",

    },
    "useDashbaordTime": [boolean] true/false (or) "timeWindow":{
        <Quick>
        "type": [string] "quick",
        "val": [string] ["Last 15 Minutes/Last 30 Minutes/Last 1 Hour/Last 4 Hours/Last 12 Hours/Last 24 Hours/Last 7 Days/Last 30 Days/Last 60 Days/Last 90 Days/Last 6 Months/Last 1 Year/Last 2 Years/Last 5 Years/Today/This Week/This Month/This Year/The day so far/Week to date/Month to date/Year to date/Yesterday/Day before yesterday/This day last week/Previous week/Previous month/Previous year"]
        <Relative/Absolute>

        "type": [string], relative/absolute

        "from": {

            "val": [string],
            "type": [string] "hours/days/weeks/months/years"
        },
        "to": {
            "val": [string],
            "type": [string] "hours/days/weeks/months/years"
        },

        "roundOff": [boolean] true/flase

    },
    "filterName": [string]- filtername,
    "email":{

        "to": [array of string separated by comma],

        "cc": [array of string separated by comma],

        "subject": [string],

        "message": [string] 

    },
    "slack":{
        "channel": [string],
        "message": [string],
        "addInfo": [array of string separated by comma] ["${ReportName}","${TimeWindow}","${DashboardURL}"]
    }
}
Success response
Status success and the reportID of the updated report
{
    "status": "success",
    "reportID": <reportID>
}
Error response
Status error and the error message
{

    "status": "error",

    "error": <error message>

}

Sample call

curl -H  "Accept:application/json" -X POST http://<your_skedler_server>:<your_skedler_port>/api/reports/update -d <Data param>


Example

curl -H  "Accept:application/json" -X POST http://localhost:3000/api/reports/update/

{  
   "reportID":"AWA1CZyDUiGwC100XUGN",
   "schedule":{  
      "type":"hourly",
      "interval":2,
      "minutes":20,
      "hours":20
   },
   "reportName":"Crime analysis report",
   "layout":{  
      "layoutType":"A4",
      "orientation":"landscape",
      "smartLayout":false
   },
   "format":[  
      "pdf",
      "excel"
   ],
   "timeWindow":{  
      "type":"quick",
      "val":"Last 5 Years"
   },
   "reportTags":[  
      "Alameda",
      "crime-data"
   ],
   "folderPath":"/home/Desktop/",
   "filterName":"filter by city",
   "email":{  
      "to":[  
         "skedlerinfo@guidanz.com"
      ]
   }
}

Notes


Pause a scheduled report

Content
Description
Title
Pause a scheduled report
URL

/api/reports/pause/<reportID>

Method
PUT
URL param
reportID of the scheduled report which has to paused
Data param
None
Success response
Status success and the reportID of the paused scheduled report
{
    "status": "success",
    "reportID": <reportID of the paused report>
}
Error response
Status error and the error message
{

    "status": "error",

    "error": <error message>

}

Sample call
curl -H "Content-Type: application/json" -X PUT  http://<your_skedler_server>:<your_skedler_port>/api/reports/pause/<reportID>

Example
curl -H "Content-Type: application/json" -X PUT http://localhost:3001/api/reports/pause/AWC8jOj-W7OkpxkqKkWZ
Notes


Resume a scheduled report

Content
Description
Title
Resume a scheduled report
URL

/api/reports/resume/<reportID>

Method
PUT
URL param
None
Basic Authorization

Data param
reportID of the scheduled report which has to be resumed
Success response
Status success and the reportID of the paused scheduled report
{
    "status": "success",
    "reportID": <reportID of the resumed report>
}
Error response
Status error and the error message
{

    "status": "error",

    "error": <error message>

}

Sample call
curl -H "Content-Type: application/json" -X PUT  http://<your_skedler_server>:<your_skedler_port>/api/reports/resume/<reportID>

Example
curl -H "Content-Type: application/json" -X PUT http://localhost:3001/api/reports/resume/AWC8jOj-W7OkpxkqKkWZ
Notes


Delete a report

Content
Description
Title
Delete a reports
URL

/api/reports/delete/<reportID>

Method
DELETE
URL param
None
Basic Authorization

Data param
reportID of the report which has to be deleted
Success response
Status success and the reportID of the deleted report
{
    "status": "success",
    "reportID": <reportID of the deleted report>
}
Error response
Status error and the error message
{

    "status": "error",

    "error": <error message>

}

Sample call
curl -H "Content-Type: application/json" -X DELETE  http://<your_skedler_server>:<your_skedler_port>/api/reports/delete/<reportID>

Example
curl -H "Content-Type: application/json" -X DELETE http://localhost:3000/api/reports/delete/AWBToHPhr0bqwPiV283_
Notes