-
Notifications
You must be signed in to change notification settings - Fork 0
Guide HTTP Client
Kris Simon edited this page Dec 31, 2025
·
3 revisions
ARO provides HTTP client capabilities for making requests to external services and APIs.
Use the <Request> action to make HTTP requests. The preposition determines the HTTP method:
-
from- GET request -
to- POST request -
via METHOD- Explicit method (PUT, DELETE, PATCH)
Use from preposition to make GET requests:
(* Simple GET request *)
<Create> the <url> with "https://api.example.com/users".
<Request> the <users> from the <url>.
Use to preposition to make POST requests:
(* POST with data from context *)
<Create> the <user-data> with { name: "Alice", email: "alice@example.com" }.
<Create> the <api-url> with "https://api.example.com/users".
<Request> the <result> to the <api-url> with <user-data>.
Use via preposition with method specifier for PUT, DELETE, PATCH:
(* PUT request *)
<Request> the <result> via PUT the <url> with <update-data>.
(* DELETE request *)
<Request> the <result> via DELETE the <url>.
(* PATCH request *)
<Request> the <result> via PATCH the <url> with <partial-data>.
The <Request> action automatically parses JSON responses. After a request, these variables are available:
| Variable | Description |
|---|---|
result |
Parsed response body (JSON as map/list, or string) |
result.statusCode |
HTTP status code (e.g., 200, 404) |
result.headers |
Response headers as map |
result.isSuccess |
Boolean: true if status 200-299 |
<Create> the <api-url> with "https://api.example.com/users".
<Request> the <response> from the <api-url>.
(* Access response metadata *)
<Extract> the <status> from the <response: statusCode>.
<Extract> the <is-ok> from the <response: isSuccess>.
(* Access response body - response IS the parsed body *)
<Extract> the <first-user> from the <response: 0>.
(* Fetch weather data from Open-Meteo API *)
(Application-Start: Weather Client) {
<Log> "Fetching weather..." to the <console>.
<Create> the <api-url> with "https://api.open-meteo.com/v1/forecast?latitude=52.52&longitude=13.41¤t_weather=true".
<Request> the <weather> from the <api-url>.
<Log> <weather> to the <console>.
<Return> an <OK: status> for the <startup>.
}
- Uses Foundation's URLSession for HTTP requests
- Compatible with both interpreter (
aro run) and compiled binaries (aro build) - Default timeout: 30 seconds
- Automatically parses JSON responses
- Thread-safe for concurrent requests
- Available on macOS and Linux (not Windows)
- I/O Services Specification - HTTP client specification
- Examples/HTTPClient - Working example
Fundamentals
- The Basics
- Feature Sets
- Actions
- Variables
- Type System
- Control Flow
- Error Handling
- Computations
- Dates
- Concurrency
Runtime & Events
I/O & Communication
Advanced