Docs

Try It

2 min readUpdated September 19, 2026

Try It is a live request console. A visitor can edit the method, URL, headers, and body right on the page, send a real request, and see the actual response, all from their own browser. The request goes straight from the visitor’s browser to the URL you set, not through wpcodeapiblock.com’s server.

Adding the block#

  1. In the block editor, open the block inserter and search for Try It.
  2. Add it to the page, usually under the Endpoint block it’s testing.
  3. Set the method, default URL, default headers, and default body a visitor will see when they first open the console.
  4. Review the warning text and adjust it if needed.

Settings#

SettingWhat it does
MethodGET, POST, PUT, PATCH, or DELETE. The default method a visitor sees, which they can change.
Default URLThe URL the console starts with. Defaults to https://api.example.com/v1/resource.
Default headersOne Name: Value pair per line. Defaults to Authorization: Bearer YOUR_API_KEY.
Default bodyStarting request body, for non-GET requests.
Warning textShown above the console. Defaults to a note that the request is sent directly from the visitor’s browser, not through this site’s server.

Everything here is just a starting point. Visitors can edit the URL, headers, and body before sending.

Example#

Method set to GET, Default URL set to https://api.example.com/v1/customers, Default headers set to Authorization: Bearer YOUR_API_KEY.

This sends a real request, from your browser, directly to the URL below. It does not go through this site's server.
GET

The block#

In the editor, this is the Try It block’s settings panel filled in as above, no code required.

The shortcode#

The same block, added as a shortcode instead, for a widget, classic-editor content, or a page builder that only accepts shortcodes. Every setting here is a plain value, not a JSON array, so it can go in a quoted attribute as usual:

[nahnu_code_block block="try-it" method="GET" url="https://api.example.com/v1/customers" headers="Authorization: Bearer YOUR_API_KEY"]

The block attribute picks which block to render (try-it here); everything else maps to that block’s own setting by name.

How it renders#

A warning line, then a GET badge with the URL, and an editable console below it where a visitor can change the method, URL, headers, or body and send a real request.

Tips#

  • Never put a real, working API key or secret in the default headers or body. Anyone viewing the page can see and use it. A placeholder like YOUR_API_KEY is the safe default for a reason.
  • Point this at a sandbox or test environment when you have one, so visitors experimenting with it can’t affect real data.
  • Keep the warning text honest about what the console actually does. It’s what tells a visitor the request leaves their own browser directly, not this site.

This website uses cookies to enhance your browsing experience and ensure the site functions properly. By continuing to use this site, you acknowledge and accept our use of cookies.

Accept All Accept Required Only