Describe ASAQC-related API endpoints

This commit is contained in:
D. Berge
2021-10-03 21:11:37 +02:00
parent 5a7fe9b38a
commit 978256ceab

View File

@@ -61,6 +61,15 @@ tags:
-
name: navdata
description: Data from navigation headers
-
name: asaqc
description: |
Interface to [Equinor](https://equinor.com/)'s [ASAQC Vessel Track](https://api.equinor.com/docs/services/vessel-track/) application programming interface.
Used for transferring line log data from the vessel to the Equinor office. As implemented as of October 2021, for each sequence that is queued for sending it transfers the following files:
* SeisJSON file containing sequence event data.
* PDF file which is a representation of the corresponding SeisJSON.
components:
securitySchemes:
@@ -701,6 +710,100 @@ components:
description: Internal database reference to the current project (only present when `_online` is `true`)
QueueRequestASAQC:
description: >
Parameters of an ASAQC transfer item.
type: object
required: [ "project", "sequence", "mimetype" ]
properties:
project:
type: string
description: Project ID.
sequence:
type: integer
description: Sequence number.
example:
{
"project": "eq21205",
"sequence": 55
}
QueueItem:
description: Information about an item in the transfers queue
type: object
properties:
item_id:
type: integer
description: The unique ID of this queue item.
queue_id:
type: integer
description: The ID of the queue that this item belongs to.
status:
type: string
enum: [ "queued", "cancelled", "failed", "sent" ]
description: Status of the queue request. Failed transfers may get rescheduled as a new item, in which case `parent_id` will reference the original request.
payload:
$ref: "#/components/schemas/QueueRequestASAQC"
results:
type: object
description: Information about the transfer after an attempt has been made. It is non-empty only for items with status `failed` or `sent`.
properties:
digest:
type: object
description: Cryptographic digest of the transmitted payload.
properties:
sha256:
type: object
description: SHA-256 digest.
properties:
hex:
type: string
description: Hexadecimal representation of the SHA-256 hash of the contents of the file that was sent. Can be used to check, with a high degree of confidence, whether a copy of the file is byte-by-byte the same as the data that was sent.
response:
type: object
description: If the request was successful, the contents of this property are the response body sent by the remote server. If there was an error, the `error` property will be present and may contain details of the problem.
created_on:
type: string
format: date-time
description: Creation timestamp of this request.
updated_on:
type: string
format: date-time
description: Last update timestamp of this request.
not_before:
type: string
format: date-time
description: The request will not be processed before this.
parent_id:
type: integer
description: If this request is a retry of a failed attempt, this item references the ID of the original request.
example:
{
"item_id": 87,
"status": "sent",
"payload": {
"project": "eq21205",
"sequence": 55
},
"results": [
{
"id": "849e8659-953d-466c-8cfc-ad8d615d1ac0",
"fileName": "1065960055S00000-NavLog.json"
},
{
"id": "517864a7-0981-46c6-8f39-aa53da865de7",
"fileName": "1065960055S00000-NavLog.pdf"
}
],
"created_on": "2021-10-03T01:47:02.312Z",
"updated_on": "2021-10-03T01:51:19.656Z",
"not_before": "1970-01-01T00:00:00.000Z",
"parent_id": null
}
security:
- BearerAuthUser: []
- CookieAuthUser: []
@@ -1443,6 +1546,200 @@ paths:
$ref: "#/components/responses/401"
/queue/outgoing/asaqc:
get:
summary: Get list of queued items.
tags: [ "asaqc" ]
security:
- BearerAuthGuest: []
- CookieAuthGuest: []
parameters:
-
name: status
in: query
schema:
type: string
enum: [ "queued", "cancelled", "failed", "sent" ]
description: Return only items with matching status. If unspecified, items will not be filtered by status.
-
name: order
in: query
schema:
type: string
enum:
- created_on
- updated_on
- not_before
- item_id
- status
- parent_id
- project
- sequence
default: updated_on
description: Order the returned items by the specified property.
-
name: dir
in: query
schema:
type: string
enum: [ '-', '+' ]
default: '-'
description: |
Specify whether to order items in ascending or descending order.
* `-` indicates descending order.
* `+` indicates ascending order (in fact, *anything at all* other than `-` means ascending order).
-
name: limit
in: query
schema:
type: integer
minimum: 1
maximum: 1000
description: Maximum number of items to retrieve.
- $ref: "#/components/parameters/QueryOffset"
responses:
"200":
description: List of queue items
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/QueueItem"
example:
[
{
"item_id": 167,
"status": "sent",
"payload": {
"project": "eq21203",
"sequence": 176
},
"results": [
{
"digest": {
"sha256": {
"hex": "b67e3a925e0b0845a6e6cfd386acb7841a781b19b994295e251caa635b7c0753"
}
},
"response": {
"id": "118d5a69-a235-4306-887c-90a5fd178e79",
"fileName": "2053721176S00000-NavLog-1.json"
}
},
{
"digest": {
"sha256": {
"hex": "9ea30986db8d44400a3352767a8d4cf794ee68b96c793e0e12fba82363d2f5b1"
}
},
"response": {
"id": "300d291b-7355-44eb-a15a-5ba5637dac65",
"fileName": "2053721176S00000-NavLog-1.pdf"
}
}
],
"created_on": "2021-10-03T18:32:25.480Z",
"updated_on": "2021-10-03T18:35:10.632Z",
"not_before": "1970-01-01T00:00:00.000Z",
"parent_id": 166
},
{
"item_id": 166,
"status": "failed",
"payload": {
"project": "eq21203",
"sequence": 176
},
"results": [
{
"digest": {
"sha256": {
"hex": "2fbacfc0414a51d07629c35efa7d29c5012461d16ddcccb89804d1522c10b553"
}
},
"response": {
"error": {}
}
},
{
"digest": {
"sha256": {
"hex": "4910443e3be2c34990783bb7968746f62dd4ae1fea1c5499ce81f5ba2f262e68"
}
},
"response": {
"error": {
"code": "ECONNREFUSED",
"type": "system",
"errno": "ECONNREFUSED",
"message": "request to https://localhost:3077/vt/v1/api/upload-file-encoded failed, reason: connect ECONNREFUSED 127.0.0.1:3077"
}
}
}
],
"created_on": "2021-10-03T18:32:05.585Z",
"updated_on": "2021-10-03T18:32:25.392Z",
"not_before": "1970-01-01T00:00:00.000Z",
"parent_id": null
}
]
"401":
$ref: "#/components/responses/401"
post:
summary: Add one or more items to the queue.
tags: [ "asaqc" ]
requestBody:
required: true
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/QueueRequestASAQC"
responses:
"202":
description: |
All items were added to the queue for processing.
Note that this response does not imply that items have been sent or will be delivered, or that an entity matching the request even exists. It is merely a promise to attempt a transfer at some later time, if the item exists and the remote server is reachable.
"400":
description: |
The request was malformed or had invalid data.
If a request consisting of multiple items fails, none of the items get added to the queue.
"401":
$ref: "#/components/responses/401"
/queue/outgoing/asaqc/{id}:
delete:
summary: Cancel a queued transfer.
description: Use this request to cancel a queued transfer before it is sent. This endpoint does not return a body, success or failure is denoted by the HTTP response status code.
tags: [ "asaqc" ]
parameters:
-
name: id
in: path
schema:
type: integer
description: The ID of a queued request.
responses:
"204":
description: |
Request successfully cancelled. No data has been sent or will be sent.
* If the referenced request had status `queued`, its status was changed to `cancelled`.
* If the referenced request had status `failed` and there existed one or more requests with status `queued` and `parent_id` equal to this request's ID, their status was changed to `cancelled`.
"401":
$ref: "#/components/responses/401"
"404":
description: The request does not exist or it has already been fulfilled and cannot therefore be cancelled.
/login:
post: