Skip to content

HyperLeda API specification 1.0.0#

table#


POST /admin/api/v1/table/data#

Add new raw data to the table

Description

Inserts new data to the table.

Deduplicates rows based on their contents. If two rows were identical this method will only insert the last one.

Input parameters

Parameter In Type Default Nullable Description
TokenAuth header string N/A No JWT Bearer token

Request body

{
    "table_id": 0,
    "data": [
        {
            "name": "M 33",
            "ra": 1.5641,
            "dec": 30.6602
        },
        {
            "name": "M 31",
            "ra": 0.7123,
            "dec": 41.269
        }
    ]
}
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the request body
{
    "type": "object",
    "properties": {
        "table_id": {
            "type": "integer",
            "description": "ID of the table to add data to"
        },
        "data": {
            "type": "array",
            "description": "\n            Actual data to append. \n            Keys in this dictionary must be a subset of the columns in the table. \n            If not specified, column will be set to NULL.\n\n            NaN and NULL are considered to be the same thing.\n        ",
            "example": [
                {
                    "name": "M 33",
                    "ra": 1.5641,
                    "dec": 30.6602
                },
                {
                    "name": "M 31",
                    "ra": 0.7123,
                    "dec": 41.269
                }
            ],
            "items": {
                "type": "object",
                "additionalProperties": {}
            }
        }
    },
    "required": [
        "data",
        "table_id"
    ]
}

Response 200 OK

{
    "data": {}
}
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the response body
{
    "type": "object",
    "properties": {
        "data": {
            "$ref": "#/components/schemas/AddDataResponseSchema"
        }
    }
}

POST /admin/api/v1/table#

Get or create schema for the table.

Description

Creates new schema for the table which can later be used to upload data.

Important: If the table with the specified name already exists, does nothing and returns ID of the previously created table without any alterations.

Input parameters

Parameter In Type Default Nullable Description
TokenAuth header string N/A No JWT Bearer token

Request body

{
    "table_name": "string",
    "columns": [
        {
            "name": "name",
            "data_type": "str",
            "ucd": "meta.id"
        },
        {
            "name": "ra",
            "data_type": "float",
            "unit": "hourangle",
            "ucd": "pos.eq.ra"
        },
        {
            "name": "dec",
            "data_type": "float",
            "unit": "deg",
            "ucd": "pos.eq.dec"
        }
    ],
    "bibcode": "2024PDU....4601628D",
    "datatype": "regular",
    "description": "string"
}
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the request body
{
    "type": "object",
    "properties": {
        "table_name": {
            "type": "string",
            "description": "Name of the table"
        },
        "columns": {
            "type": "array",
            "description": "List of columns in the table",
            "example": [
                {
                    "name": "name",
                    "data_type": "str",
                    "ucd": "meta.id"
                },
                {
                    "name": "ra",
                    "data_type": "float",
                    "unit": "hourangle",
                    "ucd": "pos.eq.ra"
                },
                {
                    "name": "dec",
                    "data_type": "float",
                    "unit": "deg",
                    "ucd": "pos.eq.dec"
                }
            ],
            "items": {
                "$ref": "#/components/schemas/ColumnDescription"
            }
        },
        "bibcode": {
            "type": "string",
            "description": "ADS bibcode of the article that published the data (or code of the internal communication)",
            "example": "2024PDU....4601628D"
        },
        "datatype": {
            "type": "string",
            "default": "regular",
            "enum": [
                "regular",
                "reprocessing",
                "preliminary",
                "compilation",
                null
            ],
            "description": "Type of the data in the table",
            "nullable": true
        },
        "description": {
            "type": "string",
            "default": "",
            "description": "Human-readable description of the table",
            "nullable": true
        }
    },
    "required": [
        "bibcode",
        "columns",
        "table_name"
    ]
}

Response 200 OK

{
    "data": {
        "id": 0
    }
}
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the response body
{
    "type": "object",
    "properties": {
        "data": {
            "$ref": "#/components/schemas/CreateTableResponseSchema"
        }
    }
}

Response 201 Created

{
    "data": {
        "id": 0
    }
}
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the response body
{
    "type": "object",
    "properties": {
        "data": {
            "$ref": "#/components/schemas/CreateTableResponseSchema"
        }
    }
}

PATCH /admin/api/v1/table#

Patch table schema

Description

Patch the schema of the table, including column UCDs and units.

Request body

{
    "table_name": "string",
    "actions": [
        {}
    ]
}
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the request body
{
    "type": "object",
    "properties": {
        "table_name": {
            "type": "string",
            "description": "Name of the table"
        },
        "actions": {
            "type": "array",
            "description": "List of actions to perform",
            "items": {
                "$ref": "#/components/schemas/PatchTableAction"
            }
        }
    },
    "required": [
        "actions",
        "table_name"
    ]
}

Response 200 OK

{
    "data": {}
}
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the response body
{
    "type": "object",
    "properties": {
        "data": {
            "$ref": "#/components/schemas/PatchTableResponseSchema"
        }
    }
}

