Create a custom waiting room page preview
Creates a waiting room page preview. Upload a custom waiting room page for preview. You will receive a preview URL in the form http://waitingrooms.dev/preview/<uuid>. You can use the following query parameters to change the state of the preview:
force_queue: Boolean indicating if all users will be queued in the waiting room and no one will be let into the origin website (also known as queueAll).queue_is_full: Boolean indicating if the waiting room's queue is currently full and not accepting new users at the moment.queueing_method: The queueing method currently used by the waiting room.- fifo indicates a FIFO queue.
- random indicates a Random queue.
- passthrough indicates a Passthrough queue. Keep in mind that the waiting room page will only be displayed if
force_queue=trueorevent=prequeueing— for other cases the request will pass through to the origin. For our preview, this will be a fake origin website returning "Welcome". - reject indicates a Reject queue.
event: Used to preview a waiting room event.- none indicates no event is occurring.
- prequeueing indicates that an event is prequeueing (between
prequeue_start_timeandevent_start_time). - started indicates that an event has started (between
event_start_timeandevent_end_time).
shuffle_at_event_start: Boolean indicating if the event will shuffle users in the prequeue when it starts. This can only be set to true if an event is active (eventis not none).
For example, you can make a request to http://waitingrooms.dev/preview/<uuid>?force_queue=false&queue_is_full=false&queueing_method=random&event=started&shuffle_at_event_start=true
6. waitTime: Non-zero, positive integer indicating the estimated wait time in minutes. The default value is 10 minutes.
For example, you can make a request to http://waitingrooms.dev/preview/<uuid>?waitTime=50 to configure the estimated wait time as 50 minutes.
Security
API Token
The preferred authorization scheme for interacting with the Cloudflare API. Create a token.
API Email + API Key
The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.
The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.
Accepted Permissions (at least one required)
Create a custom waiting room page preview
package main
import (
"context"
"fmt"
"github.com/cloudflare/cloudflare-go"
"github.com/cloudflare/cloudflare-go/option"
"github.com/cloudflare/cloudflare-go/waiting_rooms"
)
func main() {
client := cloudflare.NewClient(
option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
)
response, err := client.WaitingRooms.Page.Preview(context.TODO(), waiting_rooms.PagePreviewParams{
ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
CustomHTML: cloudflare.F("{{#waitTimeKnown}} {{waitTime}} mins {{/waitTimeKnown}} {{^waitTimeKnown}} Queue all enabled {{/waitTimeKnown}}"),
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.PreviewURL)
}
{
"result": {
"preview_url": "http://waitingrooms.dev/preview/35af8c12-6d68-4608-babb-b53435a5ddfb"
}
}Returns Examples
{
"result": {
"preview_url": "http://waitingrooms.dev/preview/35af8c12-6d68-4608-babb-b53435a5ddfb"
}
}