Reputation: 190
The API url is =, i'm trying to implement: https://docs.ingresso.co.uk/#basic-booking-flow
My Code for in OctoberCMS with GuzzleHttp\Client object.
$credentials = base64_encode('demo:demopass');
$client = new Client();
$request_url = 'https://demo.ticketswitch.com/f13/events.v1/';
$response = $client->request('GET', $request_url, [
'headers' => ['Accept' => 'application/json','Authorization' => 'Basic ' . $credentials,],
'auth' => ['demo', 'demopass'],
'timeout' => 120
])->getBody()->getContents();
echo "<pre>";
print_r($response);
die();
The error got by sending the request is
i'm reading all suggested question while i'm adding my title for question and there is no clue or help regarding the problem... Help.....
Note: Api credentials can use by any user or developer,
Upvotes: 5
Views: 198
Reputation: 61875
The error indicates the request must gzip: "You must support gzip [to use this API]".
This is controlled via the Accept-Encoding header sent to the server:
The Accept-Encoding request HTTP header advertises which content encoding, usually a compression algorithm, the client is able to understand..
The server is enforcing this to ensure clients save bandwidth, through use of compression, when using the API. This may reduce the hosting costs and/or improve request performance. The F13 documentation simply notes "gzip must be used for all requests".
Use of enabling gzip transport compression is covered in the Guzzle Request Options documentation:
// Request gzipped data and automatically decode/decompress it
$client->request('GET', '/foo.js', [
'headers' => ['Accept-Encoding' => 'gzip'],
'decode_content' => true // default is true, added to be explicit
]);
or, more simply
// Pass "gzip" as the Accept-Encoding header and automatically decode/decompress
$client->request('GET', '/foo.js', ['decode_content' => 'gzip']);
When [decode_content is set] to a string, the bytes of a response are decoded and the string value provided to the decode_content option is passed as the Accept-Encoding header of the request.
Upvotes: 3