-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
66 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,70 @@ composer require ticketpark/php-api-client | |
``` | ||
|
||
## Usage | ||
See example.php | ||
|
||
### Getting data (GET) | ||
|
||
```php | ||
<?php | ||
|
||
include('vendor/autoload.php'); | ||
|
||
$client = new \Ticketpark\ApiClient\TicketparkApiClient('yourApiKey', 'yourApiSecret'); | ||
$client->setUserCredentials('[email protected]', 'yourPassword'); | ||
|
||
$response = $client->get('/events/', ['maxResults' => 2]); | ||
|
||
if ($response->isSuccessful()) { | ||
$data = $response->getContent(); | ||
} | ||
``` | ||
|
||
### Creating data (POST) | ||
|
||
```php | ||
<?php | ||
|
||
include('vendor/autoload.php'); | ||
|
||
$client = 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); | ||
} | ||
``` | ||
|
||
### Updating data (PATCH) | ||
|
||
```php | ||
<?php | ||
|
||
include('vendor/autoload.php'); | ||
|
||
$client = 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 | ||
} | ||
``` | ||
|
||
|
||
## User credentials | ||
Get in touch with us to get your user credentials: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters