(links)
- createMany - Bulk create links
- deleteMany - Bulk delete links
- updateMany - Bulk update links
- create - Create a new link
- delete - Delete a link
- get - Retrieve a link
- list - Retrieve a list of links
- count - Retrieve links count
- update - Update a link
- upsert - Upsert a link
Bulk create up to 100 links for the authenticated workspace.
declare(strict_types=1);
require 'vendor/autoload.php';
use Dub;
use Dub\Models\Operations;
$sdk = Dub\Dub::builder()
->setSecurity(
'DUB_API_KEY'
)
->build();
$request = [
new Operations\RequestBody(
url: 'https://google.com',
tagIds: [
'clux0rgak00011...',
],
externalId: '123456',
),
];
$response = $sdk->links->createMany(
request: $request
);
if ($response->responseBodies !== null) {
// handle response
}
Parameter | Type | Required | Description |
---|---|---|---|
$request |
array<Operations\RequestBody> | ✔️ | The request object to use for the request. |
?Operations\BulkCreateLinksResponse
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\SDKException | 4XX, 5XX | */* |
Bulk delete up to 100 links for the authenticated workspace.
declare(strict_types=1);
require 'vendor/autoload.php';
use Dub;
$sdk = Dub\Dub::builder()
->setSecurity(
'DUB_API_KEY'
)
->build();
$response = $sdk->links->deleteMany(
linkIds: [
'clux0rgak00011...',
'clux0rgak00022...',
]
);
if ($response->object !== null) {
// handle response
}
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
linkIds |
array<string> | ✔️ | Comma-separated list of link IDs to delete. Maximum of 100 IDs. Non-existing IDs will be ignored. | [ "clux0rgak00011...", "clux0rgak00022..." ] |
?Operations\BulkDeleteLinksResponse
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\SDKException | 4XX, 5XX | */* |
Bulk update up to 100 links with the same data for the authenticated workspace.
declare(strict_types=1);
require 'vendor/autoload.php';
use Dub;
use Dub\Models\Operations;
$sdk = Dub\Dub::builder()
->setSecurity(
'DUB_API_KEY'
)
->build();
$request = new Operations\BulkUpdateLinksRequestBody(
data: new Operations\Data(
url: 'https://google.com',
tagIds: [
'clux0rgak00011...',
],
),
);
$response = $sdk->links->updateMany(
request: $request
);
if ($response->linkSchemas !== null) {
// handle response
}
Parameter | Type | Required | Description |
---|---|---|---|
$request |
Operations\BulkUpdateLinksRequestBody | ✔️ | The request object to use for the request. |
?Operations\BulkUpdateLinksResponse
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\SDKException | 4XX, 5XX | */* |
Create a new link for the authenticated workspace.
declare(strict_types=1);
require 'vendor/autoload.php';
use Dub;
use Dub\Models\Operations;
$sdk = Dub\Dub::builder()
->setSecurity(
'DUB_API_KEY'
)
->build();
$request = new Operations\CreateLinkRequestBody(
url: 'https://google.com',
tagIds: [
'clux0rgak00011...',
],
externalId: '123456',
);
$response = $sdk->links->create(
request: $request
);
if ($response->linkSchema !== null) {
// handle response
}
Parameter | Type | Required | Description |
---|---|---|---|
$request |
Operations\CreateLinkRequestBody | ✔️ | The request object to use for the request. |
?Operations\CreateLinkResponse
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\SDKException | 4XX, 5XX | */* |
Delete a link for the authenticated workspace.
declare(strict_types=1);
require 'vendor/autoload.php';
use Dub;
$sdk = Dub\Dub::builder()
->setSecurity(
'DUB_API_KEY'
)
->build();
$response = $sdk->links->delete(
linkId: '<id>'
);
if ($response->object !== null) {
// handle response
}
Parameter | Type | Required | Description |
---|---|---|---|
linkId |
string | ✔️ | The id of the link to delete. You may use either linkId (obtained via /links/info endpoint) or externalId prefixed with ext_ . |
?Operations\DeleteLinkResponse
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\SDKException | 4XX, 5XX | */* |
Retrieve the info for a link.
declare(strict_types=1);
require 'vendor/autoload.php';
use Dub;
$sdk = Dub\Dub::builder()
->setSecurity(
'DUB_API_KEY'
)
->build();
$response = $sdk->links->get(
domain: 'rural-mathematics.name',
key: '<key>',
linkId: 'clux0rgak00011...',
externalId: '123456'
);
if ($response->linkSchema !== null) {
// handle response
}
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
domain |
?string | ➖ | N/A | |
key |
?string | ➖ | The key of the link to retrieve. E.g. for d.to/github , the key is github . |
|
linkId |
?string | ➖ | The unique ID of the short link. | clux0rgak00011... |
externalId |
?string | ➖ | This is the ID of the link in the your database. | 123456 |
?Operations\GetLinkInfoResponse
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\SDKException | 4XX, 5XX | */* |
Retrieve a paginated list of links for the authenticated workspace.
declare(strict_types=1);
require 'vendor/autoload.php';
use Dub;
use Dub\Models\Operations;
$sdk = Dub\Dub::builder()
->setSecurity(
'DUB_API_KEY'
)
->build();
$request = new Operations\GetLinksRequest();
$responses = $sdk->links->list(
request: $request
);
foreach ($responses as $response) {
if ($response->statusCode === 200) {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
$request |
Operations\GetLinksRequest | ✔️ | The request object to use for the request. |
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\SDKException | 4XX, 5XX | */* |
Retrieve the number of links for the authenticated workspace.
declare(strict_types=1);
require 'vendor/autoload.php';
use Dub;
use Dub\Models\Operations;
$sdk = Dub\Dub::builder()
->setSecurity(
'DUB_API_KEY'
)
->build();
$request = new Operations\GetLinksCountRequest();
$response = $sdk->links->count(
request: $request
);
if ($response->number !== null) {
// handle response
}
Parameter | Type | Required | Description |
---|---|---|---|
$request |
Operations\GetLinksCountRequest | ✔️ | The request object to use for the request. |
?Operations\GetLinksCountResponse
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\SDKException | 4XX, 5XX | */* |
Update a link for the authenticated workspace. If there's no change, returns it as it is.
declare(strict_types=1);
require 'vendor/autoload.php';
use Dub;
use Dub\Models\Operations;
$sdk = Dub\Dub::builder()
->setSecurity(
'DUB_API_KEY'
)
->build();
$requestBody = new Operations\UpdateLinkRequestBody(
url: 'https://google.com',
tagIds: [
'clux0rgak00011...',
],
externalId: '123456',
);
$response = $sdk->links->update(
linkId: '<id>',
requestBody: $requestBody
);
if ($response->linkSchema !== null) {
// handle response
}
Parameter | Type | Required | Description |
---|---|---|---|
linkId |
string | ✔️ | The id of the link to update. You may use either linkId (obtained via /links/info endpoint) or externalId prefixed with ext_ . |
requestBody |
?Operations\UpdateLinkRequestBody | ➖ | N/A |
?Operations\UpdateLinkResponse
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\SDKException | 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.
declare(strict_types=1);
require 'vendor/autoload.php';
use Dub;
use Dub\Models\Operations;
$sdk = Dub\Dub::builder()
->setSecurity(
'DUB_API_KEY'
)
->build();
$request = new Operations\UpsertLinkRequestBody(
url: 'https://google.com',
tagIds: [
'clux0rgak00011...',
],
externalId: '123456',
);
$response = $sdk->links->upsert(
request: $request
);
if ($response->linkSchema !== null) {
// handle response
}
Parameter | Type | Required | Description |
---|---|---|---|
$request |
Operations\UpsertLinkRequestBody | ✔️ | The request object to use for the request. |
?Operations\UpsertLinkResponse
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\SDKException | 4XX, 5XX | */* |