Developer and Text Tools

How to Test REST and GraphQL APIs in Your Browser

A practical guide to testing APIs from a browser tab: requests, environments, auth, CORS, importing Postman or cURL, and turning calls into code.

Saizul Amin
Saizul Amin2 Nov 2026 · 5 min read
How to Test REST and GraphQL APIs in Your Browser

How to Test REST and GraphQL APIs in Your Browser

Testing an API is mostly about asking small, precise questions. Does this endpoint return what the documentation promises? What happens with a missing field, an expired token or a page number that is too high? A request client lets you ask those questions quickly, keep the answers, and repeat them tomorrow when something changes. This guide explains how to do that well, using the HTTP API Request Client as the example, and covers the one browser rule that surprises almost everyone: CORS.

The parts of an HTTP request

Every request has the same pieces, and a good client gives each one its own place:

  • Method: GET reads, POST creates, PUT replaces, PATCH changes part of a resource and DELETE removes it.
  • URL and query parameters: the address, plus key=value pairs after the question mark. Editing parameters in a table avoids encoding mistakes with spaces and symbols.
  • Headers: metadata such as Accept, Content-Type or a request ID.
  • Body: JSON for most modern APIs, form encoding for older ones, or a GraphQL query with variables.
  • Authentication: a bearer token, a username and password, or an API key.

When a response comes back, read the status code first, then the timing and size, then the body. A 200 with an error message inside the body is a design problem worth reporting; a 401 means the credentials are wrong or missing; a 403 means you are known but not allowed; a 429 means you are being rate limited.

Use variables from the start

The single best habit is to never type the same base URL or token twice. Put them in an environment as variables, and write {{base}}/orders instead of the full address. Then a second environment called Local or Staging changes every request at once. Variables also make collections shareable: you can send a teammate the file without your personal token inside it, and they fill in their own.

A useful naming pattern is base, token, userId and any IDs you reuse in several calls. When a variable has no value, a good client warns you before you send a request with a literal {{token}} in it.

Authentication without surprises

Bearer tokens are sent as Authorization: Bearer followed by the token, as defined in RFC 6750. They are what OAuth access tokens and most JSON Web Tokens use. Basic authentication, described in RFC 7617, joins user and password with a colon and encodes them in Base64. That encoding is not encryption, so Basic auth is only acceptable over HTTPS. API keys are vendor specific: some want a header such as X-API-Key, others a query parameter. Read the documentation and choose the matching option instead of building headers by hand.

Why browser calls sometimes fail: CORS

Browsers protect users by refusing to let a page read responses from another site unless that site agrees. The agreement is a set of response headers called CORS, for Cross-Origin Resource Sharing. For simple requests the server must reply with Access-Control-Allow-Origin. For requests with custom headers, JSON bodies or methods like PUT, the browser first sends an OPTIONS preflight, and the server has to approve the method and headers.

This is why a cURL command can work in a terminal while the same request fails in any browser-based tool. Terminals and back-end code are not subject to CORS. If you control the API, allow the origin you test from in development. If you do not, use a server-side tool or ask the provider; no web page is allowed to switch CORS off, and tools that claim to do so are routing your data through their own proxy.

Importing what you already have

Most teams already have requests somewhere. A Postman collection export carries folders, headers, bodies and variables. An Insomnia export does the same with a different structure. Browser developer tools offer "Copy as cURL" on any network request, which is the fastest way to reproduce exactly what a page sent, cookies and all. Importing these saves time and avoids typing errors. When you import cURL, check the headers: copied commands often include cookies and tracking headers you do not need.

From a working request to code

Once a request works, turn it into code rather than retyping it. A fetch snippet drops into a front-end prototype, a Python requests snippet into a script or notebook, and cURL into documentation or a bug report. Generated code includes every header and the exact body, which makes bug reports reproducible.

A simple testing routine

  1. Send the happy-path request and save it.
  2. Duplicate it and remove a required field; expect a 400 or 422 with a clear message.
  3. Duplicate again with no token; expect 401.
  4. Try a resource that does not exist; expect 404.
  5. Save all four in a folder named after the endpoint, so you can rerun them after every release.

This takes a few minutes per endpoint and catches the majority of regressions before users do.

Limits

A browser-based client can only reach APIs that allow cross-origin calls, it cannot send cookies belonging to other sites, and some response headers stay hidden unless the server exposes them. It is a tool for exploring and checking APIs, not a load-testing or security-testing tool. Tokens saved in a browser are only as safe as that browser profile, so avoid storing production secrets on shared machines.

Completely freeNo cost, no sign-up
Files stay privateEverything runs in your browser
Easy in your languageAvailable in many languages