(partners)
Create a new partner for a program. If partner exists, automatically enrolls them.
from dub import Dub
with Dub(
token="DUB_API_KEY",
) as d_client:
res = d_client.partners.create(request={
"program_id": "<id>",
"name": "<value>",
"email": "[email protected]",
"username": "Aaliyah_Borer",
"link_props": {
"external_id": "123456",
"tag_ids": [
"clux0rgak00011...",
],
},
})
assert res is not None
# Handle response
print(res)
operations.CreatePartnerResponseBody
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 |
*/* |
Create a new link for a partner that is enrolled in your program.
from dub import Dub
with Dub(
token="DUB_API_KEY",
) as d_client:
res = d_client.partners.create_link(request={
"program_id": "<id>",
"url": "https://necessary-brief.name",
"link_props": {
"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 |
*/* |
Upsert a link for a partner that is enrolled in your program. 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 d_client:
res = d_client.partners.upsert_link(request={
"program_id": "<id>",
"url": "https://unsteady-lobster.com/",
"link_props": {
"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 analytics for a partner within a program. The response type vary based on the groupBy
query parameter.
from dub import Dub
with Dub(
token="DUB_API_KEY",
) as d_client:
res = d_client.partners.analytics(request={
"program_id": "<id>",
})
assert res is not None
# Handle response
print(res)
operations.RetrievePartnerAnalyticsResponseBody
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 |
*/* |