Apiboo documentation

DocsAPIs

GraphQL, gRPC, WebSocket & SSE

Requests beyond REST: GraphQL, gRPC, WebSocket and server-sent events, plus mock examples and the local mock server.

GraphQL, gRPC, WebSocket & SSE

Not every API is plain request and response. Apiboo also speaks GraphQL, WebSocket, Server-Sent Events and gRPC, each in a request tab of its own that you save to collections like any other request. This page covers each one, the message log they share, and the mock server that answers your requests with examples you define.

Pick a protocol

Click + in the tab strip, or right-click a collection or folder and choose Add, then pick GraphQL, WebSocket, Server-Sent Events or gRPC (see Create a request). Each kind shows its protocol's icon on the tab. New tabs start as "New GraphQL query", "New WebSocket", "New SSE stream" or "New gRPC call".

GraphQL

A GraphQL request is an HTTP request with the GraphQL body. Choosing GraphQL sets the method to POST and adds a Content-Type: application/json header. On the Body tab you get three panes:

PaneHolds
SchemaThe schema explorer: the query fields the server offers, with a search box (Search fields…) and Show descriptions / Hide descriptions.
QueryThe query, with GraphQL highlighting.
VariablesThe query's variables, as JSON.
A GraphQL request to the Bookshop API: the Schema explorer with books ticked, the generated Query and the Variables pane

Load the schema

The explorer needs the server's schema, which Apiboo fetches with an introspection query. The picker above the panes decides when:

  • No schema (the default): nothing is fetched until you click Refresh schema.
  • Auto Fetch: the schema is fetched each time the URL changes.

The fetch sends the request's headers (with variables filled in), so an API that needs a token for introspection works as long as the token is set.

Build a query

Tick fields and arguments in the Schema explorer, and Apiboo writes the query for you. When you open a saved query, the matching fields are ticked again. You can also type the query directly.

WebSocket

  1. Enter a ws:// or wss:// URL, for example ws://localhost:4180/v1/orders/feed.
  2. Click Connect (or press Enter in the URL). The status next to it goes from Connecting… to Connected.
  3. Type a message on the Message tab. Pick JSON or Text for the editor.
  4. Click Send or press Ctrl+Enter.
  5. Disconnect closes the connection. While connecting, the button reads Cancel.
A WebSocket tab connected to the Bookshop orders feed: the Message editor and the log with sent and received messages

The tab has three sections:

TabWhat's there
MessageThe message editor.
HeadersExtra headers for the opening handshake. Headers the handshake sets itself, such as Host or Sec-WebSocket-Key, can't be changed.
SettingsConnection settings (below).

WebSocket settings

SettingDefaultRange
Verify the server certificateOnOn or off
Handshake timeout0 (30 seconds)0–600 seconds
Maximum message size0 (64 MB)0–1024 MB. A bigger message closes the connection with code 1009.
Reconnection attempts0 (never)0–100
Reconnection interval5 seconds1–600 seconds

Binary messages appear in the log as base64. WebSocket connections don't go through the proxy from Settings → Proxy.

Server-Sent Events

A Server-Sent Events tab listens to a stream of events.

  1. Pick GET or POST and enter the URL.
  2. Add headers on Headers, a JSON body on Body (POST only), and a Bearer Token on Auth if the stream needs one.
  3. Click Connect. The status shows Connected and how long the stream has been open.
  4. Disconnect stops it.

Apiboo sends Accept: text/event-stream and Cache-Control: no-cache for you. If the connection drops, it reconnects on its own: after 3 seconds, or after the delay the server asks for with retry:. On reconnect it sends Last-Event-ID so the server can continue where it stopped.

Each event appears in the log with its event name as a tag. A [DONE] event shows as "[DONE] — the stream ended".

Streams in an ordinary HTTP request

You don't always need an SSE tab. When a normal HTTP request gets a text/event-stream response, the desktop app streams it: the response shows 200 OK · Streaming, events arrive in the log as they come, and Send turns into Stop. The stream's state reads Streaming, Stream ended, Stopped or Stream broke.

Post-response scripts don't run for a streamed response, and there's no body to save.

gRPC

gRPC works in the desktop app. A gRPC tab has an address, a method picker and an Invoke button.

  1. Enter the server address, for example localhost:50051.
  2. Load the service definition on the Service definition tab: Server Reflection asks the server, Load .proto reads a .proto file (its imports are found next to it). The tab shows how many services and methods were found.
  3. Tick TLS if the server uses TLS.
  4. Pick the method under Select a method. Methods are shown as "Service / Method", and streaming ones are marked "(stream)".
  5. Write the request message as JSON on the Message tab, and add metadata on Metadata.
  6. Click Invoke.
A gRPC tab calling bookshop.v1.Catalog / GetBook: the method picker, the JSON message and the response with status OK and trailers

The Response pane shows the gRPC status (such as OK), the time, the response as JSON and the Trailers. A server-streaming method fills the log with one row per message instead.

The message log

WebSocket, SSE, streamed HTTP responses and gRPC streams share one log.

PartDoes
ColumnsDirection, payload and time. The newest entry is at the top.
SearchFilters entries by text.
FilterAll messages, Received, Sent or Connection.
Clear (Clear the log)Empties the log.

Click an entry to see it in full. Show as switches between Text, JSON, XML and HTML; Apiboo picks one for you. Connection rows record the connect, the disconnect and any reconnect attempts. In the desktop app, the connect row also holds the handshake's request and response headers.

The log keeps the last 1,000 entries and tells you when older ones were dropped.

Connections stay open

A WebSocket connection belongs to its tab, not to whatever you're looking at. Switch to another tab and back, and the connection, its log and your unsent message are still there. A dot on the tab shows that it is connected.

A connection closes when you close its tab, close all tabs or switch workspace.

Mock examples

A mock example is a canned response for an HTTP request, so you can work against an API that isn't built yet. Click Mock in the request's tab row to open them.

The Mock dialog for GET /v1/books with the mock URL and two response examples, 200 and 404
  1. Save the request to a collection first. The dialog then shows its Mock URL.
  2. Click Add example.
  3. Give it a name, a Status (200 by default), a Content-Type and the Response body. Add Response headers if you need them.
  4. Switch the example on or off with its Active toggle.

To choose between several examples, use Match query params and Match headers: an example only answers when the request carries those values. Of the examples that match, the one matching the most wins (a query value counts more than a header). If none match, the first active example answers.

The Source can be Example (the body you typed) or Schema (data generated from a schema you design in the Schemas section of the API Client sidebar).

Postman saved responses become mock examples when you import a collection (see What comes across).

The local mock server

The mock server answers requests with your mock examples. It runs in the desktop app, on your machine only.

  1. Click the server icon with the small arrow in the title bar (on API Client and History).
  2. Click Local Mock to start it. The icon turns green, and its tooltip says which port it runs on.
  3. Copy a request's Mock URL from its Mock dialog and call it from your app or from Apiboo.

Mock URLs look like http://127.0.0.1:8780/mock/<collection id>/<path>. The server starts on port 8780 and tries the next ports if that one is taken. It matches the method and the exact path; there are no path parameters, so /books/1 and /books/2 are two routes. CORS is allowed, and changes to your examples take effect right away while it runs.

Click Local Mock again to stop it.

Cloud Mock, in the same menu, serves your mocks from a URL hosted by Apiboo, so they work without your computer. It needs a paid plan and a cloud or team workspace (see Account & plans).