Endpoint Discovery

Overview

Every URL in the API can be accessed using OPTIONS, without any authentication needed. The Droplit system will return a JSON object which contains all the possible methods that can be called on that URL, with their associated parameters, in a format similar to Swagger. For each REST method, parameters found in the path, query string, and request body are listed. Header parameters are not currently listed, but may be in the future. Any header parameters associated with endpoints can be found in the specific documentation for that endpoint.

OPTIONS Key-Value Reference

Top-Level Option

The top-level options in the JSON structure are the REST options that the given URL supports: DELETE, GET, POST, or PUT. A URL can support any combination of these at once, as needed.

in

A string showing where the parameter is located when making an API call. This should be present in all parameter definitions.

  • body: The parameter is located in the request's message body.
  • path: The parameter is located in the request's URL path.
  • query: The parameter is located in the request's query string.

type

A string showing the data type of the parameter. This should be present in all parameter definitions. Acceptable values are one of the following.

  • string
  • number
  • integer
  • object
  • array
  • boolean

required

A boolean value showing whether the parameter is required for the request to function properly. This should be present in all parameter definitions.

enum

This key is an array representing a fixed set of values the parameter may be. These values may be of any valid type.

"expiryType": {
    "in": "query",
    "type": "string",
    "required": false,
    "enum": [ "Infinite", "FixedTtl", "SlidingTtl" ]
}

items

This key must be present if the type of parameter is “array.” It describes the type of items that are contained within an array, and uses its own “type” parameter inside an object.

"services": {
    "in": "body",
    "type": "array",
    "required": false,
    "items": { "type": "string" }
}

match

This key may only be present if the type of parameter is “string.” It describes a regex expression pattern (RegExp) that the string must adhere to.

minLength

This key may only be present if the type of parameter is a “string.” It is an integer value representing the minimum length (inclusive) that the parameter may be.

maxLength

This key may only be present if the type of parameter is a “string.” It is an integer value representing the maximum length (inclusive) that the parameter may be.

minimum

This key may only be present if the type of parameter is “number” or “integer.” It describes the minimum value (inclusive) that the parameter may be.

maximum

This key may only be present if the type of parameter is “number” or “integer.” It describes the maximum value (inclusive) that the parameter may be.

OPTIONS JSON Examples

Some header fields have been removed from these examples for clarity.

OPTIONS https://ioe.droplit.io/api/ecosystems
HTTP/1.1 200 OK
access-control-allow-origin: *
access-control-allow-methods: GET,POST,OPTIONS

{
    "get": {
        "description": "List all ecosystems"
    },
    "post": {
        "description": "Create an ecosystem",
        "parameters": {
            "meta": {
            	"in": "body",
                "type": "object",
                "required": false
            }
        }
    }
}
OPTIONS https://ioe.droplit.io/api/ecosystems/C57146c78149e6c3039e708b6
HTTP/1.1 200 OK
access-control-allow-origin: *
access-control-allow-methods: DELETE,GET,PUT,OPTIONS

{
    "delete": {
        "description": "Delete a specified ecosystem",
        "parameters": {
            "id": {
            	"in": "path",
                "type": "string",
                "match": "^[A-Z]{1}[a-z0-9]{24}$",
                "required": true
            }
        }
    },
    "get": {
        "description": "Get a specified ecosystem",
        "parameters": {
            "id": {
            	"in": "path",
                "type": "string",
                "match": "^[A-Z]{1}[a-z0-9]{24}$",
                "required": true
            }
        }
    },
    "put": {
        "description": "Update a specified ecosystem",
        "parameters": {
            "meta": {
            	"in": "body",
                "type": "object",
                "required": false
            },
            "id": {
            	"in": "path",
                "type": "string",
                "match": "^[A-Z]{1}[a-z0-9]{24}$",
                "required": true
            }
        }
    }
}