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 $serviceContextThe context
Details
- Type
- \ServiceContext
- Inherited_from
- \RestHandler::serviceContext
Methods

CallRestService(\RequestParameters $requestParameters, string $requestBody, string $oauthRequestUri) : arrayCalls 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) : arrayReturns 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) : arrayReturns 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) : voidReturns 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) : voidInitializes a new instance of the SyncRestHandler class.
Parameters
| Name | Type | Description |
|---|---|---|
| $context | \ServiceContext | The context |

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

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

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