Free tech learning for everyone, from basics to pro

APIsProgramming and Application SecurityBeginner

What an API is and how REST APIs work

In short: An API is a defined way for one program to ask another for data or actions. REST APIs use HTTPS, URLs that name resources, standard methods such as GET and POST, and usually JSON. Modern network devices, firewalls and cloud platforms all expose REST APIs, so they are a core automation skill.

What an API is

An API (Application Programming Interface) is a contract between two pieces of software. One side says: send me a request in this exact shape and I will reply in that exact shape. You already use APIs every day without seeing them. A weather app on your phone asks a weather service for a forecast; a cloud console asks the provider’s back end to list your virtual machines; a network controller asks a switch for its interface counters.

For network and security engineers the key point is this: a person reads a command-line screen, but a program reads an API. Instead of logging in to fifty firewalls and copying rule counts into a spreadsheet, a script can ask each firewall’s API and receive clean, structured data in seconds.

One REST request and responseClientscript, app,browserRequestmethod + URL +headersAPI serverchecks andprocessesResponsestatus + JSONbodyClient actsreads the data
Figure 1. A REST call is a single request from a client and a single response from the server, carried over HTTPS.

The REST style

Most web APIs today follow REST (Representational State Transfer), a set of design ideas rather than a strict protocol. A REST API has a few recognisable features:

  • Resources: everything is a thing with a name, such as a device, an interface or a user. Each resource has a URL, for example /api/v1/devices/42.
  • Standard methods: HTTP methods say what to do. GET reads, POST creates, PUT replaces, PATCH changes part of a resource, DELETE removes it.
  • Stateless: each request carries everything the server needs, including credentials. The server does not remember the previous request, which makes APIs easy to scale.
  • Representations: the server sends a copy of the resource, usually in JSON (JavaScript Object Notation).
GET /api/v1/devices?site=london HTTP/1.1
Host: nms.example.com
Accept: application/json
Authorization: Bearer <token>

The response would be a status code such as 200 OK and a JSON list of devices. You will meet the details of methods, headers and status codes in the next note.

Why APIs beat screen scraping

CLI screen scraping vs APIScreen scrapingText meant for humansFormat changes per versionRegex to parse outputHard to validateREST APIStructured JSON dataVersioned contractNative dicts and listsClear status codes
Figure 2. An API returns structured data with a stable contract, which is far easier to automate than parsing CLI text.

Before APIs were common, automation meant sending CLI commands over SSH and parsing the text with regular expressions. That still works and is sometimes the only option, but it is fragile: a new software version adds a column and your parser breaks. An API gives you named fields, data types and error codes. Many vendors publish an OpenAPI specification (a machine-readable description of every endpoint), so you can see exactly what each call expects and returns.

Where you meet APIsTypical use
Network controllers and SD-WANList devices, push templates, read health
FirewallsRead rules, add address objects, export logs
Cloud platformsCreate networks, security groups and storage
Ticketing and chat toolsOpen tickets, post alerts
IPAM and source of truthAllocate IP addresses, look up sites

Other API styles you will hear about

REST is not the only option. SOAP is an older, XML-based style still found in some enterprise systems. GraphQL lets the client ask for exactly the fields it wants in a single query. gRPC uses compact binary messages and is popular for streaming telemetry from network devices. Network devices also offer NETCONF and RESTCONF, which use YANG data models to describe configuration.

Tip: before writing any code, read the API documentation and try one call by hand with a tool such as curl or Postman. Knowing the exact URL, required headers and response shape saves a lot of debugging.

APIs at work and in exams

In a job interview you may be asked to explain what an API is in simple terms, name the main HTTP methods, or say what stateless means. In practice, start with read-only GET calls against a lab system, such as a free sandbox or a controller in your home lab. Common beginner mistakes include ignoring pagination (only reading the first page of results), not checking the status code, and pasting tokens directly into scripts. Treat an API token like a password: store it outside your code and give it only the permissions it needs.

Practice

In one sentence, what is an API?
A defined contract that lets one program request data or actions from another program in a predictable format.
What does it mean that REST is stateless?
Each request contains everything the server needs, including authentication; the server does not rely on memory of earlier requests.
Why is an API usually better than parsing CLI output for automation?
It returns structured data with named fields and clear status codes, so scripts do not break when the human-readable output format changes.

Key takeaways

  • An API is a contract that lets programs talk to each other.
  • REST uses resources with URLs, standard HTTP methods and usually JSON.
  • REST is stateless: every request carries its own credentials and context.
  • APIs return structured data, which is more reliable than screen scraping.
  • Treat API tokens like passwords and start with read-only calls.
Tracks your learning on this device only. See your progress on the learning paths.

About the author

Mohamed Fayas

Founder of FM TecHub. CCNA certified, with a BTEC HND in Network Engineering, and BEng (Hons) in Computer Networking and Cloud Security. He writes practical, plain-English guides on networking, security and cloud.

More about the author

Original content written by Mohamed Fayas for FM TecHub. © 2026 FM TecHub. You're welcome to share a link to this page; please don't copy the text elsewhere without permission.

Stay up to date by email

New notes, tools and security news from FM TecHub, explained simply. Free.

We only use your email to send these updates. See our privacy policy.