Create a domain for the authenticated workspace.
package main
import(
"context"
dubgo "github.com/dubinc/dub-go"
"github.com/dubinc/dub-go/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := dubgo.New(
dubgo.WithSecurity("DUB_API_KEY"),
)
res, err := s.Domains.Create(ctx, &operations.CreateDomainRequestBody{
Slug: "acme.com",
ExpiredURL: dubgo.String("https://acme.com/expired"),
NotFoundURL: dubgo.String("https://acme.com/not-found"),
Placeholder: dubgo.String("https://dub.co/help/article/what-is-dub"),
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
{
"id": "<string>",
"slug": "acme.com",
"verified": false,
"primary": false,
"archived": false,
"placeholder": "https://dub.co/help/article/what-is-dub",
"expiredUrl": "https://acme.com/expired",
"notFoundUrl": "https://acme.com/not-found",
"assetLinks": null,
"appleAppSiteAssociation": null,
"logo": "<string>",
"createdAt": "<string>",
"updatedAt": "<string>",
"registeredDomain": {
"id": "<string>",
"autoRenewalDisabledAt": "<string>",
"createdAt": "<string>",
"expiresAt": "<string>",
"renewalFee": 123
}
}
Default authentication mechanism
The domain was created.
The response is of type object
.
package main
import(
"context"
dubgo "github.com/dubinc/dub-go"
"github.com/dubinc/dub-go/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := dubgo.New(
dubgo.WithSecurity("DUB_API_KEY"),
)
res, err := s.Domains.Create(ctx, &operations.CreateDomainRequestBody{
Slug: "acme.com",
ExpiredURL: dubgo.String("https://acme.com/expired"),
NotFoundURL: dubgo.String("https://acme.com/not-found"),
Placeholder: dubgo.String("https://dub.co/help/article/what-is-dub"),
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
{
"id": "<string>",
"slug": "acme.com",
"verified": false,
"primary": false,
"archived": false,
"placeholder": "https://dub.co/help/article/what-is-dub",
"expiredUrl": "https://acme.com/expired",
"notFoundUrl": "https://acme.com/not-found",
"assetLinks": null,
"appleAppSiteAssociation": null,
"logo": "<string>",
"createdAt": "<string>",
"updatedAt": "<string>",
"registeredDomain": {
"id": "<string>",
"autoRenewalDisabledAt": "<string>",
"createdAt": "<string>",
"expiresAt": "<string>",
"renewalFee": 123
}
}