rysavy-ondrej / ethanol

An experimental environment for context-based flow artifact analysis.
1 stars 0 forks source link

API for consumer #22

Closed rysavy-ondrej closed 7 months ago

rysavy-ondrej commented 8 months ago

Define and implement an API for host-context consumer. Points:

Implementation hints:

rysavy-ondrej commented 8 months ago

Base URL: /api/v1/host-context

  1. Enumeration of Available Windows for Specified Period

    • Endpoint: /windows
    • Method: GET
    • Parameters:
      • start: Starting timestamp of the period.
      • end: Ending timestamp of the period.

    Sample Request:

    GET /api/v1/host-context/windows?start=2023-11-01T00:00:00Z&end=2023-11-02T00:00:00Z
  2. Enumeration of Host-contexts within Specific Interval

    • Endpoint: /contexts
    • Method: GET
    • Parameters:
      • windowId: Identifier for the specific window interval.
      • ip: (Optional) IP address to filter specific host-context.

    Sample Request:

    GET /api/v1/host-context/contexts?windowId=1234
  3. Information About the Last Available Window

    • Endpoint: /windows/last
    • Method: GET

    Sample Request:

    GET /api/v1/host-context/windows/last
  4. Enumeration of Aggregated Host-context for Specified Range of Windows

    • Endpoint: /contexts/aggregated
    • Method: GET
    • Parameters:
      • startWindowId: Identifier for the starting window.
      • endWindowId: Identifier for the ending window.

    Sample Request:

    GET /api/v1/host-context/contexts/aggregated?startWindowId=1234&endWindowId=5678

Response Format:

Responses should be in a structured JSON format for easy parsing and standardization. Here's a sample format for the window enumeration:

{
    "status": "success",
    "data": [
        {
            "windowId": "1234",
            "start": "2023-11-01T00:00:00Z",
            "end": "2023-11-01T01:00:00Z"
        },
        {
            "windowId": "1235",
            "start": "2023-11-01T01:00:00Z",
            "end": "2023-11-01T02:00:00Z"
        }
        // ... more windows
    ]
}
rysavy-ondrej commented 8 months ago

Technology: SERVER side: https://fast-endpoints.com/ CLIENT side: https://restsharp.dev/

rysavy-ondrej commented 8 months ago

Alternatively, use GraphQL:

https://graphql.org/code/

rysavy-ondrej commented 7 months ago

Implemented as specified.