Closed Px-Factor closed 3 years ago
I believe you have to use the http info method option.
https://github.com/XeroAPI/xero-php-oauth2#accessing-http-headers
On Aug 25, 2021, at 9:51 AM, Golan Cohen @.***> wrote:
SDK you're using (please complete the following information):
Version [e.g. 2.8.1] Not a bug, but neither a feature request...
In version 1 of the API it was possible to get the status of a request to the API by doing (for example, when creating a new contact):
$xeroOAuth = new XeroOAuth($signatures); $xeroOAuth->request('POST', $xXeroOAuth->url('Contacts', 'core'), array(), $xml, 'json'); if ($response->Status == 'OK') { // Do something } else { // Do something else } What would be the equivalent of this in version 2? Example code:
$contact = new \XeroAPI\XeroPHP\Models\Accounting\Contact; $contact->setName('Contact name');
$contacts = new \XeroAPI\XeroPHP\Models\Accounting\Contacts;
$accountingApi = new \XeroAPI\XeroPHP\Api\AccountingApi( new \GuzzleHttp\Client(), $config ); $apiResult = $accountingApi->createContacts('', $contacts); How do I get the status from $apiResult? I have tried $apiResult->Status, $apiResult->getStatus() and $apiResult->GetStatus() and neither of them works...
Thanks!
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.
Thanks SerKnight! That did the trick.
SDK you're using (please complete the following information):
Not a bug, but neither a feature request...
In version 1 of the API it was possible to get the status of a request to the API by doing (for example, when creating a new contact):
What would be the equivalent of this in version 2? Example code:
How do I get the status from $apiResult? I have tried $apiResult->Status, $apiResult->getStatus() and $apiResult->GetStatus() and neither of them works...
Thanks!