Skip to main content

Overview

The HTTPRequest node provides an easy way to make HTTP and HTTPS requests to web servers and REST APIs. It supports GET, POST, PUT, DELETE, and other HTTP methods, along with file downloads and uploads.
HTTPRequest uses HTTPClient internally and provides a simpler, node-based interface for common HTTP operations.

Basic HTTP Request

GET Request

Always check both the result (network operation status) and response_code (HTTP status) before processing the response.

POST Request

Send data to a server:

HTTP Methods

File Downloads

Download files from a URL:

Download Progress

Files are downloaded to the specified path. Use user:// for writable user directory.

Custom Headers

Add authentication and custom headers:

Basic Authentication

Response Handling

Status Codes

Parsing JSON

Request Configuration

Timeout

Redirects

GZIP Compression

Body Size Limit

HTTPS/TLS

For secure connections:
Always use HTTPS for sensitive data like authentication tokens and user information.

REST API Example

Complete REST API integration:

Error Handling

Best Practices

Always use HTTPS when transmitting passwords, tokens, or personal information.
Check both network errors and HTTP status codes. Provide user feedback for failures.
Use shorter timeouts for quick requests, longer for file downloads. Default of 0 means no timeout.
HTTPRequest is asynchronous by default. Never use synchronous HTTP calls in production.
Respect API rate limits. Implement exponential backoff for retries.

See Also

Networking Overview

Learn about multiplayer networking

Low-Level Networking

Understand ENet and WebSocket