An Artifact Management Platform

Basics: The REST Client API

Overview

Indy conducts all interactions with its clients via its REST API. This even includes its web UI, which is just a Javascript application served by Indy that knows how to use the REST API behind the scenes.

One of the biggest advantages of this is that it’s relatively simple to write new client APIs. Whether you’re using Java, Python, or even cURL, it’s not too hard to make use of the Indy REST API and the JSON data that flows through it. Anyone who wants to implement a new client API immediately has access to all the features that any other client can use.

Also, it allows us to concentrate our implementation and testing efforts on a single API, which makes that API more stable and complete.

Getting Started

To get started using the Indy REST API, you don’t really need anything more than cURL or another HTTP client library. It helps to have a JSON parser, but it’s not strictly required (you could use grep and sed in a pinch).

Indy’s REST API resides under the /api sub-path on a given Indy instance. For example, if we wanted to get some basic information about the version of Indy we’re using, we could simply do this:

$ curl -i http://localhost:8080/api/stats/version-info
HTTP/1.1 200 OK
Connection: keep-alive
Set-Cookie: JSESSIONID=d0qWUoWOtEo-wjIU2i4rArSD; path=/
Content-Type: application/json
Content-Length: 129
Date: Fri, 08 May 2015 20:30:08 GMT

{
  "version" : "0.20.1-SNAPSHOT",
  "builder" : "jdcasey",
  "commit-id" : "4ff6a63",
  "timestamp" : "2015-05-05 14:11 -0500"
}

REST Verbs

In general, Indy tries to adhere to the typical REST principles for how the different HTTP method should be used:

The main divergence from these is in the artifact-store content resource, where the PUT verb is be used to create new files. This is supported for compatibility reasons, since Apache Maven uses PUT to deploy artifacts to remote repositories.

Indy Core Endpoints

Indy’s core functionality supports CRUD++ operations (augmenting basic CRUD with things like listing and existence) for artifact stores and store content. It also supports some inspection operations, such as returning version and build information for the Indy instance. More specifically, the core supports the following three categories of operations:

Further Reading

Each Indy add-on can expose as many of its own REST API operations as makes sense, in addition to those of the Indy core. Documentation for these add-ons will detail the corresponding REST API operations they provide.