PHP code example of finstat / client-api

1. Go to this page and download the library: Download finstat/client-api library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

finstat / client-api example snippets


// Basic API configuration
$apiUrl = 'https://www.finstat.sk/api/';    // URL for Slovak API (use 'https://cz.finstat.sk/api/' for Czech API)
$apiKey = 'YOUR_API_KEY';                  // Your unique API key
$privateKey = 'YOUR_PRIVATE_KEY';          // Your private key
$stationId = 'Your Station ID';            // Identifier for the station making the request
$stationName = 'Your Station Name';        // Name or description of the station
$timeout = 10;                             // Timeout in seconds for server response
$json = false;                             // Set to true if you want the API to return responses as JSON


re_once(__DIR__ . '/../FinStat.Client/ViewModel/AutoCompleteResult.php');
_once(__DIR__ . '/../FinStat.ViewModel/Detail/DetailResult.php');
$privateKey, $stationId, $stationName, $timeout);

// Get basic company information
$ico = '35757442'; // Example company ICO
$basicInfo = $api->Request($ico, "basic", $json);

// Get detailed company information
$detailInfo = $api->Request($ico, "detail", $json);

// Get extended company information 
$extendedInfo = $api->Request($ico, "extended", $json);

// Get ultimate (most comprehensive) company information
$ultimateInfo = $api->Request($ico, "ultimate", $json);

// Search for companies by name
$autocompleteResults = $api->RequestAutoComplete('volkswagen', $json);

// Check API usage limits
$limits = $api->GetAPILimits();


re_once(__DIR__ . '/../FinStat.Client/ViewModel/AutoCompleteResult.php');
// Initialize the API client for Czech companies
$apiUrl = 'https://cz.finstat.sk/api/';
$api = new FinstatApiCz\FinstatApi($apiUrl, $apiKey, $privateKey, $stationId, $stationName, $timeout);

// Get basic company information
$ico = '48207349'; // Example Czech company ICO
$basicInfo = $api->Request($ico, "basic", $json);

// Get detailed company information
$detailInfo = $api->Request($ico, "detail", $json);

// Get premium company information
$premiumInfo = $api->Request($ico, "premiumcz", $json);

// Search for companies by name
$autocompleteResults = $api->RequestAutoComplete('volkswagen', $json);


re_once(__DIR__ . '/../FinStat.Client/ViewModel/Monitoring/MonitoringReportResult.php');

// Initialize the monitoring API client
$api = new FinstatMonitoringApi($apiUrl, $apiKey, $privateKey, $stationId, $stationName, $timeout);

// Add a company to monitoring by ICO
$ico = '35757442';
$success = $api->AddToMonitoring($ico, $json);

// Add a date to monitoring
$date = "1.1.1991";
$success = $api->AddDateToMonitoring($date, $json);

// Get list of monitored ICOs
$monitoredList = $api->MonitoringList($json);

// Get list of monitored dates
$monitoredDateList = $api->MonitoringDateList($json);

// Remove a company from monitoring
$success = $api->RemoveFromMonitoring($ico, $json);

// Remove a date from monitoring
$success = $api->RemoveDateFromMonitoring($date, $json);

// Get monitoring reports
$reports = $api->MonitoringReport($json);
$dateReports = $api->MonitoringDateReport($json);


re_once(__DIR__ . '/../FinStat.ViewModel/Diff/DailyDiff.php');
Api($apiUrl, $apiKey, $privateKey, $stationId, $stationName, $timeout);

// Get list of available daily diffs
$list = $api->RequestListOfDailyDiffs($json);

// Download a specific daily diff file
$file = "example_file.zip";
$data = $api->DownloadDailyDiffFile($file, $file);



// Initialize the daily diff API client
$api = new FinstatBankruptcyRestructuringApi($apiUrl, $apiKey, $privateKey, $stationId, $stationName, $timeout);

// Get list of person bankruptcy proceedings
$list = $api->RequestPersonBankruptcyProceedings($name, $surname, $dateOfBirth, $json);

// Get list of company bankruptcy and restructuring proceedings by ico
$list = $api->RequestCompanyBankruptcyRestructuring($ico, null, $dateOfBirth, $json);

// Get list of company bankruptcy and restructuring proceedings by name
$list = $api->RequestCompanyBankruptcyRestructuring(null, $name, $dateOfBirth, $json);


try {
    $response = $api->Request($ico, "basic", $json);
} catch (Exception $e) {
    // Handle error
    $code = $e->getCode();
    $message = $e->getMessage();
    $data = $e->getData();
}

$limits = $api->GetAPILimits();

// Example output format:
// [
//   'daily' => ['current' => 10, 'max' => 100],
//   'monthly' => ['current' => 50, 'max' => 1000]
// ]