DevOps,  Equinix API,  Equinix Metal

Postman API Collections for Equinix Metal – Bare Metal As A Service

Why API functionality is one of the most sought after capabilities for infrastructure, software or application?

Today’s DevOps processes and tools aim to achieve a model of continuous software development right from coding to deploying and maintaining the desired state of the infrastructure and applications. Besides, for Automation and DevOps processes to work, infrastructure needs to be available as code. API is the starting point whereby you can start API automation for those repetitive operational tasks.

This blog will cover the REST API collection and examples for Equinix Metal Day 1 and Day 2 operations via Postman. This Postman’s import collection capabilities will assist you with sample API calls.

This could be a good starting point to understand API calls and examples for Equinix Metal.

Before we go through API collections & examples, I would like to add an overview of Equinix Metal & Postman.

Equinix Metal is an interconnected, automated bare-metal service. It is a dedicated, single-tenant bare metal server offering. Customers can benefit from On-Demand deployment of physical infrastructure in minutes, with an OPEX model. Seize opportunity at software speed. Equinix Metal is seamlessly integrated with Equinix Fabric service, enabling Metal global connectivity to CSP, ISP, NSP, and massive ecosystem.

On other hand, Postman is a collaboration platform for API development. Postman’s features simplify each step of building an API and streamline collaboration so you can create better APIs—faster.

Prerequisites –

  • A working Postman tool to trigger the API calls.
  • A Equinix Metal account with Metal org-id, project id, and API Key.
  • A Equinix Fabric account in case you need to create Fabric Virtual Connections.

Associated Equinix Metal Costs –

Please review pricing information to run Equinix Metal servers. The Metal servers are charged Hourly or based on Reserved term contract or Spot Market bids.

You can get more information on Equinix Metal & Equinix Fabric here.

Equinix Metal – https://metal.equinix.com/product/

Equinix Fabric – https://www.equinix.com/interconnection-services/equinix-fabric

If you have seen my other blogs that cover Automation & Orchestration Use Cases, noticed that I emphasised automating repetitive tasks instead of running them manually.

The main goal of this blog is to provide a handy example for Equinix Metal operation using API.

RESTful API reference guides can occasionally be long and yield significant effort to absorb therefore this blog gives some of the most common operational examples using REST API. This blog post can also help anyone who likes to automate day 1 and day 2 operations by looking at these API collections & examples.

Here is an example of what API collections are compiled into. –

  • Retrieve all Metal Instances, Equinix Fabric connections, Get Operating Systems etc.
  • Creating Metal Instance based on the specific facility (Datacenter), Plan, billing_cycle, hostname, OS, IP address (Private & Public).
  • Creating Equinix Fabric Virtual Connection based on the specific facility (Datacenter), redundancy, speed etc.

Fundamentally one needs to first learn how to pass the API authentication and how parameters or JSON bodies are passed. Subsequently, every API call has been provided with a sample reply so that developers can more easily see what fields are relevant for their purpose and help fast-tracking the coding effort.

You can access my Equinix Metal Postman collections in the following GitHub repo –

https://github.com/ranepr/Metal-API-Collection

 

You can follow below procedure to use these API collections – At this time, I am sure you will have a working Postman tool on your PC.

Import the API collections based on the below path.

Click on ‘File’ from the Postman tool, click on ‘Import’.

Various import options are available. To import your collection from GitHub, select the ‘Code Repository’ option and click on ‘GitHub’.

The GitHub will ask you to authenticate to your GitHub account. Once authenticated, you will able to select the appropriate collection repo to be imported into the Postman.

Confirm the collection file to be imported and click on ‘Import’.

Once the collection API calls are imported, you would need to add the necessary API authentication token to communicate with Metal API.

Here is how you can add an authentication token.

For the API calls, you can mask some of the sensitive information into ‘Environment variables’ e.g API UI address, Project ID etc.

 

Here is how you can add Environment Variables to mask sensitive information from your API calls.

Below is an example where I added a couple of variables to mask my API UI address and the Metal Project ID.

Finally, this is how your API call will look like once you use Environment Variable.

Here is the typical example of an API call made to ‘Retrieve Metal Devices in Project’.

 

Hope you enjoyed this post, I’d be very grateful if you’d help to share it on Social Media. Thank you!