Hi,
I just know that koolreport has some new features. I’m interested using koolreport API DataSource and Restful DataSource. I’ve been read the docs, and tried to use it. But i’m still have some difficulties to use it. Here is my code:
<?php
namespace App\Reports\CustomAPI;
use koolreport\KoolReport;
class TestCustomDatasource extends \koolreport\KoolReport
{
use \koolreport\laravel\friendship;
use \koolreport\excel\ExcelExportable;
use \koolreport\export\Exportable;
use \koolreport\cloudexport\Exportable;
// this function calls API datasource?
// i get this parameters from API datasource class
// i've tested to run the report but there's no result
protected function settings()
{
return array(
"dataSources"=>array(
"api_datasource" =>array(
'curlOptions' =>[],
'method' =>'get',
'url' =>'http://localhost/test-api-server.php',
'reqHeaders' =>'',
'reqData' =>[
"cmp_id"=>"DEMO01",
"order_no"=>"TEST0001",
"seq_no"=>1
],
'iteration' =>'',
'metaData' =>[
"columns"=>[
"cmp_id"=>["type"=>"string"],
"order_no"=>["type"=>"string"],
"seq_no"=>["type"=>"number"],
]
],
'class' => "\koolreport\datasources\APIDataSource"
),
)
);
}
// i use the minimum piping method just for testing this new feature
protected function setup()
{
$this->src('api_datasource')
->pipe($this->dataStore('api_datastore'));
}
}
?>
Can you please give me an example of API DataSource or Restful DataSource, like basic usage to call API and pipe it into DataStore?