- create - Create consumer
- list - Get all consumers
- get - Get consumer
- update - Update consumer
- delete - Delete consumer
Create a consumer
declare(strict_types=1);
require 'vendor/autoload.php';
use Apideck\Unify;
use Apideck\Unify\Models\Components;
$sdk = Unify\Apideck::builder()
->setAppId('dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX')
->setSecurity(
'<YOUR_BEARER_TOKEN_HERE>'
)
->build();
$createConsumerRequest = new Components\CreateConsumerRequest(
consumerId: 'test_consumer_id',
metadata: new Components\ConsumerMetadata(
accountName: 'SpaceX',
userName: 'Elon Musk',
email: 'elon@musk.com',
image: 'https://www.spacex.com/static/images/share.jpg',
),
);
$response = $sdk->vault->consumers->create(
createConsumerRequest: $createConsumerRequest
);
if ($response->createConsumerResponse !== null) {
// handle response
}| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
createConsumerRequest |
Components\CreateConsumerRequest | ✔️ | N/A | |
appId |
?string | ➖ | The ID of your Unify application | dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX |
?Operations\VaultConsumersAddResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| Errors\BadRequestResponse | 400 | application/json |
| Errors\UnauthorizedResponse | 401 | application/json |
| Errors\PaymentRequiredResponse | 402 | application/json |
| Errors\NotFoundResponse | 404 | application/json |
| Errors\UnprocessableResponse | 422 | application/json |
| Errors\APIException | 4XX, 5XX | */* |
This endpoint includes all application consumers, along with an aggregated count of requests made.
declare(strict_types=1);
require 'vendor/autoload.php';
use Apideck\Unify;
use Apideck\Unify\Models\Components;
$sdk = Unify\Apideck::builder()
->setAppId('dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX')
->setSecurity(
'<YOUR_BEARER_TOKEN_HERE>'
)
->build();
$filter = new Components\ConsumersFilter(
consumerId: 'test-consumer',
search: 'john',
);
$responses = $sdk->vault->consumers->list(
filter: $filter,
limit: 20
);
foreach ($responses as $response) {
if ($response->httpMeta->response->getStatusCode() === 200) {
// handle response
}
}| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
appId |
?string | ➖ | The ID of your Unify application | dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX |
filter |
?Components\ConsumersFilter | ➖ | Filter results | |
cursor |
?string | ➖ | Cursor to start from. You can find cursors for next/previous pages in the meta.cursors property of the response. | |
limit |
?int | ➖ | Number of results to return. Minimum 1, Maximum 200, Default 20 |
?Operations\VaultConsumersAllResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| Errors\BadRequestResponse | 400 | application/json |
| Errors\UnauthorizedResponse | 401 | application/json |
| Errors\PaymentRequiredResponse | 402 | application/json |
| Errors\NotFoundResponse | 404 | application/json |
| Errors\UnprocessableResponse | 422 | application/json |
| Errors\APIException | 4XX, 5XX | */* |
Consumer detail including their aggregated counts with the connections they have authorized.
declare(strict_types=1);
require 'vendor/autoload.php';
use Apideck\Unify;
$sdk = Unify\Apideck::builder()
->setAppId('dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX')
->setSecurity(
'<YOUR_BEARER_TOKEN_HERE>'
)
->build();
$response = $sdk->vault->consumers->get(
consumerId: 'test_user_id'
);
if ($response->getConsumerResponse !== null) {
// handle response
}| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
consumerId |
string | ✔️ | ID of the consumer to return | test_user_id |
appId |
?string | ➖ | The ID of your Unify application | dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX |
?Operations\VaultConsumersOneResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| Errors\BadRequestResponse | 400 | application/json |
| Errors\UnauthorizedResponse | 401 | application/json |
| Errors\PaymentRequiredResponse | 402 | application/json |
| Errors\NotFoundResponse | 404 | application/json |
| Errors\UnprocessableResponse | 422 | application/json |
| Errors\APIException | 4XX, 5XX | */* |
Update consumer metadata such as name and email.
declare(strict_types=1);
require 'vendor/autoload.php';
use Apideck\Unify;
use Apideck\Unify\Models\Components;
$sdk = Unify\Apideck::builder()
->setAppId('dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX')
->setSecurity(
'<YOUR_BEARER_TOKEN_HERE>'
)
->build();
$updateConsumerRequest = new Components\UpdateConsumerRequest(
metadata: new Components\ConsumerMetadata(
accountName: 'SpaceX',
userName: 'Elon Musk',
email: 'elon@musk.com',
image: 'https://www.spacex.com/static/images/share.jpg',
),
);
$response = $sdk->vault->consumers->update(
consumerId: 'test_user_id',
updateConsumerRequest: $updateConsumerRequest
);
if ($response->updateConsumerResponse !== null) {
// handle response
}| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
consumerId |
string | ✔️ | ID of the consumer to return | test_user_id |
updateConsumerRequest |
Components\UpdateConsumerRequest | ✔️ | N/A | |
appId |
?string | ➖ | The ID of your Unify application | dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX |
?Operations\VaultConsumersUpdateResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| Errors\BadRequestResponse | 400 | application/json |
| Errors\UnauthorizedResponse | 401 | application/json |
| Errors\PaymentRequiredResponse | 402 | application/json |
| Errors\NotFoundResponse | 404 | application/json |
| Errors\UnprocessableResponse | 422 | application/json |
| Errors\APIException | 4XX, 5XX | */* |
Delete consumer and all their connections, including credentials.
declare(strict_types=1);
require 'vendor/autoload.php';
use Apideck\Unify;
$sdk = Unify\Apideck::builder()
->setAppId('dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX')
->setSecurity(
'<YOUR_BEARER_TOKEN_HERE>'
)
->build();
$response = $sdk->vault->consumers->delete(
consumerId: 'test_user_id'
);
if ($response->deleteConsumerResponse !== null) {
// handle response
}| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
consumerId |
string | ✔️ | ID of the consumer to return | test_user_id |
appId |
?string | ➖ | The ID of your Unify application | dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX |
?Operations\VaultConsumersDeleteResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| Errors\BadRequestResponse | 400 | application/json |
| Errors\UnauthorizedResponse | 401 | application/json |
| Errors\PaymentRequiredResponse | 402 | application/json |
| Errors\NotFoundResponse | 404 | application/json |
| Errors\UnprocessableResponse | 422 | application/json |
| Errors\APIException | 4XX, 5XX | */* |