In this lesson, you will learn:

  • How to access the built-in API documentation.
  • How to perform a Suzieq API request via the browser.
  • How to perform a Suzieq API query via Python.

You can find the scripts and code for this lesson within the Suzieq repo under the directory: 003_suzieq_interaction_methods/002_restapi.

Intro to Suzieq’s REST API

In addition to being able to interact with Suzieq via the CLI, GUI or Python, Suzieq provides a REST-based API.

We can confirm the ports that we have configured Suzieq to use by performing a docker-compose ps suzieq_restserver, like this:

❯  docker-compose ps suzieq_restserver
      Name             Command       State                    Ports               
-------------------------------------------------------------------------------------
suzieq_restserver   sq-rest-server   Up      0.0.0.0:8000->8000/tcp,:::8000->8000/tcp

Security

Encryption

For this course, the API is exposed using HTTP. When using the REST API in production, it is recommended to encrypt the server-side traffic from the client to Suzieq by using HTTPS and TLS. The configuration for this is outside the scope of this course.

Further details on how to secure the REST API can be found at: https://suzieq.readthedocs.io/en/latest/rest-server/

API Key

This course uses a default API key. Therefore, if you are using Suzieq in an environment outside of development or test, I would recommend generating your own API key. Further information on how to generate your own key can be found at: https://suzieq.readthedocs.io/en/latest/rest-server/#setup-api-key.

Members Only Content
Join today and get access to:
  • Full deep-dive course library (inc. Batfish, pyATS, Netmiko)
  • Code repositories inc. full course code, scripts and examples
  • 24x7 Multi-vendor labs (Arista, Cisco, Juniper)
  • Private online community
  • Monthly online meetups

100% Satisfaction Guaranteed!
Cancel your membership at any time.


Join Today
Close You've successfully subscribed to Packet Coders.
Close Success! Your account is fully activated, you now have access to all content.
Close Welcome back! You've successfully signed in.
Close Nearly there! To activate your account, please click the link in the email we just sent you.