Overview
The REST SDK enables you to:- Publish messages to channels
- Retrieve message and presence history
- Generate authentication tokens
- Query channel metadata
- Retrieve application statistics
Getting Started
To use the REST SDK, first instantiate a client:Core Concepts
Constructor
The REST SDK constructor creates a new client instance for making HTTP requests to Ably. You can instantiate the client using an API key string or aClientOptions object for more advanced configuration.
See the full constructor documentation for detailed information.
Authentication
The REST SDK supports both Basic and Token authentication:- Basic Authentication: Use your API key directly with each request
- Token Authentication: Generate and use temporary tokens for enhanced security
Channels
Channels in the REST SDK provide:- Message publishing
- History retrieval
- Presence querying
Messages
Publish messages and retrieve message history:- Single or batch message publishing
- Paginated history queries
- Message filtering options
Key Features
Stateless Operations
The REST SDK is stateless, making it ideal for:- Server-side integrations
- Serverless functions
- Batch operations
- Administrative tasks
HTTP API Access
All operations use Ably’s REST API:- Standard HTTP methods (GET, POST)
- JSON or MessagePack encoding
- Automatic fallback host support
- Rate limiting and retry logic
Token Generation
Generate authentication tokens for client applications:- Ably Tokens for temporary access
- Ably JWTs for custom authentication
- TokenRequests for delegated authentication
Comparison with Realtime SDK
Choose the REST SDK when:- You don’t need real-time updates
- You’re building server-side services
- You need simple publish operations
- You want to minimize resource usage
- You need to receive messages in real-time
- You require presence functionality
- You want automatic reconnection
- Your app needs bidirectional communication
