(domains)
- create - Create a domain
- list - Retrieve a list of domains
- update - Update a domain
- delete - Delete a domain
Create a domain for the authenticated workspace.
declare(strict_types=1);
require 'vendor/autoload.php';
use Dub;
use Dub\Models\Operations;
$security = 'DUB_API_KEY';
$sdk = Dub\Dub::builder()->setSecurity($security)->build();
$request = new Operations\CreateDomainRequestBody(
slug: 'acme.com',
archived: false,
expiredUrl: 'https://acme.com/expired',
notFoundUrl: 'https://acme.com/not-found',
placeholder: 'https://dub.co/help/article/what-is-dub',
);
$response = $sdk->domains->create(
request: $request
);
if ($response->domainSchema !== null) {
// handle response
}
Parameter | Type | Required | Description |
---|---|---|---|
$request |
Operations\CreateDomainRequestBody | ✔️ | The request object to use for the request. |
?Operations\CreateDomainResponse
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 list of domains associated with the authenticated workspace.
declare(strict_types=1);
require 'vendor/autoload.php';
use Dub;
$security = 'DUB_API_KEY';
$sdk = Dub\Dub::builder()->setSecurity($security)->build();
$response = $sdk->domains->list(
archived: true,
search: '<value>',
page: 1,
pageSize: 50
);
if ($response->domainSchemas !== null) {
// handle response
}
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
archived |
?bool | ➖ | Whether to include archived domains in the response. Defaults to false if not provided. |
|
search |
?string | ➖ | The search term to filter the domains by. | |
page |
?float | ➖ | The page number for pagination. | 1 |
pageSize |
?float | ➖ | The number of items per page. | 50 |
?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\SDKException | 4XX, 5XX | */* |
Update a domain for the authenticated workspace.
declare(strict_types=1);
require 'vendor/autoload.php';
use Dub;
use Dub\Models\Operations;
$security = 'DUB_API_KEY';
$sdk = Dub\Dub::builder()->setSecurity($security)->build();
$requestBody = new Operations\UpdateDomainRequestBody(
slug: 'acme.com',
archived: false,
expiredUrl: 'https://acme.com/expired',
notFoundUrl: 'https://acme.com/not-found',
placeholder: 'https://dub.co/help/article/what-is-dub',
);
$response = $sdk->domains->update(
slug: 'acme.com',
requestBody: $requestBody
);
if ($response->domainSchema !== null) {
// handle response
}
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
slug |
string | ✔️ | The domain name. | acme.com |
requestBody |
?Operations\UpdateDomainRequestBody | ➖ | N/A |
?Operations\UpdateDomainResponse
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 domain from a workspace. It cannot be undone. This will also delete all the links associated with the domain.
declare(strict_types=1);
require 'vendor/autoload.php';
use Dub;
$security = 'DUB_API_KEY';
$sdk = Dub\Dub::builder()->setSecurity($security)->build();
$response = $sdk->domains->delete(
slug: 'acme.com'
);
if ($response->object !== null) {
// handle response
}
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
slug |
string | ✔️ | The domain name. | acme.com |
?Operations\DeleteDomainResponse
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 | */* |