SlyceIO OpenAPI Specification
{
  "openapi": "3.0.1",
  "info": {
    "title": "SlyceIO OpenAPI",
    "description": "SlyceIO API used to interact with Azure Cosmos DB container data",
    "license": {
      "name": "SlyceIO"
    },
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://api.slyce-io.co.uk"
    }
  ],
  "security": [
    {
      "BearerAuth": []
    }
  ],
  "paths": {
    "/auth-token": {
      "post": {
        "description": "Creates an encrypted bearer token for a specified API key",
        "servers": [
          {
            "url": "https://authapi.slyce-io.co.uk"
          }
        ],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Token Created",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/container-definitions/{containerDefinitionId}/documents": {
      "post": {
        "description": "Creates a document in the specified container definition",
        "requestBody": {
          "description": "Document to add to the container",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "containerDefinitionId",
            "in": "path",
            "description": "ID of the container definition in which to create the document",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "Document Created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Errors"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "409": {
            "description": "Resource Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/container-definitions/{containerDefinitionId}/documents/{documentId}": {
      "put": {
        "description": "Updates a document in the specified container definition",
        "requestBody": {
          "description": "Document to update",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "containerDefinitionId",
            "in": "path",
            "description": "ID of the container definition in which the document exists",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "documentId",
            "in": "path",
            "description": "ID of the document to update",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "SlyceIO-Api-ETag",
            "in": "header",
            "description": "Use the SlyceIO-Api-ETag header value returned from the Create/Update/Get request or use an asterix (*) to ignore versioning.",
            "required": true,
            "example": "*",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Document Updated"
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Errors"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "409": {
            "description": "Resource Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "412": {
            "description": "Precondition Failed",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      },
      "get": {
        "description": "Retrieves the document from the specified container definition",
        "parameters": [
          {
            "name": "containerDefinitionId",
            "in": "path",
            "description": "ID of the container definition",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "documentId",
            "in": "path",
            "description": "ID of the document to retrieve",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "partitionKeys",
            "in": "query",
            "description": "URL encoded JSON array that details the partition key or keys for the required document",
            "required": true,
            "schema": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/PartitionKey"
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Document Retrieved",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Errors"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      },
      "delete": {
        "description": "Deletes a document from the specified container definition",
        "parameters": [
          {
            "name": "containerDefinitionId",
            "in": "path",
            "description": "ID of the container definition",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "documentId",
            "in": "path",
            "description": "ID of the document to delete",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "SlyceIO-Api-ETag",
            "in": "header",
            "description": "Use the SlyceIO-Api-ETag header value returned from the Create/Update/Get request or use an asterix (*) to ignore versioning.",
            "required": true,
            "example": "*",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "partitionKeys",
            "in": "query",
            "description": "URL encoded JSON array that details the partition key or keys for the required document",
            "required": true,
            "schema": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/PartitionKey"
              }

            }
          }
        ],
        "responses": {
          "204": {
            "description": "Document deleted"
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Errors"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "412": {
            "description": "Precondition Failed",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/container-definitions/{containerDefinitionId}/documents/query": {
      "post": {
        "description": "Executes a query defined in the specified container definition",
        "requestBody": {
          "description": "Query definition and parameters",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/QueryDefinition"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "containerDefinitionId",
            "in": "path",
            "description": "ID of the container definition in which to execute the query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "SlyceIO-Api-Continuation-Token",
            "in": "header",
            "description": "An optional token used for fetching the next set of data - the token must be used with the same query criteria from which it was originally created",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "SlyceIO-Api-Max-Records",
            "in": "header",
            "description": "The maximum number of records to return in the response",
            "required": false,
            "schema": {
              "type": "number"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Query Executed",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Errors"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "PartitionKey": {
        "required": [
          "name",
          "type"
        ],
        "type": "object",
        "properties": {
          "name": {
            "description": "The name of the partition key",
            "type": "string"
          },
          "type": {
            "description": "The type of the partition key",
            "type": "string",
            "enum": [ "None", "Null", "String", "Number", "Boolean" ]
          },
          "value": {
            "description": "The value of the partition key",
            "type": "string"
          }
        }
      },
      "QueryDefinition": {
        "required": [
          "QueryDefinitionId"
        ],
        "type": "object",
        "properties": {
          "QueryDefinitionId": {
            "description": "The ID of the query definition",
            "type": "string"
          },
          "Parameters": {
            "description": "The parameters required for the query definition",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/QueryDefinitionParameter"
            }
          }
        }
      },
      "QueryDefinitionParameter": {
        "required": [
          "Name",
          "Value"
        ],
        "type": "object",
        "properties": {
          "Name": {
            "description": "The name of the query definition parameter",
            "type": "string"
          },
          "Value": {
            "description": "The value of the query definition parameter",
            "type": "string"
          }
        }
      },
      "Errors": {
        "properties": {
          "errors": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Error": {
        "required": [
          "message"
        ],
        "type": "object",
        "properties": {
          "message": {
            "type": "string"
          }
        }
      }
    },
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "SlyceIO-Api-Key"
      },
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer"
      }
    }
  }
}