Skip to content
Tutorial

API Testing on Android: A Full REST, GraphQL & WebSocket Client in Your Pocket

Test and debug REST, WebSocket, GraphQL and SSE APIs from your Android phone. PocketCode ships an HTTP client — auth, scripts, environments, mock server and code generation — built into the IDE.

Updated:
10 min
By Pelayo Naredo

Update, September 2026: the API Tester now also has Socket.IO and MQTT, and swapped its old test simulator for a real sandboxed JavaScript engine. See what's new. A gRPC panel is in the code too, but the current version hides it until it works on Android.

An API breaks at the worst possible moment: you're away from your desk, the webhook isn't firing, and your laptop with Postman is at home. On Android, the usual answer is "wait until you're back." PocketCode removes that wait — it ships an HTTP client built into the IDE, so you can test and debug REST APIs from your phone without a second app or a single line of glue code.

It lives right next to your editor, terminal and database manager, and it covers the day-to-day work of calling an API: building a request, reading the response, keeping collections and variables, and a few power tools. Where something is missing or limited, this post says so.

What it can actually do

The API Tester: a GET to api.github.com answered 200 in 309 ms, with the JSON response as a foldable tree

The API Tester has six protocols, picked from a dropdown on the request's context line:

ProtocolWhat it's for
REST (HTTP)The classic request/response client — 8 methods
WebSocketLive bidirectional text messages (ws:// / wss://)
GraphQLQueries and mutations + schema introspection
SSEServer-Sent Events streams in real time
Socket.IOListen for and emit named events over the official client
MQTTSubscribe and publish by topic, QoS 0/1/2, with or without TLS (MQTT 5)

For REST it covers all eight HTTP methods — GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS and TRACE — each colour-coded so you can scan a collection at a glance.

Plain http:// and ws:// only work to localhost, 127.0.0.1 and 10.0.2.2; everything else needs HTTPS. A server on your local network at http://192.168.x.x is blocked, so use HTTPS or a tunnel.

Building a request

The request editor is a URL bar, a context line with the protocol and the environment, and the sections as a tab row:

  • URL bar — method selector, a monospace URL field, and a Send button that turns into Cancel while the request is in flight.
  • Params — a key/value editor where every row has an enable/disable checkbox and an active-count badge, so you can toggle query params without deleting them.
  • Headers — the same key/value editor, with bulk edit (paste Key: value lines) and a secret flag per row. A Content-Type: application/json header comes with every new request.
  • Body — ten body types: JSON (with Beautify / Minify), Form URL-Encoded, Multipart (per-field TEXT or FILE with a file picker), Raw, XML, HTML, JavaScript, Binary (send a raw file), and GraphQL.
  • Settings — timeout, follow redirects and SSL verification.

In REST requests you can drop a {{variable}} into the URL, params, headers, body or auth and it gets interpolated at send time (more on that below). The GraphQL query and the WebSocket, SSE, Socket.IO and MQTT panels do not substitute variables.

Authentication

PocketCode lists ten auth types, and eight of them work, split into common cards and an advanced section:

  • Common: None, Bearer (token + custom prefix), Basic, API Key (with a choice of Header or Query Param).
  • Advanced: OAuth2, Digest (user and password; the server's 401 challenge supplies the rest), AWS Signature v4 (access key, secret, region, service, session token), and a fully Custom header. Hawk and NTLM are in the list too, marked coming soon, and do nothing yet.

OAuth2 shows four grant cards, but only two fetch a token for you: Client Credentials (a Get token button) and Authorization Code (the app opens the browser, you paste the returned code by hand and tap Exchange code). For Password and Implicit you paste the access token yourself. The token is always sent as Authorization: Bearer. There is no PKCE and no refresh token.

Scripts and tests

Two kinds of checks run around every request:

  • No-code assertions — pick a field (status code, response time, a header, a JSONPath into the body, body size), an operator and an expected value. They are always evaluated.
  • JavaScript scripts — a pre-request script runs before sending and a test script runs after the response. They run in an isolated engine and expose a small pm.* subset: pm.test, pm.expect, pm.environment, pm.globals (read-only), pm.request (read-only) and, in tests, pm.response. There is no pm.sendRequest, pm.variables or setNextRequest, and a script cannot modify the request. A Postman script that uses those calls fails with a script error in the console. On a device without a modern WebView the scripts do not run and only the assertions do.

There is a menu of nine ready-made assertions: status is 200, status is 2xx, response time < 500 ms, has JSON body, body not empty, has Content-Type header, body contains string, array length > 0 and a JSON schema valid one that in practice only checks that the body is JSON. The Console tab logs everything the scripts print, and the requests, at LOG / INFO / WARN / ERROR levels, for the whole session.

Reading the response

The response panel gives you the numbers that matter up top — status code (with a colour by range), total time in milliseconds, body size and content type. Below that, tabs:

TabWhat you get
BodyPretty (a collapsible JSON tree with a key filter and a JSONPath filter; other content is shown as-is), Raw, and Preview (HTML only, with JavaScript off)
HeadersA copy-friendly table
CookiesRows with Secure / HttpOnly badges
TestsResults from the no-code assertions and the JavaScript test script
TimelineDNS · TCP · TLS · TTFB · transfer
ConsoleEverything the scripts logged, at LOG / INFO / WARN / ERROR levels

You can copy the body and each header, and save any value in the JSON tree as a variable. There is no Share or Save for the response, and no text search with highlighted matches.

Beyond REST

  • WebSocket connects to a ws:// or wss:// URL, shows the connection state and a chat-style log of sent and received text messages. There are no custom handshake headers, subprotocols, auto-reconnect or saved templates, and binary frames are not shown.
  • GraphQL has a query editor with JSON variables, a Fetch Schema button that runs introspection, and a schema explorer for types and fields (with the number of arguments). Operations go out as an HTTP POST: there is no operation-name field, no subscriptions, and no panel-level auth or headers.
  • SSE streams land in a live event log (type, id and the first 300 characters of the data). There are no custom headers, type filter or auto-reconnect, and the server's retry is ignored.
  • gRPC is in the code but hidden in the current version: its panel needs a library the app leaves out, so it stays off the protocol menu until it works on Android.
  • Socket.IO connects to a namespace, with a toggle for auto-reconnect. Add listeners for named events and emit your own with a JSON payload — every message in the chat-style log is tagged with its event name. There are no custom headers, auth or query parameters, and listeners cannot be removed.
  • MQTT is MQTT 5 only (a broker that speaks only 3.1.1 may refuse the connection). It connects with or without TLS and with or without a username/password, subscribes to topics with QoS 0, 1 or 2, publishes with a QoS (there is no retain option) and groups messages by topic. There is no unsubscribe, last-will or custom certificate.

Staying organized

  • Collections hold requests, with search by name, export and delete, and a tap to load any request back into the editor. Folders come in with imports and can be run by the Runner, but you cannot create or open them from the list, and you cannot rename a collection or its requests. Requests saved from the editor are all named "New Request". The Free plan keeps one collection.
  • History keeps up to 200 entries, searchable by URL or name, filterable by "starred only" or by GET / POST / PUT / DELETE, and grouped into Today / Yesterday / This week / Older. Star an entry, load it, compare it with another response, or turn it into a mock route. On the Free plan the history stops saving after 10 entries until you clear it.
  • Environments manage {{variable}} sets, plus a section of global variables. A lock marks a variable as secret: it is masked on screen and left as a {{name}} placeholder in generated cURL and code. Resolution goes from most specific to least: any dynamic variable like {{$guid}} first, then a Runner data-file row if one is active, then Collection, Environment, and finally Global. The Free plan keeps one environment.
  • A persistent cookie jar fills itself from every Set-Cookie and shows Secure / HttpOnly badges. You cannot add cookies by hand.

Power tools

The Tools sheet: Environments, Mock Server, Cookies, Import and Settings, each with its live state

  • Import from cURL, Postman v2.1, Insomnia, OpenAPI 3.0 / Swagger (JSON or YAML) and HAR by pasting the text. Export a collection as Postman v2.1, Insomnia, OpenAPI 3.0, HAR or Markdown (to the clipboard), or a single request as cURL.
  • The Code Generator turns the current request into ready-to-paste code for 27 menu entries (26 distinct outputs, since two of them are cURL) — cURL, HTTPie, Wget, Fetch, Axios, Python requests, Java OkHttp, Swift URLSession, Go net/http, PHP, Ruby, C#, Rust, Dart, PowerShell and more — with method, URL, headers and body. Only the cURL output includes the auth.
  • A local Mock Server (part of the Pro plan) stands up an HTTP server on the device (default port 8090, loopback only: reachable from this device, not from the network) where each route defines a method, a path pattern (/users/:id), a status and a body, plus a global delay — with a live log of incoming calls. Routes are not saved between sessions.
  • The Collection Runner and Load Test are Pro as well. The Runner goes through a collection in order, for 1 to 100 iterations or one row per iteration of a CSV or JSON data file. The load test sends its requests one after the other; its concurrency and ramp-up fields have no effect yet.

Your data stays on the device

Collections, history, environments and cookies are stored in a local database on your phone, and the requests you send go straight to the server you point them at. Cloud Sync is off by default; if you turn it on (Pro), it syncs your settings, snippets and other data, but API collections and environments are not synced for now. For development you can toggle SSL verification off for self-signed certs. And because it's part of the IDE, the AI assistant can send a request, list your collections or import a cURL command when you ask it about your APIs.


Testing an API used to mean "get back to your computer." It doesn't anymore. PocketCode puts an HTTP client — six protocols deep, from REST to MQTT — in the same app where you write and ship the code.

PocketCode is available on Google Play. Get PocketCode

The tool behind this article

API Tester

Ready to try PocketCode?

Download the app and start coding from your mobile.