Bulk create up to 100 links for the authenticated workspace.
from dub import Dub
with Dub(
token="DUB_API_KEY",
) as d_client:
res = d_client.links.create_many(request=[
{
"url": "https://google.com",
"external_id": "123456",
"tag_ids": [
"clux0rgak00011...",
],
"test_variants": [
{
"url": "https://example.com/variant-1",
"percentage": 50,
},
{
"url": "https://example.com/variant-2",
"percentage": 50,
},
],
},
])
assert res is not None
# Handle response
print(res)
[
{
"id": "<string>",
"domain": "<string>",
"key": "<string>",
"url": "<string>",
"trackConversion": false,
"externalId": "<string>",
"tenantId": "<string>",
"programId": "<string>",
"partnerId": "<string>",
"archived": false,
"expiresAt": "<string>",
"expiredUrl": "<string>",
"password": "<string>",
"proxy": false,
"title": "<string>",
"description": "<string>",
"image": "<string>",
"video": "<string>",
"rewrite": false,
"doIndex": false,
"ios": "<string>",
"android": "<string>",
"geo": {},
"publicStats": false,
"tags": [
{
"id": "<string>",
"name": "<string>",
"color": "red"
}
],
"folderId": "<string>",
"webhookIds": [
"<string>"
],
"comments": "<string>",
"shortLink": "<string>",
"qrCode": "<string>",
"utm_source": "<string>",
"utm_medium": "<string>",
"utm_campaign": "<string>",
"utm_term": "<string>",
"utm_content": "<string>",
"testVariants": [
{
"url": "https://example.com/variant-1",
"percentage": 50
},
{
"url": "https://example.com/variant-2",
"percentage": 50
}
],
"testStartedAt": "<string>",
"testCompletedAt": "<string>",
"userId": "<string>",
"workspaceId": "<string>",
"clicks": 0,
"leads": 0,
"conversions": 0,
"sales": 0,
"saleAmount": 0,
"lastClicked": "<string>",
"createdAt": "<string>",
"updatedAt": "<string>",
"tagId": "<string>",
"projectId": "<string>"
}
]
Default authentication mechanism
The body is of type object[]
.
The created links
from dub import Dub
with Dub(
token="DUB_API_KEY",
) as d_client:
res = d_client.links.create_many(request=[
{
"url": "https://google.com",
"external_id": "123456",
"tag_ids": [
"clux0rgak00011...",
],
"test_variants": [
{
"url": "https://example.com/variant-1",
"percentage": 50,
},
{
"url": "https://example.com/variant-2",
"percentage": 50,
},
],
},
])
assert res is not None
# Handle response
print(res)
[
{
"id": "<string>",
"domain": "<string>",
"key": "<string>",
"url": "<string>",
"trackConversion": false,
"externalId": "<string>",
"tenantId": "<string>",
"programId": "<string>",
"partnerId": "<string>",
"archived": false,
"expiresAt": "<string>",
"expiredUrl": "<string>",
"password": "<string>",
"proxy": false,
"title": "<string>",
"description": "<string>",
"image": "<string>",
"video": "<string>",
"rewrite": false,
"doIndex": false,
"ios": "<string>",
"android": "<string>",
"geo": {},
"publicStats": false,
"tags": [
{
"id": "<string>",
"name": "<string>",
"color": "red"
}
],
"folderId": "<string>",
"webhookIds": [
"<string>"
],
"comments": "<string>",
"shortLink": "<string>",
"qrCode": "<string>",
"utm_source": "<string>",
"utm_medium": "<string>",
"utm_campaign": "<string>",
"utm_term": "<string>",
"utm_content": "<string>",
"testVariants": [
{
"url": "https://example.com/variant-1",
"percentage": 50
},
{
"url": "https://example.com/variant-2",
"percentage": 50
}
],
"testStartedAt": "<string>",
"testCompletedAt": "<string>",
"userId": "<string>",
"workspaceId": "<string>",
"clicks": 0,
"leads": 0,
"conversions": 0,
"sales": 0,
"saleAmount": 0,
"lastClicked": "<string>",
"createdAt": "<string>",
"updatedAt": "<string>",
"tagId": "<string>",
"projectId": "<string>"
}
]