This section describes the available REST APIs that can be used for accessing the functionality provided on Reportivo.com.
If you are looking to dynamically update the data shown on your reoprts, check out the Dynamic Data section.
API requests should be sent to the www.reportivo.com host over the HTTP or HTTPS protocols.
The REST service supports only the JSON format for a data transport, so make sure to set the Content-type header in your client to application/json for POST and PUT requests.
Used for creating any type of chart that can contain more than one graph. On success returns the URL of the newly created chart, which can be used to view it or embed it in other pages.
Parameters:
title
: string - the title of the chart (optional)
config
: dictionary - the chart configuration (required). See Shield UI Chart API docs or demos for further information on all possible configuration options.
JSON Example:
{ "title": "My Pie Chart", "config": { "dataSeries": [ { "seriesType": "pie", "data": [2, 1, 6, 4, 2] } ] } }
400 Bad Request
- returned when an error occurred while saving the chart; may contain details about the actual error, such as an invalid parameter, etc.
403 Forbidden
- the IP from which the request originated is blacklisted.
429 Too Many Requests
- too many requests have been made from the client IP.
201 Created
- the chart was successfully created; contains the URL of the newly created chart in the Location header and its uuid in the body.
For abuse prevention purposes, certain operations may have limitations on the maximum number of requests sent from the same IP address.
In such cases, the service will return a 429 Too Many Requests response. In some rare cases you might receive a 403 Forbidden response, which will mean that your IP is blacklisted. Contact us if you need those limitations raised for you.
<?php # the API params $params = array( "title" => "Pie Chart", "config" => array( "dataSeries" => array( array( "seriesType" => "pie", "data" => array(2, 5, 3, 6, 1) ) ) ) ); # encode the params in JSON $post_data = json_encode($params); # initialize and setup cURL $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "http://www.reportivo.com/chart"); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( "Content-type: application/json", "Content-length: " . strlen($post_data) )); # make the request, collecting the output in a variable ob_start(); curl_exec($ch); $response_data = ob_get_contents(); ob_end_clean(); # get the HTTP response code $code = curl_getinfo($ch, CURLINFO_HTTP_CODE); $response = json_decode($response_data); # if the code is 201, chart was created if ($code == 201) { print "OK: http://www.reportivo.com/view/" . $response->uuid . "\n"; } else { print "Error: " . $response->error . "\n"; } ?>
#!/usr/bin/perl use strict; use JSON(); use REST::Client(); # init the REST client my $client = REST::Client->new({ host => 'https://www.reportivo.com', }); # set the Content-type header $client->addHeader("Content-type", "application/json"); # initialize the chart params my $params = { title => "My Chart", config => { dataSeries => [ { seriesType => "line", data => [2, 5, 3, 6, 1] } ] } }; # create a chart by calling POST /chart and passing the JSON params $client->POST('/chart', JSON->new()->utf8(1)->encode($params)); # handle the response print $client->responseCode() . "\n"; print $client->responseHeader("Location") . "\n"; print $client->responseContent() . "\n"; =comment # the above should print something like: 201 https://www.reportivo.com/view/5268BB54-421D-11E3-980D-38AC9BBBCC93 {"uuid":"5268BB54-421D-11E3-980D-38AC9BBBCC93"} =cut
About | Contact Us | How-To | Dynamic Data | API | Terms of Service | Privacy Policy Copyright © 2013-2020 Shield UI Ltd.