kobas/api-client

2.4 2021-03-23 14:15 UTC

This package is auto-updated.

Last update: 2024-04-18 15:23:29 UTC


README

Latest Version Software License Build Status Documentation Coverage Status Quality Score Total Downloads

Signs API requests and allows interaction via cURL methods.

Example

/**
 * Setup
 */
$companyId = 0000;// company id provided by Kobas
$clientId = '';// client id provided by Kobas
$clientSecret = '';// client secret provided by Kobas
$clientScope = ''; // client scope provided by Kobas

$provider = new \Kobas\APIClient\Auth\Provider($companyId, $clientId, $clientSecret, $clientScope);
$client = new \Kobas\APIClient\Client($provider);

/**
 * Usage
 */
$response = $client->get('customer/search', ['email' => 'example@example.com']);
echo json_encode($response, JSON_PRETTY_PRINT);

Client Functions

get($route, $params = array(), $headers = array())

Sends a HTTP GET Request to the route provided.

post($route, $params = array(), $headers = array())

Sends a HTTP POST Request to the route provided.

put($route, $params = array(), $headers = array())

Sends a HTTP PUT Request to the route provided.

delete($route, $params = array(), $headers = array())

Sends a HTTP DELETE Request to the route provided.

getRequestInfo()

Returns the result of curl_getinfo()on the last request made as an array.

setAPIBaseURL($url)

Allows over-riding the base URL (only really needed for development)

setAPIVersion($version)

Allows over-riding of the API version. Might be useful in future?