Start a Conversation

Unsolved

10 Posts

1204

October 18th, 2022 21:00

REST API and Dell Technologies Storage - Introduction

REST API with Dell Technologies

What is REST? REST stands for Representational State Transfer. REST provides access to resources on a tree-like structure. In order to reference a resource (like a volume, an initiator group, etc) we use URI (Uniform Resource Identifier), which essentially looks like a path in a Linux file system, ex: /api/v1/volumes/volume1

REST uses HTTP or HTTPS for communication between the client and the API itself. A well design REST API implements CRUD operations by using different HTTP methods as follows:

  • POST method for Create operations, ex: creating a new volume in an array
  • GET method for Read operations
  • PUT method for Updating resources
  • DELETE method for Deleting resources.

REST is stateless, which means it does not store application state information. Since REST is stateless we typically see data being sent back and forth in self-documenting formats like JSON or XML. The actual supported format depends on the REST API and the product. XML used to be more common years ago but JSON is more common nowadays. Pretty much every product in the Dell storage portfolio supports JSON. Some products support both JSON and XML

jsonvsxml.png

 

All products in Dell's storage portfolio have a REST API. In some of them, the REST API is the primary means for management. This is the case for the newest products like PowerStore, VxRail, PPDM etc which have a API-first architecture. In this case, other tools like GUI or CLI are mere consumers of the REST API, and as such offer a subset of the capability available in the REST API. Other more veteran products (PowerMax, Unity, ...) also feature a powerful REST API 

In terms of authentication, all products offer either Basic Authentication (username and password), a token-based system or both systems. Token-based authentication is more secure but it requires an extra step to generate a token

A key online resource to learn about the REST API of all products in Dell Technologies portfolio is the "Developer Portal". You can access it at: https://developer.dell.com/apis

 

Accessing a REST API

As we mentioned above a REST API uses HTTP as the communication protocol. We tend to associate HTTP with the World Wide Web. However, as we saw, the data is transferred using a format like JSON, instead of HTML. This ultimately means that a web browser is not an adequate tool to talk to a REST API. This is partly due to the fact that other HTTP features like headers, body, http method, etc are used by REST APIs but are not accessible in web browsers. So generally we tend to use REST APIs in one of three ways:

  • CLI. These are command line tools like cURL
  • REST Clients. These are graphical tools like Postman
  • Programming Language. All modern programming languages have libraries that can be used to access web services and in particular REST APIs, ex: Python, Ruby, PowerShell, etc.

Let's look at an example of cURL. In the following example we can see how to use cURL to retrieve information about bricks in an XtremIO system

 

 

 

curl -k -u "admin:p@ssw0rd" --request GET https://1.1.1.1/api/json/v2/types/bricks

 

 

 

  • -k – Allow insecure SSL connection. This is needed in case you have a self-signed certificate
  • -u - Provides username and password for basic authentication
  • --request GET – This is the REST API request type aka HTTP method
  • https - the communication is encrypted end-to-end including the actual authentication process
  • /api/json/v2/types/bricks - This is the URI, ie the path to the API object we want to interact with. Most URI include the word "api" at the top level and the version of the API as a subdirectory

When it comes to graphical tools, Postman is very popular. It can be downloaded for free for most common tasks. Here you can see how Postman exposes capabilities of HTTP communications that are not available in ordinary web browsers

Postman example.png

 

One important thing to understand is that Postman is not an automation tool. It is primarily a collaboration tool and as such it allows developers to build "collections" of REST API calls and distribute them seamlessly. There are two open source projects you can find in GitHub that provide Postman collections of storage products and data protection products respectively. If you are new to Postman you can watch this video to learn how to use it with the collections we just mentioned.

One of the nice things you can do with Postman is to generate code for a given REST API call in virtually any programming language which is a good way to start your automation projects.

 

code-samples.PNG

 

In the following articles in these series we will dive deeper into the REST API of some of Dell's most popular products

 

No Responses!

Top