(vault.consumers)
- create - Create consumer
- list - Get all consumers
- get - Get consumer
- update - Update consumer
- delete - Delete consumer
Create a consumer
from apideck_unify import Apideck
import os
with Apideck(
api_key=os.getenv("APIDECK_API_KEY", ""),
consumer_id="test-consumer",
app_id="dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
) as apideck:
res = apideck.vault.consumers.create(consumer_id="test_consumer_id", metadata={
"account_name": "SpaceX",
"user_name": "Elon Musk",
"email": "elon@musk.com",
"image": "https://www.spacex.com/static/images/share.jpg",
})
assert res.create_consumer_response is not None
# Handle response
print(res.create_consumer_response)
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
consumer_id |
str | ✔️ | Unique consumer identifier. You can freely choose a consumer ID yourself. Most of the time, this is an ID of your internal data model that represents a user or account in your system (for example account:12345). If the consumer doesn't exist yet, Vault will upsert a consumer based on your ID. | test_consumer_id |
metadata |
Optional[models.ConsumerMetadata] | ➖ | The metadata of the consumer. This is used to display the consumer in the sidebar. This is optional, but recommended. | |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
models.VaultConsumersAddResponse
Error Type | Status Code | Content Type |
---|---|---|
models.BadRequestResponse | 400 | application/json |
models.UnauthorizedResponse | 401 | application/json |
models.PaymentRequiredResponse | 402 | application/json |
models.NotFoundResponse | 404 | application/json |
models.UnprocessableResponse | 422 | application/json |
models.APIError | 4XX, 5XX | */* |
This endpoint includes all application consumers, along with an aggregated count of requests made.
from apideck_unify import Apideck
import os
with Apideck(
api_key=os.getenv("APIDECK_API_KEY", ""),
consumer_id="test-consumer",
app_id="dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
) as apideck:
res = apideck.vault.consumers.list()
while res is not None:
# Handle items
res = res.next()
Parameter | Type | Required | Description |
---|---|---|---|
cursor |
OptionalNullable[str] | ➖ | Cursor to start from. You can find cursors for next/previous pages in the meta.cursors property of the response. |
limit |
Optional[int] | ➖ | Number of results to return. Minimum 1, Maximum 200, Default 20 |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
models.VaultConsumersAllResponse
Error Type | Status Code | Content Type |
---|---|---|
models.BadRequestResponse | 400 | application/json |
models.UnauthorizedResponse | 401 | application/json |
models.PaymentRequiredResponse | 402 | application/json |
models.NotFoundResponse | 404 | application/json |
models.UnprocessableResponse | 422 | application/json |
models.APIError | 4XX, 5XX | */* |
Consumer detail including their aggregated counts with the connections they have authorized.
from apideck_unify import Apideck
import os
with Apideck(
api_key=os.getenv("APIDECK_API_KEY", ""),
consumer_id="test-consumer",
app_id="dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
) as apideck:
res = apideck.vault.consumers.get(consumer_id="test_user_id")
assert res.get_consumer_response is not None
# Handle response
print(res.get_consumer_response)
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
consumer_id |
str | ✔️ | ID of the consumer to return | test_user_id |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
models.VaultConsumersOneResponse
Error Type | Status Code | Content Type |
---|---|---|
models.BadRequestResponse | 400 | application/json |
models.UnauthorizedResponse | 401 | application/json |
models.PaymentRequiredResponse | 402 | application/json |
models.NotFoundResponse | 404 | application/json |
models.UnprocessableResponse | 422 | application/json |
models.APIError | 4XX, 5XX | */* |
Update consumer metadata such as name and email.
from apideck_unify import Apideck
import os
with Apideck(
api_key=os.getenv("APIDECK_API_KEY", ""),
consumer_id="test-consumer",
app_id="dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
) as apideck:
res = apideck.vault.consumers.update(consumer_id="test_user_id", metadata={
"account_name": "SpaceX",
"user_name": "Elon Musk",
"email": "elon@musk.com",
"image": "https://www.spacex.com/static/images/share.jpg",
})
assert res.update_consumer_response is not None
# Handle response
print(res.update_consumer_response)
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
consumer_id |
str | ✔️ | ID of the consumer to return | test_user_id |
metadata |
Optional[models.ConsumerMetadata] | ➖ | The metadata of the consumer. This is used to display the consumer in the sidebar. This is optional, but recommended. | |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
models.VaultConsumersUpdateResponse
Error Type | Status Code | Content Type |
---|---|---|
models.BadRequestResponse | 400 | application/json |
models.UnauthorizedResponse | 401 | application/json |
models.PaymentRequiredResponse | 402 | application/json |
models.NotFoundResponse | 404 | application/json |
models.UnprocessableResponse | 422 | application/json |
models.APIError | 4XX, 5XX | */* |
Delete consumer and all their connections, including credentials.
from apideck_unify import Apideck
import os
with Apideck(
api_key=os.getenv("APIDECK_API_KEY", ""),
consumer_id="test-consumer",
app_id="dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
) as apideck:
res = apideck.vault.consumers.delete(consumer_id="test_user_id")
assert res.delete_consumer_response is not None
# Handle response
print(res.delete_consumer_response)
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
consumer_id |
str | ✔️ | ID of the consumer to return | test_user_id |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
models.VaultConsumersDeleteResponse
Error Type | Status Code | Content Type |
---|---|---|
models.BadRequestResponse | 400 | application/json |
models.UnauthorizedResponse | 401 | application/json |
models.PaymentRequiredResponse | 402 | application/json |
models.NotFoundResponse | 404 | application/json |
models.UnprocessableResponse | 422 | application/json |
models.APIError | 4XX, 5XX | */* |