Troubleshooting API Requests in Postman
Should an API request not be acting as intended, there are several likely explanations. You can utilize the Postman Console to troubleshoot the request, ask Postbot to assist you in identifying the issue, or debug the request by HTTP version. This manual also notes several typical problems together with their causes.
Fixing Your Inquiries
Postman will point out any spaces or incorrect characters in portions of your request that might not work as intended, so you may correct your values. The request method, URL, parameters, headers—including your key names—as well as the body highlight invalid characters.
Should Postman fail to deliver your request or get a reply, you will get a notice including specifics about the error. Choose View in Console to have a general picture of your request and assist in determining the cause of the problem.
Postbot Debugging Requests
Ask Postbot for assistance if you receive an unexpected error when making a request. Choose what’s incorrect in the error message. Postbot will inform you of any issues it finds and present potential fixes for them.
Visit About Postbot for further Postbot information.
Console Debugging
Postman logs every request it receives in the Postman Console so that you may view the specifics of each one. This allows you to use the Console to assist in debugging your requests should an API not be performing as expected. Keeping the Console open while debugging will help your network calls and log messages be more visible.
The Postman Console documents the following:
- Included all underlying request headers, varying values, and redirects, the main request that was made.
- The proxies chosen for the request together with certificates.
- Network data including protocols, ciphers, and IP addresses.
- From test or pre-request scripts, log statements and asynchronous requests.
- The server’s unprocessed raw response before Postman handles it.
Results are logged into a different terminal on Monitor. See View monitor results for further details on viewing logs from a monitor run.
Starting the Console
Start the Console by choosing Console from the Postman footer. To launch the Postman Console in a fresh window in the Postman desktop program, use ⌘+Option+C
or Ctrl+Alt+C
.
Seeing Console View Request Mistakes
Should Postman fail to forward your request or get a reply from the API you contacted, you will get an error message. This message comprises a link to the Console and a general summary of the problem. You may access comprehensive information on the request here.
To examine the request information in the Console and learn more about what went wrong, choose View in Console.
Control the Console
Together with any Console output messages from your scripts, the Postman Console shows network information, the request and response headers, and the body for every request.
Sort under All Logs by log message type. Choose the more actions icon to either turn off or on network information and timestamps.
By default, the Console will log 24 hours and the latest 5,000 messages. Choose Clear to trash the list.
Employ Log Statements
Your post-response scripts might help you debug your requests by including log statements at suitable places. Postman allows the following log statements:
console.log()
console.info()
console.warn()
console.error()
console.clear()
HTTP Version Debugging
You may indicate the HTTP version to apply for searches. Postman backs HTTP versions 1.0, 1.1, and 2.0. The default version you will use globally to make HTTP requests is the one you choose here. For a single request, you can override the default version.
When debugging API calls, it helps to indicate an HTTP version so you may test requests by version. It also helps to confirm whether API calls support the requested HTTP version.
Make sure that the request URL makes use of the https
scheme should the API support HTTP version 2.0. Make sure you send requests using the Postman Desktop Agent even if you use the Postman web app. The following situations will apply the supported 1.x HTTP version:
- The request URL makes use of the
http
scheme. - The request arrives via the Postman Cloud Agent.
- Postman has been set to operate over a proxy server.
Setting an HTTP Version for Your Searches
After choosing the settings icon in the header, choose Settings to indicate an HTTP version globally. Opening an individual HTTP request lets you also indicate the version for that request by choosing the Settings tab.
Beside HTTP Version, choose the HTTP version from the list.
Choose Restore Default if you provide an HTTP version for a single request. This sets the HTTP version back to the global default version.
Choose from among the following:
- Auto – Postman automatically chooses HTTP version 1.0, 1.1, or 2.0 depending on which version the API supports and prefers.
- Send the request using HTTP version 1.0 or 1.1.
- Send the request with HTTP version 2.0.
Should the API reject the HTTP version you choose, the response box shows an error. For example, if you choose HTTP/2 and the API does not support HTTP version 2.0, the error will appear.
You can check the HTTP version shown in the response window following a request. Hover over the network icon to access details on the HTTP version applied for the request.