blob: dc5ef93e0fcdbae97c6631376a8f85415ca2a31d [file] [log] [blame]
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
swagger: '2.0'
info:
title: Apache MetaModel Membrane
description: Data Federation as a RESTful service.
version: "1.0"
contact:
name: Apache MetaModel
url: http://metamodel.apache.org
license:
name: Apache License, version 2.0
url: http://www.apache.org/licenses/LICENSE-2.0
consumes:
- application/json
produces:
- application/json
paths:
/:
get:
summary: Hello Membrane
description: An endpoint that provides a confirmation that the system is operational
responses:
200:
description: The system is operational
schema:
type: object
properties:
ping:
type: string
description: Should return 'pong!' when the system is operational
application:
type: string
description: The name of the application running (Apache MetaModel Membrane)
version:
type: string
description: The version of the application running
server-time:
type: object
properties:
timestamp:
type: integer
format: int64
description: The server-time in timestamp format (millis since 1st of January 1970)
iso8601:
type: string
description: The server-time in ISO-8601 format
canonical-hostname:
type: string
description: The canonical hostname of the server
/{tenant}:
parameters:
- name: tenant
in: path
type: string
description: The tenant name
required: true
put:
summary: Create new tenant
responses:
200:
description: Tenant created
schema:
properties:
type:
type: string
description: The type of entity (tenant)
name:
type: string
description: The tenant name/identifier
409:
description: Tenant already exist
schema:
$ref: "#/definitions/error"
get:
summary: Get tenant information
description: Provides basic information about a tenant of the system
responses:
404:
description: Tenant not found
schema:
$ref: "#/definitions/error"
200:
description: Tenant found
schema:
type: object
properties:
type:
type: string
description: The type of entity (tenant)
name:
type: string
description: The tenant name/identifier
datasources:
type: array
items:
type: object
properties:
name:
type: string
description: The name of the datasource
uri:
type: string
format: uri
description: A link to the datasource information
delete:
summary: Delete tenant
description: Deletes a tenant from the system
responses:
200:
description: Tenant deleted
schema:
type: object
properties:
type:
type: string
description: The type of entity (tenant)
name:
type: string
description: The tenant name/identifier
404:
description: Tenant not found
schema:
$ref: "#/definitions/error"
/{tenant}/{datasource}:
parameters:
- name: tenant
in: path
type: string
description: The tenant name
required: true
- name: datasource
in: path
type: string
description: The datasource name
required: true
get:
responses:
200:
description: Datasource found
schema:
type: object
properties:
type:
type: string
description: The type of entity (datasource)
name:
type: string
description: The datasource name
tenant:
type: string
description: The tenant name
updateable:
type: boolean
description: Is this datasource updateable?
query_uri:
type: string
description: A link to the query endpoint for this datasource
format: uri
schemas:
type: array
description: The schemas of this datasource
items:
type: object
properties:
name:
type: string
description: The schema name
uri:
type: string
description: A link to the schema information
format: uri
404:
description: Datasource not found
schema:
$ref: "#/definitions/error"
put:
parameters:
- name: inputData
in: body
description: The definition of the datasource using properties. The same properties as normally applied in MetaModel factories (e.g. 'type', 'resource', 'url', 'driver-class' ,'hostname', 'port', 'catalog', 'database', 'username', 'port', 'table-defs') are used here.
required: true
schema:
type: object
responses:
200:
description: Datasource created
/{tenant}/{datasource}/q:
parameters:
- name: tenant
in: path
type: string
description: The tenant name
required: true
- name: datasource
in: path
type: string
description: The datasource name
required: true
get:
description: Executes a query on the datasource
parameters:
- name: sql
in: query
type: string
description: The MetaModel-flavoured SQL query to execute
required: true
- name: offset
in: query
type: string
description: An offset / first-row flag to set on the query
required: false
- name: limit
in: query
type: string
description: A limit / max-rows flag to set on the query
required: false
responses:
200:
description: Query executed
schema:
$ref: "#/definitions/queryResponse"
400:
description: Failure while parsing query
schema:
$ref: "#/definitions/error"
404:
description: Datasource not found
schema:
$ref: "#/definitions/error"
500:
description: Failure while executing query
schema:
$ref: "#/definitions/error"
/{tenant}/{datasource}/s/{schema}:
parameters:
- name: tenant
in: path
type: string
description: The tenant name
required: true
- name: datasource
in: path
type: string
description: The datasource name
required: true
- name: schema
in: path
type: string
description: The schema name
required: true
get:
responses:
200:
description: Schema found
schema:
type: object
properties:
type:
type: string
description: The type of entity (schema)
name:
type: string
description: The schema name
datasource:
type: string
description: The datasource name
tables:
type: array
description: The names of the schema's tables
items:
type: object
properties:
name:
type: string
description: The table name
uri:
type: string
description: A link to the table information
format: uri
404:
description: Schema not found
schema:
$ref: "#/definitions/error"
/{tenant}/{datasource}/s/{schema}/t/{table}:
parameters:
- name: tenant
in: path
type: string
description: The tenant name
required: true
- name: datasource
in: path
type: string
description: The datasource name
required: true
- name: schema
in: path
type: string
description: The schema name
required: true
- name: table
in: path
type: string
description: The table name
required: true
get:
responses:
200:
description: Table found
schema:
type: object
properties:
type:
type: string
description: The type of entity (table)
name:
type: string
description: The table name
schema:
type: string
description: The schema name
datasource:
type: string
description: The datasource name
tenant:
type: string
description: The tenant name
columns:
type: array
description: The names of the table's columns
items:
type: object
properties:
name:
type: string
description: The column name
uri:
type: string
description: A link to the column information
format: uri
404:
description: Table not found
schema:
$ref: "#/definitions/error"
/{tenant}/{datasource}/s/{schema}/t/{table}/d:
parameters:
- name: tenant
in: path
type: string
description: The tenant name
required: true
- name: datasource
in: path
type: string
description: The datasource name
required: true
- name: schema
in: path
type: string
description: The schema name
required: true
- name: table
in: path
type: string
description: The table name
required: true
get:
description: Gets the data of the table
responses:
200:
description: Query executed
schema:
$ref: "#/definitions/queryResponse"
400:
description: Failure while parsing query
schema:
$ref: "#/definitions/error"
404:
description: Table not found
schema:
$ref: "#/definitions/error"
500:
description: Failure while executing query
schema:
$ref: "#/definitions/error"
post:
description: Inserts data to the table
parameters:
- name: inputData
in: body
description: The data to insert
required: true
schema:
type: array
items:
description: A record to insert where each key is expected to match a column name and each value is the value to put.
type: object
responses:
200:
description: Data inserted
#TODO
404:
description: Table not found
schema:
$ref: "#/definitions/error"
/{tenant}/{datasource}/s/{schema}/t/{table}/c/{column}:
parameters:
- name: tenant
in: path
type: string
description: The tenant name
required: true
- name: datasource
in: path
type: string
description: The datasource name
required: true
- name: schema
in: path
type: string
description: The schema name
required: true
- name: table
in: path
type: string
description: The table name
required: true
- name: column
in: path
type: string
description: The column name
required: true
get:
description: Gets information about a column
responses:
200:
description: Query executed
schema:
type: object
properties:
type:
type: string
description: The type of entity (column)
name:
type: string
description: The column name
table:
type: string
description: The table name
schema:
type: string
description: The schema name
datasource:
type: string
description: The datasource name
tenant:
type: string
description: The tenant name
metadata:
type: object
description: Metadata about the column
properties:
number:
type: integer
description: The column number (0-based)
size:
type: integer
description: The column size
nullable:
type: boolean
description: Is the column nullable?
primary-key:
type: boolean
description: Is the column a primary key?
indexed:
type: boolean
description: Is the column indexed?
column-type:
type: string
description: The column type (as interpreted/adapted by Apache MetaModel)
native-type:
type: string
description: The native column type (as defined by the datasource itself)
remarks:
type: string
description: Any remarks on the column
404:
description: Column not found
schema:
$ref: "#/definitions/error"
definitions:
queryResponse:
description: Represents the result of a query - a dataset
type: object
properties:
type:
type: string
description: The type of entity (dataset)
headers:
type: array
description: The dataset header names
items:
type: string
data:
type: array
description: The actual data returned by the query
items:
type: array
items:
type: object
error:
description: Elaborates the error that occurred
type: object
properties:
code:
type: integer
description: The HTTP status code
message:
type: string
description: A humanly readable error message
additional_details:
type: object
description: Any auxilary details to further elaborate the error