Skip to content

Instantly share code, notes, and snippets.

@bernatfortet
Last active February 7, 2025 23:42
Show Gist options
  • Save bernatfortet/7bb2180b71a2a2a32f2eab949b5bfe7c to your computer and use it in GitHub Desktop.
Save bernatfortet/7bb2180b71a2a2a32f2eab949b5bfe7c to your computer and use it in GitHub Desktop.

Capture API

Authentication

All requests must include an API token in the Authorization header:

Authorization: Bearer kasd983jajh

Endpoint

POST /api/capture

Request Body

The request body should be a JSON object containing at least:

{
  "tenantId": string,  // Required. The ID of the tenant sending the data
  "mode": "replace" | "append",  // Optional. Defaults to "replace". Controls whether existing data should be replaced or appended to
  // ... Additional data specific to your capture needs
}

Example for Vera's tenant

For Vera's tenant (kdkko9tmlsd5b1z), the payload should follow this structure:

{
  "tenantId": "kdkko9tmlsd5b1z",
  "mode": "replace",  // Optional. Use "append" to add to existing data
  "projectId": string,
  "workflowId": string,
  "operatorName": string,
  "startTime": string,    // ISO date string
  "endTime": string,      // ISO date string
  "collectedData": [
    {
      "id": string,
      "data": [
        {
          "taskName": string,
          "value": any     // The value depends on the taskName
        }
      ],
      "entryTime": string  // ISO date string
    }
  ]
}

Responses

Success (200)

{
  "success": true,
  "data": { ... } // Echo of the sent data
}

Errors

  • 401 - Authentication errors
    { "error": "Missing or invalid authorization header" }
    { "error": "Invalid API token" }
    { "error": "Invalid API token for this tenant" }
  • 400 - Invalid payload
    { "error": "Invalid request payload" }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment