API Mastery: You Are the Frontend

The Paradigm Shift

Stop clicking through UIs. Become the frontend.

Old Way New Way

Click through forms

curl direct to API

Wait for page loads

Instant JSON response

Limited by UI design

Full data access

Manual repetitive tasks

Scripted automation

One operation at a time

Bulk operations

The Toolkit

Tool Purpose Example

curl

HTTP requests

curl -s api.example.com/data

jq

JSON parsing

…​ | jq '.users[] | .email'

yq

YAML parsing

…​ | yq -r '.config.key'

DevTools

Reverse-engineer APIs

F12 → Network → Copy as cURL

xh/httpie

curl alternatives

xh GET api.example.com/users

The Workflow

Every system with a web UI has an API behind it. Your workflow:

1. Open DevTools (F12) → Network tab
2. Use the UI normally, watch requests appear
3. Right-click request → Copy as cURL
4. Paste in terminal, pipe to jq
5. Build reusable shell functions

Quick Start

Test your setup:

# Fetch public API, parse with jq
curl -s https://jsonplaceholder.typicode.com/users/1 | jq

# Extract specific field
curl -s https://jsonplaceholder.typicode.com/users/1 | jq -r '.email'

# Filter array
curl -s https://jsonplaceholder.typicode.com/users | jq '.[] | {name, email}'

Learning Path

Module Description

Fundamentals

HTTP methods, headers, status codes

DevTools Mastery

Reverse-engineering any web app

curl Mastery

Flags, authentication, file uploads

Authentication

Bearer tokens, API keys, OAuth, cookies

jq Pipelines

Complex data transformations

Shell Integration

Functions, gopass, automation

Practice APIs

API URL Auth Required

JSONPlaceholder

jsonplaceholder.typicode.com

No

HTTPBin

httpbin.org

No

GitHub

api.github.com

Optional

PokeAPI

pokeapi.co/api/v2

No

The Endgame

# Your custom CLI for any system
myapp() {
  curl -s "https://api.myapp.com/$1" \
    -H "Authorization: Bearer $(gopass show v3/work/myapp | sed '1,/^---$/d' | yq -r '.api_key')" \
    | jq "${2:-.}"
}

# Usage
myapp users                        # List all users
myapp users '.[] | .email'         # Just emails
myapp tickets/123                  # Specific resource
myapp tickets '.[0:5]'             # First 5

You are now faster than any UI. You can automate. You can bulk operate. You are the frontend.