Servers
Servers lists the base URLs an API is reachable at, each with a short label, such as Production, Sandbox, or a specific region. It’s usually placed near the top of a reference page, before the individual endpoints, so a reader knows what to prepend to every path shown afterward.
Adding the block#
- In the block editor, open the block inserter and search for Servers.
- Add it to the page, usually near the top of an API reference page.
- Give the block a title, e.g.
Base URLs. - Click + Add server for each environment you want to list.
Settings#
| Setting | What it does |
|---|---|
| Block title | Heading shown above the list, e.g. Base URLs. |
Per row:
| Setting | What it does |
|---|---|
| Label | A short name for the environment, e.g. Production, Sandbox, EU region. |
| Base URL | The full base URL for that environment, e.g. https://api.example.com/v1. |
Example#
One row: Label Production, Base URL https://api.example.com/v1.
-
Production
https://api.example.com/v1
The block#
In the editor, this is one server row filled in as above, no shortcode needed.
The shortcode#
The same block, added as a shortcode instead, for a widget, classic-editor content, or a page builder that only accepts shortcodes. Since servers is a JSON array, it can never go in a quoted attribute (a JSON array always contains a ], and the shortcode parser stops at the first literal ] it finds, quoted or not). It goes between the opening and closing tags instead:
[nahnu_code_block block="servers" title="Base URLs"]
[{"description":"Production","url":"https://api.example.com/v1"}]
[/nahnu_code_block]
Putting the JSON between the tags, rather than in a quoted attribute, is what keeps the shortcode from cutting off partway through.
How it renders#
A list titled “Base URLs” with one row: Production and its base URL.
Tips#
- List Production first, then Sandbox or any other test environment, so the primary base URL is the one readers see first.
- Keep base URLs exact, including the version segment (
/v1), so every path shown elsewhere on the page can just be appended to it. - Update this block whenever a base URL changes. Every Endpoint block on the page relies on it being correct.