PHP code example of think.studio / ipro-software-api-php

1. Go to this page and download the library: Download think.studio/ipro-software-api-php 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/ */

    

think.studio / ipro-software-api-php example snippets


    $iproSoftwareClient = new \IproSoftwareApi\IproSoftwareClient([
        'api_host' => 'my-iprosoftware-api-host',
        'client_id' => 'my-iprosoftware-client-id',
        'client_secret' => 'my-iprosoftware-client-secret',
    ]);
    
    $response = $iproSoftwareClient->getBookingRulesList();

    $responseBody = json_decode($response->getBody());

$iproSoftwareClient = new \IproSoftwareApi\IproSoftwareClient([
    'api_host' => 'my-iprosoftware-api-host',
    'client_id' => 'my-iprosoftware-client-id',
    'client_secret' => 'my-iprosoftware-client-secret',
    'cache_manager' => new MyDatabaseAccessTokenCacheManager(),
    'client_conf' => [
        'timeout' => 15,
        'http_errors' => false,
        'headers' => [
            'Accept' => 'application/json',
        ]
    ]
]);

    $iproSoftwareClient = new \IproSoftwareApi\IproSoftwareClient([
        'api_host' => 'my-iprosoftware-api-host',
        'client_id' => 'my-iprosoftware-client-id',
        'client_secret' => 'my-iprosoftware-client-secret'
    ]);
    
    $iproSoftwareClient->setAccessTokenCacheManager(new MyDatabaseAccessTokenCacheManager())

    $iproSoftwareClient = new \IproSoftwareApi\IproSoftwareClient();
    
    $iproSoftwareClient->setHttpClient(new MyOwnHttpClient($credentials))

    try {
        $response = $iproSoftwareClient->getBookingRulesList();
    } catch (IproSoftwareApi\Exceptions\IproSoftwareApiAccessTokenException $e) {
        $code = $e->getCode(); // Http status code from response
        $reason = $e->getMessage(); // Http status reason phrase
        $httpResponse = $e->getResponse(); // Psr\Http\Message\ResponseInterface from http client
    }