GET /admin/api/v1/table/validation#

Validate table schema

Description

Validates the schema of the table, including column units and UCDs.

Returns code 200 even if there are validation errors.

Input parameters

Parameter In Type Default Nullable Description
table_name query string No Name of the table

Response 200 OK

{
    "data": {
        "validations": [
            {
                "message": "string",
                "validator": "string"
            }
        ]
    }
}
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the response body
{
    "type": "object",
    "properties": {
        "data": {
            "$ref": "#/components/schemas/GetTableValidationResponseSchema"
        }
    }
}

GET /admin/api/v1/table/status/stats#

Get statistics on table processing

Description

Accesses the current status of the processing of a given table. Returns the distribution of objects by processing status.

If there are no objects with the given status, it will not be present in the response.

Input parameters

Parameter In Type Default Nullable Description
TokenAuth header string N/A No JWT Bearer token
table_id query integer No Identifier of the table

Response 200 OK

{
    "data": {
        "processing": {}
    }
}
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the response body
{
    "type": "object",
    "properties": {
        "data": {
            "$ref": "#/components/schemas/TableStatusStatsResponseSchema"
        }
    }
}

source#


POST /admin/api/v1/source#

New source entry

Description

Creates new source entry in the database for internal communication and unpublished articles.

Input parameters

Parameter In Type Default Nullable Description
TokenAuth header string N/A No JWT Bearer token

Request body

{
    "title": "string",
    "authors": [
        "string"
    ],
    "year": 2006
}
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the request body
{
    "type": "object",
    "properties": {
        "title": {
            "type": "string",
            "description": "Title of publication"
        },
        "authors": {
            "type": "array",
            "description": "List of authors",
            "items": {
                "type": "string"
            }
        },
        "year": {
            "type": "integer",
            "minimum": 1500,
            "description": "Year of the publication",
            "example": 2006
        }
    },
    "required": [
        "authors",
        "title",
        "year"
    ]
}

Response 200 OK

{
    "data": {
        "code": "string"
    }
}
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the response body
{
    "type": "object",
    "properties": {
        "data": {
            "$ref": "#/components/schemas/CreateSourceResponseSchema"
        }
    }
}

tasks#


GET /admin/api/v1/task#

Get information about the task

Description

Retrieves information about the task using its id.

Input parameters

Parameter In Type Default Nullable Description
TokenAuth header string N/A No JWT Bearer token
task_id query integer No ID of the task

Response 200 OK

{
    "data": {
        "id": 0,
        "task_name": "string",
        "status": "string",
        "payload": {},
        "start_time": "2022-04-13T15:42:05.901Z",
        "end_time": "2022-04-13T15:42:05.901Z",
        "message": {}
    }
}
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the response body
{
    "type": "object",
    "properties": {
        "data": {
            "$ref": "#/components/schemas/GetTaskInfoResponseSchema"
        }
    }
}

authentication#


POST /admin/api/v1/login#

Login user with username and password

Description

Gives user credentials for authentication in handlers

Request body

{
    "username": "string",
    "password": "string"
}
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the request body
{
    "type": "object",
    "properties": {
        "username": {
            "type": "string",
            "description": "Username"
        },
        "password": {
            "type": "string",
            "description": "Password"
        }
    },
    "required": [
        "password",
        "username"
    ]
}

Response 200 OK

{
    "data": {
        "token": "string"
    }
}
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the response body
{
    "type": "object",
    "properties": {
        "data": {
            "$ref": "#/components/schemas/LoginResponseSchema"
        }
    }
}

Schemas#

AddDataRequestSchema#

Name Type
data Array<>
table_id integer

AddDataResponseSchema#

ColumnDescription#

Name Type
data_type string
description string| null
name string
ucd string| null
unit string| null

CreateSourceRequestSchema#

Name Type
authors Array<string>
title string
year integer

CreateSourceResponseSchema#

Name Type
code string

CreateTableRequestSchema#

Name Type
bibcode string
columns Array<ColumnDescription>
datatype string| null
description string| null
table_name string

CreateTableResponseSchema#

Name Type
id integer

GetTableValidationRequestSchema#

Name Type
table_name string

GetTableValidationResponseSchema#

Name Type
validations Array<TableValidation>

GetTaskInfoRequestSchema#

Name Type
task_id integer

GetTaskInfoResponseSchema#

Name Type
end_time string(date-time)
id integer
message
payload
start_time string(date-time)
status string
task_name string

LoginRequestSchema#

Name Type
password string
username string

LoginResponseSchema#

Name Type
token string

PatchTableAction#

PatchTableRequestSchema#

Name Type
actions Array<PatchTableAction>
table_name string

PatchTableResponseSchema#

TableStatusStatsRequestSchema#

Name Type
table_id integer

TableStatusStatsResponseSchema#

Name Type
processing

TableValidation#

Name Type
message string
validator string

Security schemes#

Name Type Scheme Description
TokenAuth http bearer