INTEGRITY Documentation

Publish to a Queue via HTTP

The following example shows you how to publish messages to a Queue from any HTTP client, using a Cloudflare API token to authenticate.

This allows you to write to a Queue from any service or programming language that supports HTTP, including Go, Rust, Python or even a Bash script.

Prerequisites

1. Send a test message

To make sure you successfully authenticate and write a message to your queue, use curl on the command line:

# Make sure to replace the placeholder with your shared secret
curl -XPOST -H "Authorization: Bearer <paste-your-api-token-here>" "https://api.cloudflare.com/client/v4/accounts/<paste-your-account-id-here>/queues/<paste-your-queue-id-here>/messages" --data '{ "body": { "greeting": "hello" } }'
{"success":true}

This will issue a HTTP POST request, and if successful, return a HTTP 200 with a success: true response body.

For full documentation about the HTTP Push API, refer to the Cloudflare API documentation.