robwittman / shopify-php-sdk

PHP SDK for development with the Shopify API
MIT License
65 stars 41 forks source link

how to get shopify http response header using shopify-php-sdk? #17

Closed lyongdee closed 5 years ago

lyongdee commented 6 years ago

how to get shopify http response header using shopify-php-sdk?

lyongdee commented 6 years ago

@robwittman I want to control API limit call, how to do it.

robwittman commented 5 years ago

After merging https://github.com/robwittman/shopify-php-sdk/pull/30, you can access the response headers by accessing the $lastResponse object.

$service = new ExampleSerivice($apiInstance);
$res = $service->someMethod($params);
$lastResponse = $service->getLastResponse();
# $lastResponse is instance of GuzzleHttp\Psr7\Response

I'll update with new tag when a new version is released

robwittman commented 5 years ago

@lyongdee Release 2.3.0 adds getLastResponse for getting the raw Guzzle response from a service. This can be used to access any information Guzzle exposes directly