Download the PHP package fw4/realo-api-client without Composer
On this page you can find all versions of the php package fw4/realo-api-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package realo-api-client
Realo API PHP Library
A PHP library for using the Realo REST API.
Before using this library, you must have a valid API Key. To get an API Key, please contact your Realo customer success manager.
Installation
As a composer dependency (Recommended)
The recommended way to install the Realo PHP API client is through composer.
Next, run the composer command to install the Realo PHP API client:
After installing, you need to require Composer's autoloader:
Initialization
RealoApi::create(publicKey, privateKey, environment)
publicKey- Type:
string - API public key
- Type:
privateKey- Type:
string - API private key
- Type:
environment- Type:
string - Default value:
production - API environment (either
productionorsandbox)
- Type:
RealoApi::createWithClient(publicKey, privateKey, client)
publicKey- Type:
string - API public key
- Type:
privateKey- Type:
string - API private key
- Type:
client- Type:
GuzzleHttp\Client - Guzzle HTTP client, used for communicating with the REST API
- Type:
Methods
request(path, method, [, payload [, headers]])
path- Type:
string - The path of the resource
- Type:
method- Type:
string - HTTP method for request
- Type:
payload- Type:
array - HTTP payload (to be encoded as JSON), only applies when the HTTP method is not
GET
- Type:
headers- Type:
array - Custom headers to be sent with the request.
- Type:
Examples
Use The Bundled CLI Tool
We provide a simple CLI utility which you can use to interact with our API.
Send An API Call Using The Request Function
We provide a base request function to access any of our API resources.
Exceptions
An exception will be thrown in two cases: there is a problem with the request or the server returns a status code of 400 or higher.
RealoApiException
- getCode()
- Returns the response status code of
400or higher.
- Returns the response status code of
- getMessage()
- Returns the exception message.
- getErrors()
- If there is a response body containing an
arrayof errors, return these. Otherwise returnsnull.
- If there is a response body containing an
- getType()
- If there is a response body containing an error, return its type. Otherwise returns
null.
- If there is a response body containing an error, return its type. Otherwise returns