PHP code example of ticketpark / php-api-client

1. Go to this page and download the library: Download ticketpark/php-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/ */

    

ticketpark / php-api-client example snippets




nt = new \Ticketpark\ApiClient\TicketparkApiClient('yourApiKey', 'yourApiSecret');
$client->setUserCredentials('[email protected]', 'yourPassword');

$response = $client->get('/events/', ['maxResults' => 2]);

if ($response->isSuccessful()) {
    $data = $response->getContent();
}



nt = new \Ticketpark\ApiClient\TicketparkApiClient('yourApiKey', 'yourApiSecret');
$client->setUserCredentials('[email protected]', 'yourPassword');

$response = $client->post('/events/', [
    'host' => 'yourHostPid',
    'name' => 'Some great event',
    'currency' => 'CHF'
]);

if ($response->isSuccessful()) {
    $pidOfNewEvent = $response->getGeneratedPid();
    
    // if you created a collection of records, the response will contain a link instead
    // that can be used to fetch the data of the newly generated records.
    //
    // $path = $response->getGeneratedListLink();
    // $newResponse = $client->get($path);
}



nt = new \Ticketpark\ApiClient\TicketparkApiClient('yourApiKey', 'yourApiSecret');
$client->setUserCredentials('[email protected]', 'yourPassword');

$response = $client->patch('/events/yourEventPid', [
    'name' => 'Some changed event name'
]

if ($response->isSuccessful()) {
    // Data was successfully updated
}

composer