Skip to content

Commit

Permalink
Adjust dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
sprain committed Oct 11, 2023
1 parent 0937fc9 commit c7f27fa
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 3 deletions.
65 changes: 64 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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('your@username.com', '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('your@username.com', '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('your@username.com', '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:
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"description": "A PHP client to use the Ticketpark API",
"type": "library",
"require": {
"php": ">=8.1",
"guzzlehttp/guzzle": "^7.8"
"php": "^8.1|^8.2",
"guzzlehttp/guzzle": "^6.5|^7.5"
},
"license": "MIT",
"authors": [
Expand Down

0 comments on commit c7f27fa

Please sign in to comment.