(links)
Create a new link for the authenticated workspace.
from dub import Dub
with Dub(
token="DUB_API_KEY",
) as dub:
res = dub.links.create(request={
"url": "https://google.com",
"external_id": "123456",
"tag_ids": [
"clux0rgak00011...",
],
})
assert res is not None
# Handle response
print(res)
components.LinkSchema
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 paginated list of links for the authenticated workspace.
from dub import Dub
with Dub(
token="DUB_API_KEY",
) as dub:
res = dub.links.list(request={
"page": 1,
"page_size": 50,
})
while res is not None:
# Handle items
res = res.next()
operations.GetLinksResponse
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 the number of links for the authenticated workspace.
from dub import Dub
with Dub(
token="DUB_API_KEY",
) as dub:
res = dub.links.count(request={})
assert res is not None
# Handle response
print(res)
float
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 the info for a link.
from dub import Dub
with Dub(
token="DUB_API_KEY",
) as dub:
res = dub.links.get(request={
"link_id": "clux0rgak00011...",
"external_id": "123456",
})
assert res is not None
# Handle response
print(res)
components.LinkSchema
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 link for the authenticated workspace. If there's no change, returns it as it is.
from dub import Dub
with Dub(
token="DUB_API_KEY",
) as dub:
res = dub.links.update(link_id="<value>", request_body={
"url": "https://google.com",
"external_id": "123456",
"tag_ids": [
"clux0rgak00011...",
],
})
assert res is not None
# Handle response
print(res)
components.LinkSchema
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 link for the authenticated workspace.
from dub import Dub
with Dub(
token="DUB_API_KEY",
) as dub:
res = dub.links.delete(link_id="<value>")
assert res is not None
# Handle response
print(res)
Parameter |
Type |
Required |
Description |
link_id |
str |
✔️ |
The id of the link to delete. You may use either linkId (obtained via /links/info endpoint) or externalId prefixed with ext_ . |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
operations.DeleteLinkResponseBody
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 |
*/* |
Bulk create up to 100 links for the authenticated workspace.
from dub import Dub
with Dub(
token="DUB_API_KEY",
) as dub:
res = dub.links.create_many(request=[
{
"url": "https://google.com",
"external_id": "123456",
"tag_ids": [
"clux0rgak00011...",
],
},
])
assert res is not None
# Handle response
print(res)
List[components.LinkSchema]
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 |
*/* |
Bulk update up to 100 links with the same data for the authenticated workspace.
from dub import Dub
with Dub(
token="DUB_API_KEY",
) as dub:
res = dub.links.update_many(request={
"data": {
"url": "https://google.com",
"tag_ids": [
"clux0rgak00011...",
],
},
"link_ids": [
"<value>",
],
})
assert res is not None
# Handle response
print(res)
List[components.LinkSchema]
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 |
*/* |
Bulk delete up to 100 links for the authenticated workspace.
from dub import Dub
with Dub(
token="DUB_API_KEY",
) as dub:
res = dub.links.delete_many(request={
"link_ids": [
"clux0rgak00011...",
"clux0rgak00022...",
],
})
assert res is not None
# Handle response
print(res)
operations.BulkDeleteLinksResponseBody
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 |
*/* |
Upsert a link for the authenticated workspace by its URL. If a link with the same URL already exists, return it (or update it if there are any changes). Otherwise, a new link will be created.
from dub import Dub
with Dub(
token="DUB_API_KEY",
) as dub:
res = dub.links.upsert(request={
"url": "https://google.com",
"external_id": "123456",
"tag_ids": [
"clux0rgak00011...",
],
})
assert res is not None
# Handle response
print(res)
components.LinkSchema
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 |
*/* |