Create a referrals embed token for the given partner/tenant.
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.EmbedTokens.Referrals(ctx, &operations.CreateReferralsEmbedTokenRequestBody{
Partner: &operations.Partner{
Email: "Letha_Wuckert2@yahoo.com",
LinkProps: &operations.CreateReferralsEmbedTokenLinkProps{
ExternalID: dubgo.String("123456"),
TagIds: dubgo.Pointer(operations.CreateCreateReferralsEmbedTokenTagIdsArrayOfStr(
[]string{
"clux0rgak00011...",
},
)),
TestVariants: []operations.CreateReferralsEmbedTokenTestVariants{
operations.CreateReferralsEmbedTokenTestVariants{
URL: "https://example.com/variant-1",
Percentage: 50,
},
operations.CreateReferralsEmbedTokenTestVariants{
URL: "https://example.com/variant-2",
Percentage: 50,
},
},
},
},
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
{
"publicToken": "<string>",
"expires": "<string>"
}
Referrals embed token endpoint require an Advanced plan subscription or higher.
Default authentication mechanism
The created public embed token.
The response is of type object
.
Was this page helpful?
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.EmbedTokens.Referrals(ctx, &operations.CreateReferralsEmbedTokenRequestBody{
Partner: &operations.Partner{
Email: "Letha_Wuckert2@yahoo.com",
LinkProps: &operations.CreateReferralsEmbedTokenLinkProps{
ExternalID: dubgo.String("123456"),
TagIds: dubgo.Pointer(operations.CreateCreateReferralsEmbedTokenTagIdsArrayOfStr(
[]string{
"clux0rgak00011...",
},
)),
TestVariants: []operations.CreateReferralsEmbedTokenTestVariants{
operations.CreateReferralsEmbedTokenTestVariants{
URL: "https://example.com/variant-1",
Percentage: 50,
},
operations.CreateReferralsEmbedTokenTestVariants{
URL: "https://example.com/variant-2",
Percentage: 50,
},
},
},
},
})
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
{
"publicToken": "<string>",
"expires": "<string>"
}