Skip to content

Hands-on tools: Postman and curl

ہاتھ کے اوزار: Postman اور curl

40 min read

Three ways to see it

  1. curl is a tool that sends an HTTP request from the command line and prints the response. The simplest possible call is curl https://api.fbr.gov.pk/health. If FBR has a public health endpoint, you get back a JSON like { "status": "ok" }. Add flags to grow the request. -X POST changes the verb. -H adds a header, like -H 'Authorization: Bearer YOUR_KEY'. -d adds a body, like -d '{"ntn": "1234567"}'. Strung together: curl -X POST -H 'Authorization: Bearer abc123' -H 'Content-Type: application/json' -d '{"ntn":"1234567"}' https://api.fbr.gov.pk/taxpayers/verify. That single line is what a corporate accountant's tax-filing software is doing every minute.

  2. Postman wraps the same idea in a friendly interface. You pick a verb from a dropdown, type the URL, click on the Headers tab to add Authorization, click on the Body tab to add JSON, hit Send. The response appears in the lower pane, prettified, syntax-highlighted, with the status code and time in the corner. Save the request, organise it into a collection, share the collection with a colleague. Where curl is fast and scriptable, Postman is documentary. A well-organised Postman collection is the most honest API documentation an organisation can produce.

  3. A worked example with FBR's e-invoicing sandbox. FBR's REA-Q project, the digital invoicing reform, exposes a test endpoint at https://gw.fbr.gov.pk/test/v1/di_data/Upload_Sales_Invoice. The request expects a JSON body with the invoice header, the line items, the buyer NTN, the seller NTN. The response returns an IRN, the invoice reference number, plus a QR code payload. In Postman you would set up a collection called FBR Sandbox, an environment with your test API key, three requests (login, upload invoice, fetch IRN), and a small test script that asserts the response is a 200. In curl, the same thing is three lines pasted into a shell script. Either way you have an automated regression suite against the live sandbox before a single line of production code is written.

Quick check

Quick check: what makes modern AI different from a rule-based program?

The why-tree

Why-tree level one: why use a tool at all instead of writing code? Because the goal at this stage is to understand the API, not to ship the integration. A tool gives you a fast feedback loop, response in milliseconds, no compile step, no deploy. Curiosity moves quickly. Code can come later.

Try this with Claude

AI-edge prompt to try with Claude or ChatGPT: 'I have a Postman collection of five FBR e-invoicing API calls. Write a single curl shell script that runs them in sequence, captures the IRN from the first response, and uses it in the second. Include error handling: if any call returns non-200, the script must exit with a clear message in Urdu and English.' Then run the output. Note every place the AI hallucinated.

Sources

Sources and further reading. curl official documentation (curl.se/docs). Postman Learning Center (learning.postman.com). FBR Digital Invoicing portal (fbr.gov.pk/digital-invoicing). 'HTTPie vs curl' on httpie.io. 'Testing APIs with Postman' tutorial series at learning.postman.com. RFC 9110, 'HTTP Semantics' (datatracker.ietf.org/doc/html/rfc9110).