Webservice
in package
Class Webservice
Authenticates with & retrieves data from KNV's API
Table of Contents
- $headers : array<string|int, mixed>
- HTTP request headers
- $token : string|null
- Token retrieved when first connecting to KNV's API
- $url : string
- Base URL
- $client : Client
- HTTP client used for connecting to KNV's API
- $offlineMode : bool
- Whether to work offline (cached books only)
- __construct() : void
- Constructor
- cmpaket() : stdClass
- Retrieves information about CMP ('Category Management Pakete')
- ebook() : stdClass
- Retrieves download link for eBooks
- filter() : stdClass
- Provides predefined filters
- login() : bool
- Authenticates with KNV's API
- ola() : stdClass
- Checks product availability via OLA ('Online Lieferbarkeits-Abfrage')
- register() : stdClass
- Provides matching search terms for specific field entry
- suche() : mixed
- Fetches raw product data from KNV's API
- suchvorschlaege() : stdClass
- Provides matching search terms for any field entry
- call() : stdClass
- Makes API calls
Properties
$headers
HTTP request headers
public
array<string|int, mixed>
$headers
= []
$token
Token retrieved when first connecting to KNV's API
public
string|null
$token
= null
$url
Base URL
public
string
$url
= 'https://ws.pcbis.de/ws30'
$client
HTTP client used for connecting to KNV's API
private
Client
$client
$offlineMode
Whether to work offline (cached books only)
private
bool
$offlineMode
= false
Methods
__construct()
Constructor
public
__construct([array<string|int, mixed> $credentials = null ]) : void
Parameters
- $credentials : array<string|int, mixed> = null
-
Login credentials
Return values
void —cmpaket()
Retrieves information about CMP ('Category Management Pakete')
public
cmpaket(array<string|int, mixed> $query) : stdClass
Parameters
- $query : array<string|int, mixed>
-
Query data
Return values
stdClass —Response body as JSON object
ebook()
Retrieves download link for eBooks
public
ebook(array<string|int, mixed>|string $query) : stdClass
Parameters
- $query : array<string|int, mixed>|string
-
Query data
Return values
stdClass —Response body as JSON object
filter()
Provides predefined filters
public
filter(array<string|int, mixed> $query[, string $groupID = null ]) : stdClass
Parameters
- $query : array<string|int, mixed>
-
Query data
- $groupID : string = null
-
Filter group identifier
Return values
stdClass —Response body as JSON object
login()
Authenticates with KNV's API
public
login(array<string|int, mixed> $credentials) : bool
Parameters
- $credentials : array<string|int, mixed>
-
Login credentials
Return values
bool —ola()
Checks product availability via OLA ('Online Lieferbarkeits-Abfrage')
public
ola(array<string|int, mixed>|string $query[, int $quantity = 1 ][, string $type = 'anfrage' ]) : stdClass
Parameters
- $query : array<string|int, mixed>|string
-
Query data
- $quantity : int = 1
-
Number of products to be delivered
- $type : string = 'anfrage'
-
OLA type (either 'anfrage', 'bestellung' or 'storno')
Return values
stdClass —Response body as JSON object
register()
Provides matching search terms for specific field entry
public
register(array<string|int, mixed> $query) : stdClass
Parameters
- $query : array<string|int, mixed>
-
Query data
Return values
stdClass —Response body as JSON object
suche()
Fetches raw product data from KNV's API
public
suche(array<string|int, mixed>|string $query) : mixed
Parameters
- $query : array<string|int, mixed>|string
-
Query data
Return values
mixed —Response body as JSON object
suchvorschlaege()
Provides matching search terms for any field entry
public
suchvorschlaege(array<string|int, mixed>|string $query) : stdClass
Parameters
- $query : array<string|int, mixed>|string
-
Query data
Return values
stdClass —Response body as JSON object
call()
Makes API calls
private
call(string $resource, array<string|int, mixed> $data[, string $type = 'POST' ]) : stdClass
Parameters
- $resource : string
-
API resource being called
- $data : array<string|int, mixed>
-
Data being sent as JSON object
- $type : string = 'POST'
-
Request type (mostly 'POST')
Tags
Return values
stdClass —Response body as JSON object