← All posts
Automation

How to Send a REST API GET Request in Postman: A Network Engineer's First Call

How to Send a REST API GET Request in Postman: A Network Engineer's First Call

What Postman Is and Why You Should Start Here

Before writing any Python, use Postman. It's a GUI HTTP client that lets you build and send REST API requests without writing a single line of code. You can see exactly what you're sending, see exactly what comes back, and iterate fast.

For network engineers learning REST APIs, Postman removes one variable. You're not debugging Python syntax and API behavior at the same time. Get the request working in Postman first. Then move it to code.

Download Postman from postman.com. Create a free account and open a new workspace.

The Cisco DevNet Sandbox: Your Practice Device

Cisco's DevNet sandbox (devnetsandbox.cisco.com) gives you free access to always-on IOS-XE instances. No hardware, no VPN, no setup. Just a router you can send API requests to.

The always-on sandbox uses these credentials: host sandbox-iosxe-latest-1.cisco.com, username admin, password C1sco12345. RESTCONF runs on port 443.

This is where you'll practice. It resets periodically, so don't save anything important there.

Sending Your First GET Request

Open Postman. Click "New Request." Set the method to GET and enter this URL:

https://sandbox-iosxe-latest-1.cisco.com/restconf/data/ietf-interfaces:interfaces

Under "Authorization," select Basic Auth and enter the sandbox credentials. Under "Headers," add one header: Accept with value application/yang-data+json. This tells the router you want JSON back, not XML.

Click Send. You'll get a JSON response listing all interfaces on the device: their names, types, descriptions, IP addresses, and operational status.

Reading the JSON Response

The response will look like this (shortened):

{ "ietf-interfaces:interfaces": { "interface": [ { "name": "GigabitEthernet1", "description": "MANAGEMENT INTERFACE", "type": "iana-if-type:ethernetCsmacd", "enabled": true, "ietf-ip:ipv4": { "address": [ { "ip": "10.10.20.48", "prefix-length": 24 } ] } } ] }
}

The outer key (ietf-interfaces:interfaces) is the YANG module and container. Inside, interface is a list. Each element is one interface. This structure follows the YANG model exactly.

Getting One Specific Interface

To get a single interface instead of all of them, append the interface name to the URL as a list key:

GET https://sandbox-iosxe-latest-1.cisco.com/restconf/data/ietf-interfaces:interfaces/interface=GigabitEthernet1

The response is the same structure but contains only GigabitEthernet1. This is how RESTCONF navigation works: the URL path mirrors the YANG tree, and list keys select specific elements.

Try different interface names. If you request one that doesn't exist, you'll get a 404. That's useful to know when you're writing code.

The Accept Header: Why It Matters

RESTCONF supports both JSON and XML. The Accept header tells the server which you want. Without it, you might get XML back (the RESTCONF default on some devices), which is harder to work with in Python.

Always include Accept: application/yang-data+json for JSON. When you're making changes (PATCH, POST, PUT), also include Content-Type: application/yang-data+json so the router knows the format of your request body.

Saving Requests in a Collection

Once a request works, save it. Click the Save button in Postman and create a collection called something like "RESTCONF Lab." Collections let you build a library of working API calls you can run again or share with teammates.

Organize the collection by function: one folder for interface operations (GET all, GET one, PATCH description), another for routing, another for BGP. This becomes a runnable API reference for your environment.

Environment Variables: Don't Hardcode Credentials

Instead of typing the base URL and password into every request, use Postman environments. Create an environment with variables:

  • base_url: https://sandbox-iosxe-latest-1.cisco.com

  • username: admin

  • password: C1sco12345

Then reference them in requests as {{base_url}}, {{username}}, {{password}}. When you switch to a real device, you change the environment, not every request. This is also how you safely share collections without embedding credentials.

Exporting to Python

Once a request works in Postman, click the Code icon (the angle-bracket icon in the top right of the request panel). Select "Python - Requests." Postman generates the equivalent Python requests call with all your headers, auth, and URL.

This is the fastest way to go from "it works in Postman" to "it works in a script." Copy the generated code, clean it up, and you have a working starting point.

Practical Takeaway

Spend 30 minutes in Postman against the DevNet sandbox before writing any code. Send a GET for all interfaces. Send a GET for one interface. Look at the JSON structure. Try a PATCH and see what a 204 response looks like. That 30 minutes will save you hours of confusion when you start scripting.

Watch the video

This is part of the Network Automation 101 series on YouTube.

Watch on YouTube →

Next in this series

REST API POST vs PATCH vs PUT: Which One Changes Network Config? →

Comments (0)

Please sign in to comment.

  • Be the first to comment.