APITest
=======

(c) 2026 R. F. Windley & The Really Small Software Company


APITest is an HTTP API tester for the RISC OS desktop, in the style of
Postman: build a request, send it and look at the response.

Main features are:

- GET, POST, PUT, PATCH, DELETE, HEAD and OPTIONS requests to http:// and
  https:// URLs
- Request headers edited as plain "Name: value" lines
- JSON, XML, plain text or form bodies, with Content-Type and
  Content-Length added for you
- Pretty printing of JSON and XML request and response bodies
- Syntax colouring of JSON and XML response bodies
- A response window showing the status, time taken and size, with the
  body, the headers or the raw response
- Requests saved and loaded as text files, and the global clipboard
- Named collections of related requests sharing variables such as the
  base URL and API key, headers sent with every request, and named
  environments (Dev, Live...) with their own values


Using APITest
-------------

Click on the iconbar icon to open a new request. Choose the method from the
pop-up menu next to it, type the URL and click Send (or press Return in the
URL field). The response window opens and fills in as the response arrives.

Click Headers or Body on the toolbar to choose what the editing area shows.
Headers are one per line in the form

  Accept: application/json
  Authorization: Bearer xxxx

Lines starting with # are ignored. Choose the body type from the pop-up menu
by the Type field; Content-Type is added to the request unless you have set
one in the headers. Click Format to pretty print a JSON or XML body.

In the response window choose Body, Headers or Raw. With Pretty on, JSON and
XML bodies are indented; a body that cannot be formatted is shown as it was
received with the reason in the toolbar.

Requests are saved (F3) as Text files in the form

  POST https://example.com/api/items
  Content-Type: application/json

  {"name": "test"}

Double-clicking a file whose name ends in /http or /rest opens it in
APITest; Text files can be dragged to the iconbar icon.

Collections
-----------

A collection is a named set of related requests that share variables.
Choose New collection from the iconbar menu to start one. The collection
window shows its name and its requests, its variables or its headers
(click Requests, Variables or Headers on the toolbar).

Variables are one per line in the form

  baseUrl = https://petstore.example.com/v2
  apiKey = abc123

and are used in a request's URL, headers and body as {{name}}, for example

  GET {{baseUrl}}/pets
  api_key: {{apiKey}}

The values are put in when the request is sent; the request itself keeps
the {{name}}s, so changing a variable changes every request that uses it.
A value can use other variables. Sending a request that uses a name the
collection does not define reports an error.

Environments hold different values for the same variables. A line [Name]
starts the variables of the environment Name; those before the first
[Name] apply in every environment:

  baseUrl = https://petstore.example.com/v2
  apiKey = live-key

  [Dev]
  baseUrl = http://dev.example.com/v2
  apiKey = dev-key

Choose the environment in use from the Env pop-up menu on the toolbar
(None uses just the shared values). Its values replace the shared ones,
and the request windows show its name in their titles.

Headers are lines of "Name: value" sent with every request in the
collection, such as

  Accept: application/json
  Authorization: Bearer {{token}}

They can use variables too. A request that sets a header of the same
name itself sends its own instead.

In the request list, click New to add a request, and double click a
request (or press Return) to open it in its own window, titled with the
collection and request names. Type in the Request field and press Return
to rename the selected request. The menu also has Duplicate, Delete and
Move up/down. Saving (F3) from any of the collection's windows saves the
whole collection as one Text file in the .http layout used by other
REST clients:

  # @collection Petstore
  # @active Dev
  # @header Accept: application/json
  @baseUrl = https://petstore.example.com/v2
  @apiKey = abc123

  # @env Dev
  @baseUrl = http://dev.example.com/v2

  ### List pets
  GET {{baseUrl}}/pets
  api_key: {{apiKey}}

  ### Add pet
  POST {{baseUrl}}/pet
  Content-Type: application/json

  {"name": "Rex"}

Files in this form, including ones written by other .http tools, open as
collections; a file that starts with its METHOD URL line opens as a single
request. A request body must not have a line starting ###.

APITest uses the URL fetcher modules (URL, AcornHTTP and, for https, AcornSSL)
which are part of RISC OS 5 and of the Select/Adjust and Browse/NetSurf
installs. PATCH needs a version of AcornHTTP with HTTP_RegisterMethod.


Keys

  F1            Help
  F3            Save
  Ctrl-F1       File information
  Ctrl-S        Send
  Escape        Stop the request
  Ctrl-X/C/V    Cut, copy and paste
  Ctrl-A        Select all
  Ctrl-Z        Clear the selection
  Ctrl-E        Show the headers
  Ctrl-B        Show the body
  Ctrl-F        Format the body
  Ctrl-F6       Format the text by its language's rules
  Shift-Ctrl-F6 Format the selected lines (also Format lines on the menu)
  Ctrl-R        Show the response window
  Shift-Left/Right       Previous/next word
  Ctrl-Left/Right        Start/end of line
  Ctrl-Up/Down           Start/end of the text
  Ctrl-Shift-cursor keys Extend the selection


Fonts
-----

The font and size used are set in Resources.Messages (FontEdit and
SizeEdit). Sizes are in 1/16 point.
