Console
The Console is a running log of what ApiWorkbench sends and receives. It lists every request and response exactly as they went over the network, including each redirect, together with the output of console.log in your scripts. Open it when a request does not behave as you expect.
Open the Console
Select Console at the bottom of the bar on the left edge of the window. The Console opens as a panel along the bottom. Drag its top edge to make it taller or shorter.
On a narrow window or a phone, open the app menu and select Console. It opens as its own page.
Select Close console to hide it. Closing does not clear it: entries stay until you select Clear or close the app. The Console is not saved between sessions.
What appears in it
| Entry | Comes from |
|---|---|
| A request and its response | Every send from the editor and the collection runner |
| Extra hops | Each redirect, and each retry made while signing in, as its own entry |
| Requests made by scripts | pm.sendRequest calls, marked with the source script |
| Log lines | console.log, console.info, console.warn, console.error and console.debug in scripts |
| Notices | Messages from the app about a script, such as a file attachment it dropped |
Newest entries are at the bottom. When nothing has happened yet, the Console says "Nothing yet. Requests, responses and console.log output from scripts appear here."
Load tests are not logged in the Console, because they would flood it. Use the load tester's own request log.
Read an entry
Each network row shows the method, the URL, the status, the time taken and the response size, then the clock time and the source. A row for a redirect or retry also shows its hop number: hop 0 is the request as you sent it, hop 1 is what followed it, and so on.
Select a row to open its details:
| Section | Shows |
|---|---|
| Network | URL, Status, Protocol, Hop, Source, Started, Time and Response size |
| Request headers | Every header that was sent, including ones the app added for auth, cookies and the body type |
| Request body | The body as sent, with variables filled in |
| Response headers | Every header the server returned |
| Response body | The body the server returned |
This is the main reason to use the Console: the request editor shows what you typed, and the Console shows what was sent after variables, auth, cookies and scripts were applied.
Long bodies show their first part, with Show more to reveal the rest. Select Copy in an entry to copy the request and response as text, with every header and body.
A row for a log line shows its text, its time and which script wrote it. Open it and select Copy to copy the line with its time and source.
Filter and search
The chips at the top filter the list. Each shows a count.
| Filter | Shows |
|---|---|
| All | Every entry |
| Network | Requests and responses only, redirect hops included |
| Logs | Lines from console.log and other script output |
| Errors | Failed requests (no response, or a status of 400 and up) and error lines |
Type in Search to find entries by method, URL, status, headers, the start of each body, or log text. For example, 401 finds unauthorised responses and /users finds calls to that path. When a filter or search hides entries, the Console shows Showing 12 of 80.
The toolbar
| Control | What it does |
|---|---|
| Auto-scroll | Keeps the newest entry in view as new ones arrive. Scrolling up pauses it. |
| Latest | Jumps to the newest entry and resumes following |
| Copy all | Copies the entries currently shown as text, with each body cut to 8,000 characters |
| Clear | Removes every entry |
| Close console | Hides the Console and keeps its entries |
Secrets are masked
The values of variables marked secret are hidden in the Console: in URLs, headers, bodies, search results and anything you copy from it. That makes it safer to paste Console output into a bug report.
Masking relies on the value being stored in a secret variable. A token typed straight into a header is shown as it is, so still read what you copy before sharing it.
Limits
- The Console keeps the latest 1,000 entries. Older ones are dropped, and a note says how many.
- It also limits the total size of the bodies it holds, so a run of large downloads cannot fill memory. The oldest entries go first.
- Very large bodies are stored only up to their first part. The response panel in the editor has the full body.
- One script run can add up to 1,000 log lines.
Debug with the Console
A request returns 401 or 403
Open the entry and look at Request headers. Check that Authorization is there and holds the value you expect. If it shows a placeholder such as {{token}}, the variable was empty when the request went out. See Variables.
A redirect loses your login
Look for the hops under the request. ApiWorkbench drops the Authorization header when a redirect leaves the original host, and the hop's request headers show that. See Request settings.
A script does not do what you expect
Add console.log lines at each step and select the Logs filter:
console.log("token before:", pm.environment.get("token"));
const body = pm.response.json();
console.log("body:", body);
pm.environment.set("token", body.token);
console.log("token after:", pm.environment.get("token"));Objects are printed as JSON, so you can log a whole response body.
A variable is not filled in
Search for the request and open Network. The URL line shows the address after variables were filled in. A placeholder that is still there means no scope had a value for it.
Next steps
- Scripts: write the scripts whose output lands here.
- Troubleshooting: fixes for common problems.
- Cookies: see and edit what the cookie jar sends.