PHP code example of pica9 / campaign-drive-api-client

1. Go to this page and download the library: Download pica9/campaign-drive-api-client 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/ */

    

pica9 / campaign-drive-api-client example snippets




$api = new Pica9\CampaignDrive\ApiClient\DefaultApi;
$api->getApiClient()->getConfig()
    ->setHost('https://your-campaign-drive-domain.com');
try {
    $token = $api->createToken(
        "client_credentials",
        "your-client-id",
        "your-client-secret",
        "read:document"
    );
    $api->getApiClient()->getConfig()
        ->setAccessToken($token->getAccessToken());
    $doc = $api->getDocumentById(1);
    echo $doc->getName();
} catch (\Pica9\CampaignDrive\ApiClient\ApiException $e) {
    echo "Error encountered!\n";
    echo $e->getResponseObject()->getReasonPhrase();
}