Files
query-orchestration/serviceAPIs/queryService.yaml
T

715 lines
19 KiB
YAML
Raw Normal View History

2025-01-15 19:45:51 +00:00
---
openapi: 3.0.3
info:
title: Query Orchestration API
description: API documentation for the Query Orchestration services.
version: 1.0.0
servers:
- url: https://api.example.com/v1
description: Production server
tags:
2025-01-21 18:24:14 +00:00
- name: ClientService
description: Operations related to clients
- name: CollectorService
description: Operations related to collectors
- name: DocumentsService
description: Operations related to documents
2025-01-21 18:24:14 +00:00
- name: QueryService
description: Operations related to queries
2025-01-15 19:45:51 +00:00
- name: ExportService
description: Operations related to exports
paths:
/client:
2025-01-21 18:24:14 +00:00
post:
operationId: createClient
tags:
- ClientService
summary: Create a new client
description: Creates a new client with the provided details.
requestBody:
description: The details required to create a client
2025-01-21 18:24:14 +00:00
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/ClientCreate"
2025-01-21 18:24:14 +00:00
responses:
"201":
2025-01-21 18:24:14 +00:00
description: Client created successfully.
content:
application/json:
schema:
$ref: "#/components/schemas/ClientIDBody"
"400":
$ref: "#/components/responses/InvalidRequest"
2025-01-21 18:24:14 +00:00
/client/{id}:
parameters:
- $ref: "#/components/parameters/ClientID"
2025-01-21 18:24:14 +00:00
get:
operationId: getClient
tags:
- ClientService
summary: Get a client by ID
description: Retrieves a specific client by its ID.
responses:
"200":
2025-01-21 18:24:14 +00:00
description: Client details.
content:
application/json:
schema:
$ref: "#/components/schemas/DocClient"
"400":
$ref: "#/components/responses/InvalidRequest"
2025-01-21 18:24:14 +00:00
patch:
operationId: updateClient
tags:
- ClientService
summary: Update a client
description: Updates an existing client with new details.
requestBody:
description: The details to update
2025-01-21 18:24:14 +00:00
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/ClientUpdate"
2025-01-21 18:24:14 +00:00
responses:
"200":
2025-01-21 18:24:14 +00:00
description: Client updated successfully.
"400":
$ref: "#/components/responses/InvalidRequest"
2025-01-21 18:24:14 +00:00
/query:
2025-01-15 19:45:51 +00:00
get:
operationId: listQueries
tags:
- QueryService
summary: List queries
description: Retrieves a list of queries based on filter criteria.
responses:
"200":
2025-01-15 19:45:51 +00:00
description: A list of queries.
content:
application/json:
schema:
$ref: "#/components/schemas/ListQueries"
"400":
$ref: "#/components/responses/InvalidRequest"
2025-01-15 19:45:51 +00:00
post:
operationId: createQuery
tags:
- QueryService
summary: Create a new query
description: Creates a new query with the provided details.
requestBody:
description: The details required to create a query
2025-01-15 19:45:51 +00:00
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/QueryCreate"
2025-01-15 19:45:51 +00:00
responses:
"201":
2025-01-15 19:45:51 +00:00
description: Query created successfully.
content:
application/json:
schema:
$ref: "#/components/schemas/IdMessage"
"400":
$ref: "#/components/responses/InvalidRequest"
2025-01-15 19:45:51 +00:00
/query/{id}:
parameters:
- $ref: "#/components/parameters/QueryID"
2025-01-15 19:45:51 +00:00
get:
2025-01-21 18:24:14 +00:00
operationId: getQuery
2025-01-15 19:45:51 +00:00
tags:
- QueryService
summary: Get a query by ID
description: Retrieves a specific query by its ID.
responses:
"200":
2025-01-15 19:45:51 +00:00
description: Query details.
content:
application/json:
schema:
$ref: "#/components/schemas/Query"
"400":
$ref: "#/components/responses/InvalidRequest"
2025-01-15 19:45:51 +00:00
patch:
operationId: updateQuery
tags:
- QueryService
summary: Update a query
description: Updates an existing query with new details.
requestBody:
description: The update values for the desired query.
2025-01-15 19:45:51 +00:00
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/QueryUpdate"
2025-01-15 19:45:51 +00:00
responses:
"200":
2025-01-15 19:45:51 +00:00
description: Query updated successfully.
"400":
$ref: "#/components/responses/InvalidRequest"
2025-01-15 19:45:51 +00:00
/query/{id}/test:
parameters:
- $ref: "#/components/parameters/QueryID"
2025-01-15 19:45:51 +00:00
post:
operationId: testQuery
tags:
- QueryService
summary: Test a query
description: Executes a test run of a query with the provided parameters.
requestBody:
description: The query test requirements.
2025-01-15 19:45:51 +00:00
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/QueryTestRequest"
2025-01-15 19:45:51 +00:00
responses:
"200":
2025-01-15 19:45:51 +00:00
description: Test result.
content:
application/json:
schema:
$ref: "#/components/schemas/QueryTestResponse"
"400":
$ref: "#/components/responses/InvalidRequest"
/client/{id}/status:
parameters:
- $ref: "#/components/parameters/ClientID"
get:
operationId: getStatusByClientId
tags:
- ClientService
summary: Get client sync status
description: Retrieves the sync status by its client ID.
responses:
"200":
description: Client status details.
content:
application/json:
schema:
$ref: "#/components/schemas/ClientStatusBody"
"400":
$ref: "#/components/responses/InvalidRequest"
/client/{id}/collector:
parameters:
- $ref: "#/components/parameters/ClientID"
2025-01-15 19:45:51 +00:00
get:
operationId: getCollectorByClientId
2025-01-15 19:45:51 +00:00
tags:
- CollectorService
summary: Get a collector by client ID
description: Retrieves a specific collector by its client ID.
2025-01-15 19:45:51 +00:00
responses:
"200":
description: Collector details.
2025-01-15 19:45:51 +00:00
content:
application/json:
schema:
$ref: "#/components/schemas/Collector"
"400":
$ref: "#/components/responses/InvalidRequest"
patch:
operationId: setCollectorByClientId
2025-01-15 19:45:51 +00:00
tags:
- CollectorService
summary: Set a collector
description: Set client collector with new details.
2025-01-15 19:45:51 +00:00
requestBody:
description: The details to be set for the collector.
2025-01-15 19:45:51 +00:00
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/CollectorSet"
2025-01-15 19:45:51 +00:00
responses:
"204":
description: Collector set successfully.
"400":
$ref: "#/components/responses/InvalidRequest"
2025-01-15 19:45:51 +00:00
/client/{id}/documents:
parameters:
- $ref: "#/components/parameters/ClientID"
get:
operationId: listDocumentsByClientId
tags:
- DocumentsService
summary: List the documents for a client
description: Retrieves the list of documents by the client ID.
responses:
"200":
description: Client documents list.
content:
application/json:
schema:
$ref: "#/components/schemas/ListDocuments"
"400":
$ref: "#/components/responses/InvalidRequest"
/client/{id}/export:
parameters:
- $ref: "#/components/parameters/ClientID"
2025-03-05 19:37:06 +00:00
post:
operationId: triggerExport
tags:
- ExportService
summary: Trigger an export
description: Initiates the export process.
requestBody:
description: The export requirements.
2025-03-05 19:37:06 +00:00
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/ExportTrigger"
responses:
"201":
description: Export triggered successfully.
content:
application/json:
schema:
$ref: "#/components/schemas/IdMessage"
"400":
$ref: "#/components/responses/InvalidRequest"
/export/{id}:
parameters:
- $ref: "#/components/parameters/ExportID"
get:
operationId: exportState
tags:
- ExportService
summary: Check export state.
description: Checks the current state of an export.
responses:
"200":
description: Export has been completed.
content:
application/json:
schema:
$ref: "#/components/schemas/ExportDetails"
"400":
$ref: "#/components/responses/InvalidRequest"
2025-01-15 19:45:51 +00:00
components:
parameters:
ClientID:
in: path
name: id
required: true
schema:
$ref: "#/components/schemas/ClientID"
description: The client ID.
ExportID:
in: path
name: id
required: true
schema:
$ref: "#/components/schemas/ExportID"
description: The export ID.
QueryID:
in: path
name: id
required: true
schema:
$ref: "#/components/schemas/QueryID"
description: The ID of the query.
responses:
InvalidRequest:
description: Invalid request body.
2025-01-15 19:45:51 +00:00
schemas:
ClientID:
type: string
description: The client external id
example: AAA
ClientUID:
type: string
format: uuid
description: The client internal unique id
example: 0195853c-8fdd-77cd-b36c-255241bddd33
QueryID:
type: string
format: uuid
description: The query id.
example: 019580df-ef65-7676-8de9-94435a93337a
DocumentID:
type: string
format: uuid
description: The document id.
example: 019580df-b3f8-7348-9ab1-1e55b3f18ed7
ExportID:
type: string
format: uuid
description: The export id.
example: 019580de-4d51-713c-98ee-464e83811f13
ClientName:
type: string
description: The client name
example: AArete
ClientCanSync:
type: boolean
description: If the client is allowing active syncs
2025-01-15 19:45:51 +00:00
QueryType:
type: string
enum:
- JSON_EXTRACTOR
- CONTEXT_FULL
description: Specifies the type of the query.
QueryConfig:
type: string
description: Configuration for the query.
2025-01-15 19:45:51 +00:00
Query:
description: A logic unit of execution.
2025-01-15 19:45:51 +00:00
type: object
properties:
id:
$ref: "#/components/schemas/QueryID"
2025-01-15 19:45:51 +00:00
type:
$ref: "#/components/schemas/QueryType"
2025-01-15 19:45:51 +00:00
active_version:
$ref: "#/components/schemas/Version"
2025-01-15 19:45:51 +00:00
latest_version:
$ref: "#/components/schemas/Version"
2025-01-15 19:45:51 +00:00
config:
$ref: "#/components/schemas/QueryConfig"
2025-01-15 19:45:51 +00:00
required_queries:
$ref: "#/components/schemas/RequiredQueryIDs"
2025-01-15 19:45:51 +00:00
required:
- id
- type
- active_version
- latest_version
ListQueries:
description: A set of queries.
2025-01-15 19:45:51 +00:00
type: object
properties:
queries:
type: array
items:
$ref: "#/components/schemas/Query"
2025-01-15 19:45:51 +00:00
description: List of queries.
required:
- queries
QueryCreate:
description: The parameters required to create a query.
2025-01-15 19:45:51 +00:00
type: object
properties:
type:
$ref: "#/components/schemas/QueryType"
2025-01-15 19:45:51 +00:00
config:
$ref: "#/components/schemas/QueryConfig"
2025-01-15 19:45:51 +00:00
required_queries:
$ref: "#/components/schemas/RequiredQueryIDs"
2025-01-15 19:45:51 +00:00
required:
- type
RequiredQueryIDs:
type: array
items:
$ref: "#/components/schemas/QueryID"
description: List of required query IDs.
2025-01-15 19:45:51 +00:00
QueryUpdate:
description: The properties that may be updated for a query.
2025-01-15 19:45:51 +00:00
type: object
properties:
config:
$ref: "#/components/schemas/QueryConfig"
2025-01-15 19:45:51 +00:00
active_version:
$ref: "#/components/schemas/Version"
2025-01-15 19:45:51 +00:00
required_queries:
$ref: "#/components/schemas/RequiredQueryIDs"
2025-01-15 19:45:51 +00:00
QueryTestRequest:
description: The properties for a query test request.
2025-01-15 19:45:51 +00:00
type: object
properties:
document_id:
$ref: "#/components/schemas/DocumentID"
2025-01-15 19:45:51 +00:00
query_version:
$ref: "#/components/schemas/Version"
2025-01-15 19:45:51 +00:00
required:
- document_id
- query_version
QueryTestResponse:
description: The response from a query test.
2025-01-15 19:45:51 +00:00
type: object
properties:
value:
type: string
description: Result of the query test.
required:
- value
DocClient:
description: The properties of a client.
2025-01-21 18:24:14 +00:00
type: object
properties:
uid:
$ref: "#/components/schemas/ClientUID"
2025-01-21 18:24:14 +00:00
id:
$ref: "#/components/schemas/ClientID"
2025-01-21 18:24:14 +00:00
name:
$ref: "#/components/schemas/ClientName"
2025-01-21 18:24:14 +00:00
can_sync:
$ref: "#/components/schemas/ClientCanSync"
2025-01-21 18:24:14 +00:00
required:
- id
- uid
2025-01-21 18:24:14 +00:00
- name
- can_sync
ClientStatus:
type: string
enum:
- IN_SYNC
- NOT_SYNCED
- NOT_SYNCING
description: Specifies the status of a client.
ClientStatusBody:
description: A client status information object.
type: object
properties:
status:
$ref: "#/components/schemas/ClientStatus"
required:
- status
ClientIDBody:
description: The client id.
type: object
properties:
id:
$ref: "#/components/schemas/ClientID"
required:
- id
ListDocuments:
type: array
description: The documents in the client.
items:
$ref: "#/components/schemas/Document"
Document:
description: The document properties.
type: object
properties:
id:
$ref: "#/components/schemas/DocumentID"
bucket:
type: string
description: The bucket containing the document
key:
type: string
description: The path to the document
required:
- id
- bucket
- key
2025-01-21 18:24:14 +00:00
ClientCreate:
description: The properties for creation.
2025-01-21 18:24:14 +00:00
type: object
properties:
id:
$ref: "#/components/schemas/ClientID"
2025-01-21 18:24:14 +00:00
name:
$ref: "#/components/schemas/ClientName"
2025-01-21 18:24:14 +00:00
required:
- id
2025-01-21 18:24:14 +00:00
- name
ClientUpdate:
description: The properties that may be updated.
2025-01-21 18:24:14 +00:00
type: object
properties:
name:
$ref: "#/components/schemas/ClientName"
2025-01-21 18:24:14 +00:00
can_sync:
$ref: "#/components/schemas/ClientCanSync"
2025-01-21 18:24:14 +00:00
2025-01-15 19:45:51 +00:00
IdMessage:
description: A single uuid.
2025-01-15 19:45:51 +00:00
type: object
properties:
id:
type: string
format: uuid
description: Unique identifier for entity.
2025-01-15 19:45:51 +00:00
required:
- id
CodeVersion:
type: integer
format: int64
description: The desired code version.
Version:
type: integer
format: int32
description: The desired version.
Collector:
2025-01-15 19:45:51 +00:00
type: object
properties:
client_id:
$ref: "#/components/schemas/ClientID"
active_version:
$ref: "#/components/schemas/Version"
latest_version:
$ref: "#/components/schemas/Version"
minimum_cleaner_version:
$ref: "#/components/schemas/CodeVersion"
minimum_text_version:
$ref: "#/components/schemas/CodeVersion"
fields:
$ref: "#/components/schemas/CollectorFields"
description: Collector model.
required:
- client_id
- fields
- minimum_cleaner_version
- minimum_text_version
- latest_version
- active_version
2025-01-15 19:45:51 +00:00
CollectorFields:
type: array
description: The fields in the collector.
items:
$ref: "#/components/schemas/CollectorField"
CollectorSet:
2025-01-15 19:45:51 +00:00
type: object
properties:
minimum_cleaner_version:
$ref: "#/components/schemas/CodeVersion"
minimum_text_version:
$ref: "#/components/schemas/CodeVersion"
active_version:
$ref: "#/components/schemas/Version"
fields:
$ref: "#/components/schemas/CollectorFields"
description: Payload for updating a Collector.
2025-01-15 19:45:51 +00:00
CollectorFieldName:
type: string
description: The output field name.
CollectorField:
2025-01-15 19:45:51 +00:00
type: object
description: The field properties for the collector.
2025-01-15 19:45:51 +00:00
properties:
name:
$ref: "#/components/schemas/CollectorFieldName"
query_id:
$ref: "#/components/schemas/QueryID"
required:
- name
- query_id
2025-01-15 19:45:51 +00:00
ExportTrigger:
type: object
properties:
ingestion_filters:
type: object
description: Filter the scope based on ingestion parameters.
properties:
start_date:
type: string
description: This first date of ingestion.
end_date:
type: string
description: The last date of ingestion.
field_filters:
type: array
description: Filter the scope based on field output values.
items:
$ref: "#/components/schemas/FieldFilter"
2025-01-15 19:45:51 +00:00
description: Payload for triggering an export.
FieldFilter:
type: object
properties:
field_name:
$ref: "#/components/schemas/CollectorFieldName"
condition:
$ref: "#/components/schemas/FieldFilterCondition"
values:
type: array
description: The values useful to the filter.
items:
type: string
description: Filtering a column
required:
- field_name
- condition
- values
FieldFilterCondition:
type: string
enum:
- less_than
- greater_than
- closed_interval
- open_interval
- left_closed_interval
- right_closed_interval
- include
- exclude
description: The possible field filtering conditions.
ExportStatus:
type: string
enum:
- completed
- in_progress
- failed
description: The possible export states.
ExportDetails:
type: object
properties:
client_id:
$ref: "#/components/schemas/ClientID"
status:
$ref: "#/components/schemas/ExportStatus"
output_location:
type: string
description: The location in which the export zip file will be found.
example: |
s3://{bucket_name}/{external_client_id}/yyyymmdd/{export_id}.csv
description: Payload for export trigger response.
required:
- client_id
- status