Skip to content

Instantly share code, notes, and snippets.

@nicolasgarnil
Created May 18, 2022 02:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nicolasgarnil/407153bba01481159e49073bf0238b0b to your computer and use it in GitHub Desktop.
Save nicolasgarnil/407153bba01481159e49073bf0238b0b to your computer and use it in GitHub Desktop.
openapi: "3.0.2"
info:
title: PopSQL API
version: 1.0.0
servers:
- url: http://api.popsql.com.com/v1
components:
schemas:
Column:
type: object
properties:
name:
type: string
example: district
description:
type: string
example: City district
tags:
type: array
items:
type: string
example: tag
archived_at:
type: string
example: "2022-01-02 00:00:00"
Table:
type: object
properties:
name:
type: string
example: city
description:
type: string
example: Cities of the world
tags:
type: array
items:
type: string
example: tag
columns:
type: array
items:
type: object
$ref: "#/components/schemas/Column"
parameters:
Authorization:
in: header
name: Authorization
schema:
type: string
required: true
example: Bearer 2c8e1b856bdc9af4b98c362ab90f
description: 'Prefix the value with \"Bearer\" to indicate the custom authorization type'
ConnectionId:
in: path
name: connection_id
schema:
type: string
required: true
example: 21000
DatabaseName:
in: path
name: database_name
schema:
type: string
required: true
example: world
SchemaName:
in: path
name: schema_name
schema:
type: string
required: true
example: public
TableName:
in: path
name: table_name
schema:
type: string
required: true
example: city
ColumnName:
in: path
name: column_name
schema:
type: string
required: true
example: name
paths:
/authenticate:
post:
summary: Authenticate
tags: [Authentication]
parameters:
- $ref: "#/components/parameters/Authorization"
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
api_key:
type: string
description: Your API key
responses:
"200":
description: An access token
content:
application/json:
schema:
type: object
properties:
token:
type: string
description: The access token
example: 2c8e1b856bdc9af4b98c362ab90f
refresh_token:
type: string
description: The refresh token
example: 3d9f2c967aed0bg5c89d473ac01g
expires_at:
type: string
description: The token's expiration date
example: "2016-12-10 07:29:05.056356"
/connections/{connection_id}/catalog/tables:
get:
tags: [Search Catalog]
summary: Search tables
parameters:
- $ref: "#/components/parameters/Authorization"
- $ref: "#/components/parameters/ConnectionId"
- in: query
name: tags
schema:
type: string
example: lorem,ipsum,dolor
responses:
"200":
description: Search results
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/Table"
/connections/{connection_id}/catalog/columns:
get:
tags: [Search Catalog]
summary: Search columns
parameters:
- $ref: "#/components/parameters/Authorization"
- $ref: "#/components/parameters/ConnectionId"
- in: query
name: tags
schema:
type: string
example: lorem,ipsum,dolor
responses:
"200":
description: Search results
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/Column"
/connections/{connection_id}/catalog:
get:
summary: Get connection catalog
tags: [Data Catalog]
parameters:
- $ref: "#/components/parameters/Authorization"
- $ref: "#/components/parameters/ConnectionId"
responses:
"200":
description: The connection catalog
content:
application/json:
example:
id: 100
name: My connection
databases:
world:
schemas:
public:
tables:
city:
name: city,
description: Cities of the world
execution_count: 100
tags:
- tag
columns:
name:
name: name
description: The name of the city
tags:
- tag
archived_at: null
country_code:
name: country_code
description: The city country code
tags:
- tag
archived_at: null
population:
name: population
description: The city population
tags:
- tag
archived_at: null
patch:
summary: Update connection catalog
tags: [Data Catalog]
parameters:
- $ref: "#/components/parameters/Authorization"
- $ref: "#/components/parameters/ConnectionId"
requestBody:
content:
application/json:
schema:
example:
world:
schemas:
public:
tables:
city:
description: New description
tags:
- tag
responses:
"204":
description: "No content"
/connections/{connection_id}/databases/{database_name}/catalog:
get:
summary: Get database catalog
tags: [Data Catalog]
parameters:
- $ref: "#/components/parameters/Authorization"
- $ref: "#/components/parameters/ConnectionId"
- $ref: "#/components/parameters/DatabaseName"
responses:
"200":
description: The database catalog
content:
application/json:
example:
world:
schemas:
public:
tables:
city:
name: city,
description: Cities of the world
execution_count: 100
tags:
- tag
columns:
name:
name: name
description: The name of the city
tags:
- tag
archived_at: null
country_code:
name: country_code
description: The city country code
tags:
- tag
archived_at: null
population:
name: population
description: The city population
tags:
- tag
archived_at: null
patch:
summary: Update database catalog
tags: [Data Catalog]
parameters:
- $ref: "#/components/parameters/Authorization"
- $ref: "#/components/parameters/ConnectionId"
- $ref: "#/components/parameters/DatabaseName"
requestBody:
content:
application/json:
schema:
example:
schemas:
public:
tables:
city:
description: New description
tags:
- tag
responses:
"204":
description: "No content"
/connections/{connection_id}/databases/{database_name}/schemas/{schema_name}/catalog:
get:
summary: Get schema catalog
tags: [Data Catalog]
parameters:
- $ref: "#/components/parameters/Authorization"
- $ref: "#/components/parameters/ConnectionId"
- $ref: "#/components/parameters/DatabaseName"
- $ref: "#/components/parameters/SchemaName"
responses:
"200":
description: The schema catalog
content:
application/json:
example:
public:
tables:
city:
name: city,
description: Cities of the world
execution_count: 100
tags:
- tag
columns:
name:
name: name
description: The name of the city
tags:
- tag
archived_at: null
country_code:
name: country_code
description: The city country code
tags:
- tag
archived_at: null
population:
name: population
description: The city population
tags:
- tag
archived_at: null
patch:
summary: Update schema catalog
tags: [Data Catalog]
parameters:
- $ref: "#/components/parameters/Authorization"
- $ref: "#/components/parameters/ConnectionId"
- $ref: "#/components/parameters/DatabaseName"
- $ref: "#/components/parameters/SchemaName"
requestBody:
content:
application/json:
schema:
example:
tables:
city:
description: New city description
tags:
- tag
country:
description: New country description
tags:
- tag
responses:
"204":
description: "No content"
/connections/{connection_id}/databases/{database_name}/schemas/{schema_name}/tables/{table_name}/catalog:
get:
summary: Get table catalog
tags: [Data Catalog]
parameters:
- $ref: "#/components/parameters/Authorization"
- $ref: "#/components/parameters/ConnectionId"
- $ref: "#/components/parameters/DatabaseName"
- $ref: "#/components/parameters/SchemaName"
- $ref: "#/components/parameters/TableName"
responses:
"200":
description: The table catalog
content:
application/json:
example:
name: city,
description: Cities of the world
execution_count: 100
tags:
- tag
columns:
name:
name: name
description: The name of the city
tags:
- tag
archived_at: null
country_code:
name: country_code
description: The city country code
tags:
- tag
archived_at: null
population:
name: population
description: The city population
tags:
- tag
archived_at: null
patch:
summary: Update table catalog
tags: [Data Catalog]
parameters:
- $ref: "#/components/parameters/Authorization"
- $ref: "#/components/parameters/ConnectionId"
- $ref: "#/components/parameters/DatabaseName"
- $ref: "#/components/parameters/SchemaName"
- $ref: "#/components/parameters/TableName"
requestBody:
content:
application/json:
schema:
type: object
$ref: "#/components/schemas/Table"
responses:
"204":
description: "No content"
/connections/{connection_id}/databases/{database_name}/schemas/{schema_name}/tables/{table_name}/columns/{column_name}/catalog:
get:
summary: Get column catalog
tags: [Data Catalog]
parameters:
- $ref: "#/components/parameters/Authorization"
- $ref: "#/components/parameters/ConnectionId"
- $ref: "#/components/parameters/DatabaseName"
- $ref: "#/components/parameters/SchemaName"
- $ref: "#/components/parameters/TableName"
- $ref: "#/components/parameters/ColumnName"
responses:
"200":
description: The table catalog
content:
application/json:
example:
name: population
description: The city population
tags:
- tag
archived_at: null
patch:
summary: Update column catalog
tags: [Data Catalog]
parameters:
- $ref: "#/components/parameters/Authorization"
- $ref: "#/components/parameters/ConnectionId"
- $ref: "#/components/parameters/DatabaseName"
- $ref: "#/components/parameters/SchemaName"
- $ref: "#/components/parameters/TableName"
- $ref: "#/components/parameters/ColumnName"
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/Column"
responses:
"204":
description: "No content"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment