(vault->consumers)
- create - Create consumer
- list - Get all consumers
- delete - Delete consumer
- get - Get consumer
- update - Update consumer
Create a consumer
declare(strict_types=1);
require 'vendor/autoload.php';
use Apideck\Unify;
use Apideck\Unify\Models\Components;
$sdk = Unify\Apideck::builder()
->setSecurity(
'<YOUR_BEARER_TOKEN_HERE>'
)
->setConsumerId('test-consumer')
->setAppId('dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX')
->build();
$consumer = new Components\ConsumerInput(
consumerId: 'test_consumer_id',
metadata: new Components\ConsumerMetadata(
accountName: 'SpaceX',
userName: 'Elon Musk',
email: '[email protected]',
image: 'https://www.spacex.com/static/images/share.jpg',
),
);
$response = $sdk->vault->consumers->create(
consumer: $consumer,
appId: 'dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX'
);
if ($response->createConsumerResponse !== null) {
// handle response
}
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
consumer |
Components\ConsumerInput | ✔️ | 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;
$sdk = Unify\Apideck::builder()
->setSecurity(
'<YOUR_BEARER_TOKEN_HERE>'
)
->setConsumerId('test-consumer')
->setAppId('dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX')
->build();
$responses = $sdk->vault->consumers->list(
appId: 'dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX',
limit: 20,
cursor: '<value>'
);
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 |
limit |
?int | ➖ | Number of results to return. Minimum 1, Maximum 200, Default 20 | |
cursor |
?string | ➖ | Cursor to start from. You can find cursors for next/previous pages in the meta.cursors property of the response. |
?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 | */* |
Delete consumer and all their connections, including credentials.
declare(strict_types=1);
require 'vendor/autoload.php';
use Apideck\Unify;
$sdk = Unify\Apideck::builder()
->setSecurity(
'<YOUR_BEARER_TOKEN_HERE>'
)
->setConsumerId('test-consumer')
->setAppId('dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX')
->build();
$response = $sdk->vault->consumers->delete(
consumerId: 'test_user_id',
appId: 'dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX'
);
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 | */* |
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()
->setSecurity(
'<YOUR_BEARER_TOKEN_HERE>'
)
->setConsumerId('test-consumer')
->setAppId('dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX')
->build();
$response = $sdk->vault->consumers->get(
consumerId: 'test_user_id',
appId: 'dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX'
);
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()
->setSecurity(
'<YOUR_BEARER_TOKEN_HERE>'
)
->setConsumerId('test-consumer')
->setAppId('dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX')
->build();
$updateConsumerRequest = new Components\UpdateConsumerRequest(
metadata: new Components\ConsumerMetadata(
accountName: 'SpaceX',
userName: 'Elon Musk',
email: '[email protected]',
image: 'https://www.spacex.com/static/images/share.jpg',
),
);
$response = $sdk->vault->consumers->update(
consumerId: 'test_user_id',
updateConsumerRequest: $updateConsumerRequest,
appId: 'dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX'
);
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 | */* |