Skip to main content

HTTP Server

The HTTP Server feature allows your device to host web endpoints and respond to HTTP requests. This enables external applications and services to interact with your device through standard HTTP/REST APIs.

Overview

With the HTTP Server feature, you can:

  • Create REST API endpoints
  • Serve web pages and resources
  • Accept webhook callbacks
  • Enable third-party integrations

Configuration

Configure the HTTP server with these properties:

  • Port: The port number for the HTTP server (default: 80)
  • Maximum Connections: Limit concurrent client connections
  • Request Timeout: Timeout for processing requests

Creating Endpoints

Use the HTTP Server Endpoint block to define custom endpoints that respond to HTTP requests.

Each endpoint can handle different HTTP methods:

  • GET: Retrieve data
  • POST: Submit data
  • PUT: Update data
  • DELETE: Remove data

Request Handling

When a request is received, your application can:

  • Parse query parameters
  • Read request body (JSON, form data)
  • Access HTTP headers
  • Generate custom responses
  • Set response status codes

Response Types

Return different content types:

  • JSON data for APIs
  • HTML for web pages
  • Plain text messages
  • Binary data files

Security Considerations

  • Enable authentication mechanisms
  • Validate and sanitize all input data

See Also