Created
May 20, 2021 22:31
-
-
Save buremba/eb01be50dbec8c07af3cf7746334bf38 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "openapi": "3.0.0", | |
| "info": { | |
| "version": "1.0.0", | |
| "title": "Metriql REST API" | |
| }, | |
| "components": { | |
| "schemas": { | |
| "SegmentationQuery": { | |
| "properties": { | |
| "type": { | |
| "enum": [ | |
| "segmentation" | |
| ] | |
| }, | |
| "report": { | |
| "$ref": "https://app.rakam.io/schema/report-options/segmentation.json" | |
| } | |
| } | |
| }, | |
| "FunnelQuery": { | |
| "properties": { | |
| "type": { | |
| "enum": [ | |
| "segmentation" | |
| ] | |
| }, | |
| "report": { | |
| "$ref": "https://app.rakam.io/schema/report-options/funnel.json" | |
| } | |
| } | |
| }, | |
| "RetentionQuery": { | |
| "properties": { | |
| "type": { | |
| "enum": [ | |
| "segmentation" | |
| ] | |
| }, | |
| "report": { | |
| "$ref": "https://app.rakam.io/schema/report-options/retention.json" | |
| } | |
| } | |
| }, | |
| "SqlQuery": { | |
| "properties": { | |
| "type": { | |
| "enum": [ | |
| "segmentation" | |
| ] | |
| }, | |
| "report": { | |
| "$ref": "https://app.rakam.io/schema/report-options/sql.json" | |
| } | |
| } | |
| }, | |
| "QueryError": { | |
| "properties": { | |
| "charPositionInLine": { | |
| "format": "int32", | |
| "type": "integer" | |
| }, | |
| "errorCode": { | |
| "format": "int32", | |
| "type": "integer" | |
| }, | |
| "errorLine": { | |
| "format": "int32", | |
| "type": "integer" | |
| }, | |
| "message": { | |
| "type": "string" | |
| }, | |
| "sqlState": { | |
| "type": "string" | |
| } | |
| }, | |
| "type": "object" | |
| }, | |
| "QueryColumn": { | |
| "properties": { | |
| "dbType": { | |
| "type": "string" | |
| }, | |
| "name": { | |
| "type": "string" | |
| }, | |
| "position": { | |
| "format": "int32", | |
| "type": "integer" | |
| }, | |
| "type": { | |
| "enum": [ | |
| "STRING", | |
| "INTEGER", | |
| "DECIMAL", | |
| "DOUBLE", | |
| "LONG", | |
| "BOOLEAN", | |
| "DATE", | |
| "TIME", | |
| "TIMESTAMP", | |
| "BINARY", | |
| "ARRAY_STRING", | |
| "ARRAY_INTEGER", | |
| "ARRAY_DOUBLE", | |
| "ARRAY_LONG", | |
| "ARRAY_BOOLEAN", | |
| "ARRAY_DATE", | |
| "ARRAY_TIME", | |
| "ARRAY_TIMESTAMP", | |
| "MAP_STRING", | |
| "UNKNOWN" | |
| ], | |
| "type": "string" | |
| } | |
| }, | |
| "required": [ | |
| "name", | |
| "position" | |
| ], | |
| "type": "object" | |
| }, | |
| "QueryResult": { | |
| "properties": { | |
| "error": { | |
| "$ref": "#/components/schemas/QueryError" | |
| }, | |
| "metadata": { | |
| "items": { | |
| "$ref": "#/components/schemas/QueryColumn" | |
| }, | |
| "type": "array" | |
| }, | |
| "properties": { | |
| "additionalProperties": { | |
| "type": "object" | |
| }, | |
| "type": "object" | |
| }, | |
| "result": { | |
| "items": { | |
| "items": { | |
| "type": "object" | |
| }, | |
| "type": "array" | |
| }, | |
| "type": "array" | |
| } | |
| }, | |
| "type": "object" | |
| }, | |
| "TaskTicketQueryResult": { | |
| "properties": { | |
| "id": { | |
| "format": "uuid", | |
| "type": "string" | |
| }, | |
| "result": { | |
| "$ref": "#/components/schemas/QueryResult" | |
| }, | |
| "startedAt": { | |
| "format": "date-time", | |
| "type": "string" | |
| }, | |
| "status": { | |
| "enum": [ | |
| "IDLE", | |
| "RUNNING", | |
| "CANCELED", | |
| "FINISHED" | |
| ], | |
| "type": "string" | |
| }, | |
| "update": { | |
| "type": "object" | |
| } | |
| }, | |
| "required": [ | |
| "startedAt", | |
| "status" | |
| ], | |
| "type": "object" | |
| }, | |
| "SuccessMessage": { | |
| "properties": { | |
| "message": { | |
| "type": "string" | |
| }, | |
| "success": { | |
| "type": "boolean" | |
| } | |
| }, | |
| "required": [ | |
| "success" | |
| ], | |
| "type": "object" | |
| }, | |
| "TaskTicketObject": { | |
| "properties": { | |
| "id": { | |
| "format": "uuid", | |
| "type": "string" | |
| }, | |
| "result": { | |
| "type": "object" | |
| }, | |
| "startedAt": { | |
| "format": "date-time", | |
| "type": "string" | |
| }, | |
| "status": { | |
| "enum": [ | |
| "IDLE", | |
| "RUNNING", | |
| "CANCELED", | |
| "FINISHED" | |
| ], | |
| "type": "string" | |
| }, | |
| "update": { | |
| "type": "object" | |
| } | |
| }, | |
| "required": [ | |
| "startedAt", | |
| "status" | |
| ], | |
| "type": "object" | |
| } | |
| } | |
| }, | |
| "paths": { | |
| "/api/task/cancel": { | |
| "post": { | |
| "description": "", | |
| "operationId": "CancelQuery", | |
| "parameters": [], | |
| "responses": { | |
| "200": { | |
| "description": "Successful request", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "$ref": "#/components/schemas/SuccessMessage" | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "summary": "Cancel a query", | |
| "tags": [ | |
| "task" | |
| ] | |
| } | |
| }, | |
| "/api/task/status": { | |
| "get": { | |
| "description": "Get status of running query", | |
| "operationId": "Status", | |
| "parameters": [], | |
| "responses": { | |
| "200": { | |
| "description": "Successful request", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "$ref": "#/components/schemas/TaskTicketObject" | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "summary": "View task status", | |
| "tags": [ | |
| "task" | |
| ] | |
| } | |
| }, | |
| "/v0/metadata": { | |
| "get": { | |
| "description": "Get dataset schema", | |
| "operationId": "Metadata", | |
| "responses": { | |
| "200": { | |
| "description": "Successful request", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "items": { | |
| "$ref": "https://app.rakam.io/schema/report-options/dbt.schema.json" | |
| }, | |
| "type": "array" | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "summary": "Get metadata", | |
| "tags": [ | |
| "admin" | |
| ] | |
| } | |
| }, | |
| "/v0/query": { | |
| "post": { | |
| "operationId": "ExecuteQuery", | |
| "externalDocs": { | |
| "description": "Learn more about report types", | |
| "url": "https://metriql.com/query/introduction" | |
| }, | |
| "parameters": [ | |
| { | |
| "in": "query", | |
| "name": "useCache", | |
| "schema": { | |
| "type": "boolean" | |
| } | |
| }, | |
| { | |
| "in": "query", | |
| "name": "initialWaitInSeconds", | |
| "schema": { | |
| "default": 50, | |
| "type": "integer" | |
| } | |
| } | |
| ], | |
| "requestBody": { | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "discriminator": { | |
| "propertyName": "type", | |
| "mapping": { | |
| "segmentation": "#/components/schemas/SegmentationQuery", | |
| "funnel": "#/components/schemas/FunnelQuery", | |
| "retention": "#/components/schemas/RetentionQuery", | |
| "sql": "#/components/schemas/SqlQuery" | |
| } | |
| }, | |
| "anyOf": [ | |
| { | |
| "$ref": "#/components/schemas/SegmentationQuery" | |
| }, | |
| { | |
| "$ref": "#/components/schemas/FunnelQuery" | |
| }, | |
| { | |
| "$ref": "#/components/schemas/RetentionQuery" | |
| }, | |
| { | |
| "$ref": "#/components/schemas/SqlQuery" | |
| } | |
| ] | |
| } | |
| } | |
| } | |
| }, | |
| "responses": { | |
| "200": { | |
| "description": "Successful request", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "$ref": "#/components/schemas/TaskTicketQueryResult" | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "summary": "Execute query" | |
| } | |
| }, | |
| "/v0/update-manifest": { | |
| "put": { | |
| "description": "", | |
| "operationId": "UpdateManifest", | |
| "requestBody": { | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "$ref": "#/components/schemas/SuccessMessage" | |
| } | |
| } | |
| } | |
| }, | |
| "summary": "Update manifest.json file", | |
| "responses": { | |
| "200": { | |
| "description": "Successful request", | |
| "content": { | |
| "application/json": { | |
| "schema": { | |
| "$ref": "#/components/schemas/SuccessMessage" | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "tags": [ | |
| "admin" | |
| ] | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment