Skip to content

About

Contract Management API for DSD

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

5 Commits

Folders and files

Repository files navigation

DSD Contract Management API PHP client

A PHP 8.4+ wrapper for the DSD Contract Management API v1. Also supports listing and retrieving clients from the DSD End Client API v1.

Method Endpoint Client method
GET /v1/contracts $api->contracts()->list()
GET /v1/contracts/{id} $api->contracts()->get($id)
GET /v1/products $api->products()->list()
GET /v1/products/{sku} $api->products()->get($sku)
GET /v1/end-clients $api->endClients()->list()
GET /v1/end-clients/{clientId} $api->endClients()->get($clientId)

The documentation specifies bearer authentication and does not document a token issuance or refresh endpoint. Obtain your token from DSD.

Installation

composer require inserve/dsd-contract-management-api-php`

Inject the client into a controller, service, or job:

use Inserve\DSDContractManagementAPI\DSDContractManagementAPIClient;
use Inserve\DSDContractManagementAPI\Options\ContractFilters;

$token = 'access.token';
$api = DSDContractManagementAPIClient::create(accessToken: $token);

var_dump($api->contracts()->list(offset: 0, limit: 1));

End-client requests use https://end-client-api.dsdeurope.com and share the access token with contracts and products, including updates through setAccessToken(). The existing baseUri option still applies to contracts and products; use endClientBaseUri in create() or the injected APIClient to override the end-client origin.

use Inserve\DSDContractManagementAPI\Options\EndClientFilters;

$page = $api->endClients()->list(
    offset: 0,
    limit: 20,
    filters: new EndClientFilters(active: true, company: 'Example BV'),
);
$client = $api->endClients()->get(7);

foreach ($api->endClients()->all(new EndClientFilters(country: 'NL')) as $client) {
    echo $client->getName();
}

EndClientFilters supports active, name, firstName, lastName, company, postalCode, city, country, phone, email, numberCoc, and numberVat. List responses expose getResult() and getPagination(); all() fetches pages lazily.

Development

composer install
composer test

About

Contract Management API for DSD

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages