(domains)
Create a domain for the authenticated workspace.
from dub import Dub
with Dub(
token="DUB_API_KEY",
) as dub:
res = dub.domains.create(request={
"slug": "acme.com",
"expired_url": "https://acme.com/expired",
"not_found_url": "https://acme.com/not-found",
"archived": False,
"placeholder": "https://dub.co/help/article/what-is-dub",
})
assert res is not None
# Handle response
print(res)
components.DomainSchema
Error Type |
Status Code |
Content Type |
errors.BadRequest |
400 |
application/json |
errors.Unauthorized |
401 |
application/json |
errors.Forbidden |
403 |
application/json |
errors.NotFound |
404 |
application/json |
errors.Conflict |
409 |
application/json |
errors.InviteExpired |
410 |
application/json |
errors.UnprocessableEntity |
422 |
application/json |
errors.RateLimitExceeded |
429 |
application/json |
errors.InternalServerError |
500 |
application/json |
errors.SDKError |
4XX, 5XX |
*/* |
Retrieve a list of domains associated with the authenticated workspace.
from dub import Dub
with Dub(
token="DUB_API_KEY",
) as dub:
res = dub.domains.list(request={
"page": 1,
"page_size": 50,
})
while res is not None:
# Handle items
res = res.next()
operations.ListDomainsResponse
Error Type |
Status Code |
Content Type |
errors.BadRequest |
400 |
application/json |
errors.Unauthorized |
401 |
application/json |
errors.Forbidden |
403 |
application/json |
errors.NotFound |
404 |
application/json |
errors.Conflict |
409 |
application/json |
errors.InviteExpired |
410 |
application/json |
errors.UnprocessableEntity |
422 |
application/json |
errors.RateLimitExceeded |
429 |
application/json |
errors.InternalServerError |
500 |
application/json |
errors.SDKError |
4XX, 5XX |
*/* |
Update a domain for the authenticated workspace.
from dub import Dub
with Dub(
token="DUB_API_KEY",
) as dub:
res = dub.domains.update(slug="acme.com", request_body={
"slug": "acme.com",
"expired_url": "https://acme.com/expired",
"not_found_url": "https://acme.com/not-found",
"archived": False,
"placeholder": "https://dub.co/help/article/what-is-dub",
})
assert res is not None
# Handle response
print(res)
components.DomainSchema
Error Type |
Status Code |
Content Type |
errors.BadRequest |
400 |
application/json |
errors.Unauthorized |
401 |
application/json |
errors.Forbidden |
403 |
application/json |
errors.NotFound |
404 |
application/json |
errors.Conflict |
409 |
application/json |
errors.InviteExpired |
410 |
application/json |
errors.UnprocessableEntity |
422 |
application/json |
errors.RateLimitExceeded |
429 |
application/json |
errors.InternalServerError |
500 |
application/json |
errors.SDKError |
4XX, 5XX |
*/* |
Delete a domain from a workspace. It cannot be undone. This will also delete all the links associated with the domain.
from dub import Dub
with Dub(
token="DUB_API_KEY",
) as dub:
res = dub.domains.delete(slug="acme.com")
assert res is not None
# Handle response
print(res)
Parameter |
Type |
Required |
Description |
Example |
slug |
str |
✔️ |
The domain name. |
acme.com |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
|
operations.DeleteDomainResponseBody
Error Type |
Status Code |
Content Type |
errors.BadRequest |
400 |
application/json |
errors.Unauthorized |
401 |
application/json |
errors.Forbidden |
403 |
application/json |
errors.NotFound |
404 |
application/json |
errors.Conflict |
409 |
application/json |
errors.InviteExpired |
410 |
application/json |
errors.UnprocessableEntity |
422 |
application/json |
errors.RateLimitExceeded |
429 |
application/json |
errors.InternalServerError |
500 |
application/json |
errors.SDKError |
4XX, 5XX |
*/* |