This document will evolve as the API design and implementation evolves.
Motivation:
The ICN RESTful API intends to provide access to resources inside the system using a uniform interface through the provision of one logical URI. As a constriant, "Servers and clients may also be replaced and developed independently, as long as the interface between them is not altered."
Requirements:
This RESTful API service will expose the following resources to a user:
- Binary Images
- Container Images
- OS Images
Design:
- Use nouns to describe resources
- In the top URL, identify version, bare-metal cluster name, and resource
- GET - This will be used to list image resources
- POST - This will be used to create image resources
- PUT - This will be used to upload image resources
- DELETE - This will be used to delete image resources
Implementation:
Sample GET Implementation:
The sample API above was create using the swagger.yaml below.
swagger.yml
swagger: "2.0" error: |
---|
Testing:
Proposed sample command to GET all binary images
# Get all binary images
curl -i http:
//localhost
:9015
/v1/baremetalcluster/{clustername}/binary_images/
# Get one binary image
curl -i http:
//localhost
:9015
/v1/baremetalcluster/{clustername}/binary_images/{name}
Proposed sample command to GET all container images
# Get all container images
curl -i http://localhost:9015/v1/baremetalcluster/{clustername}/container_images/
# Get one container image
curl -i http://localhost:9015/v1/baremetalcluster/{clustername}/container_images/{name}
Proposed sample command to GET all OS images
# Get all container images
curl -i http://localhost:9015/v1/baremetalcluster/{clustername}/os_images/
# Get one container image
curl -i http://localhost:9015/v1/baremetalcluster/{clustername}/os_images/{name}
References: