Home Applications fast-http

fast-http Works

InterSystems does not provide technical support for this project. Please contact its developer for the technical assistance.
5
1 reviews
0
Awards
160
Views
17
IPM installs
0
0
Details
Releases (11)
Reviews (1)
Issues
Articles (2)
Fast HTTP wrapper for %Net.HttpRequest

What's new in this version

  • Add SSEPassthroughAdapter

FastHTTP

FastHTTP is a lightweight wrapper for %Net.HttpRequest in InterSystems IRIS, designed to simplify HTTP requests with a concise API and built-in JSON support.

Installation

With Docker

Clone the repository and run:

docker-compose up -d

With ZPM

zpm "install fast-http"

Usage

Simple GET Request

Set response = ##class(dc.http.FastHTTP).DirectGet("url=https://httpbin.org/get")
write response.%ToJSON()

POST Request with JSON Body

Set body = {"name": "Iris", "type": "Database"}
Set response = ##class(dc.http.FastHTTP).DirectPost("url=https://httpbin.org/post", body)
write response.%ToJSON()

PUT & DELETE

// PUT
Set response = ##class(dc.http.FastHTTP).DirectPut("url=https://httpbin.org/put", {"update": 1})

// DELETE Set response = ##class(dc.http.FastHTTP).DirectDelete("url=https://httpbin.org/delete")

Configuration String

FastHTTP uses a configuration string to set up the request. You can pass it to the FastHTTP constructor or the Direct... methods.

Format: "key=value,key2=value2"

Supported keys:

  • url: The full URL to send the request to.
  • Header_<Name>: Sets a request header. Ex: Header_Authorization=Bearer 123

Example with headers:

Set config = "url=https://api.example.com/data,Header_Authorization=Bearer mytoken,Header_Content-Type=application/json"
Set response = ##class(dc.http.FastHTTP).DirectGet(config)

Accessing the Client Instance

The Direct... methods also return the client instance as an output parameter if you need to access the underlying %Net.HttpRequest or response metadata.

Set response = ##class(dc.http.FastHTTP).DirectGet("url=https://httpbin.org/get", , .client)
Write "Status Code: ", client.HttpRequest.HttpResponse.StatusCode

Server-Sent Events (SSE) / AI Streaming

FastHTTP has built-in support for Server-Sent Events (SSE), making it extremely easy to consume streaming APIs like OpenAI, Anthropic, or any LLM in real-time. Instead of waiting for the full response to complete, you can process chunks on the fly.

To consume an SSE stream, follow these steps:

  1. Create a dc.http.Stream which will hold the incoming bits.
  2. Link it to a dc.http.SSEHandler, configured with an Adapter (a class extending dc.http.SSEAdapter).
  3. Pass your stream to the FastHTTP request.

Testing with the Mock Server

If you have started the workspace using Docker, a small sse-mock service is included in the docker-compose.yml. You can use it to simulate an AI streaming response without needing a real API key or internet connection.

Once the mock server is running, you can test the SSE behavior in the IRIS terminal with the following snippet:

Set stream = ##class(dc.http.SSEChatConsoleAdapter).GetStream()
Set config = "url=http://sse-mock:5000/stream,timeout=10"
Set response = ##class(dc.http.FastHTTP).DirectGet(config, , , stream)

Testing with OpenAI

If you have an access to OpenAI API or LLM API compatible, you can use the following template:

Set stream = ##class(dc.http.SSEChatConsoleAdapter).GetStream()
Set config = "url=https://api.openai.com/v1/chat/completions,Header_Authorization=Bearer ,Header_Accept=text/event-stream"
Set body = {"model": "gpt-4", "messages": [{"role": "user", "content": "Tell me a short story."}], "stream": true }
Set response = ##class(dc.http.FastHTTP).DirectPost(config, body, .client, stream)
Made with
Install
zpm install fast-http download archive
Version
1.2.428 Mar, 2026
Ideas portal
Category
Frameworks
Works with
InterSystems IRIS
First published
19 Feb, 2026
Last edited
28 Mar, 2026
Last checked by moderator
21 Feb, 2026Works