Core/RestCalls/SyncRestHandler.php
- Package
- Default
\SyncRestHandler
Package: Default








SyncRestHandler contains the logic for preparing the REST request, calls REST services and returns the response.
- Parent(s)
- \RestHandler
- Inherited_from
- \RestHandler
Properties


\ServiceContext $serviceContext
The context
Details
- Type
- \ServiceContext
- Inherited_from
- \RestHandler::serviceContext
Methods


CallRestService(\RequestParameters $requestParameters, string $requestBody, string $oauthRequestUri) : array
Calls the rest service.
Parameters
Returns
Name | Type | Description |
---|---|---|
$requestParameters | \RequestParameters | The parameters |
$requestBody | string | The request body |
$oauthRequestUri | string | The OAuth request uri |
Type | Description |
---|---|
array | elements are 0: HTTP response code; 1: HTTP response body |


GetOAuthResponseHeaders(\OAuth $oauth) : array
Returns the response headers, response body and response code from a called OAuth object
Parameters
Returns
Name | Type | Description |
---|---|---|
$oauth | \OAuth | A called OAuth object |
Type | Description |
---|---|
array | elements are 0: HTTP response code; 1: response content, 2: HTTP response headers |


GetResponse(\ServiceContext $requestParameters, string $requestBody, string $oauthRequestUri) : array
Returns the response by calling REST service.
Parameters
Returns
Name | Type | Description |
---|---|---|
$requestParameters | \ServiceContext | The parameters |
$requestBody | string | The request body |
$oauthRequestUri | string | The OAuth request uri |
Type | Description |
---|---|
array | elements are 0: HTTP response code; 1: HTTP response body |


GetResponseSyncRest(\RequestParameters $requestParameters, string $requestBody, string $oauthRequestUri) : void
Returns the response by calling REST service.
Parameters
Name | Type | Description |
---|---|---|
$requestParameters | \RequestParameters | The parameters |
$requestBody | string | The request body |
$oauthRequestUri | string | The OAuth request uri |


SyncRestHandler(\ServiceContext $context) : void
Initializes a new instance of the SyncRestHandler class.
Parameters
Name | Type | Description |
---|---|---|
$context | \ServiceContext | The context |


__construct(\ServiceContext $context) : void
inherited
Initializes a new instance of the RestHandler class.
Inherited from:Parameters
Name | Type | Description |
---|---|---|
$context | \ServiceContext | The Service Context |


getAcceptContentType(\type $value) : string
Accept anything if content type is not XML or Json
Parameters
Returns
Name | Type | Description |
---|---|---|
$value | \type |
Type | Description |
---|---|
string |


getLastError() : void
Return an representation of an error returned by the last request, or false if the last request was not an error.