PHP
The PHP SDK includes everything you need to get started: Method wrappers for all API endpoints, related domain/DTO classes, utility functions to handle dates, build search queries and generate OAuth PKCE challenges, and even an embedded Hawk module to handle the authentication protocol. It requires PHP 8.1 or greater but has no other external dependencies.
In general, null
means not specified in this SDK (like undefined
in JavaScript). To explicitly erase a property,
set it to \Onslip360\nil
, which behaves more like null
in JSON and JavaScript.
Every enumerations (enum
) in the SDK contains an additional __
value, which is used if the server sends an unknown
value to the client. It maps to --
, which the server will never accept back. If this happens, make sure you're using
the latest version of the SDK, which always contains definitions for all possible enumerations. In practice, however,
this should rarely happen as you should always prefer the update…
(PATCH
) methods for modifying resources instead
of get…
/put…
(GET
/PUT
) pairs.
Adding the SDK to your project
The SDK is freely available and is published on Packagist.
Install it with composer
:
composer require onslip/onslip-360-api
Initialize the SDK
The SDK is initialized with a default CURL-based request handler automatically and requires no further initialization (unless you want to plug in a custom request handler).
Create an API instance and make a request
Let's make the first call to the API server:
$rmd = new ResponseMetadata;
$api = (new API('https://test.onslip360.com/v1/', '<realm>', 'key:<username>+<keyname>@<realm>', '<key>'))
->appName('MyAwesomeClient/1.0')
->onResponseMetadata($rmd);
$me = $api->getClientInfo();
printf("Me: %s\n", print_r($me, true));
Don't yet have an API key? Log in to your Onslip 360 Backoffice account at https://test.onslip360.com, go to API Keys via the top-right user menu and create one!
When you are ready to go to production, simply change the API base URL from https://test.onslip360.com/v1/ to https://api.onslip360.com/v1/. You should also use OAuth to promote your work and make it easy for your customers to activate the integration.
Next steps
To learn more about the API, please refer to the Onslip 360 API User Guide.
Download the SDK sample
We provide a small demo on GitHub. Go check it out!
Questions?
Send your questions to api@onslip.com.