Skip to content

API Documentation

The API is served by the backend to the frontend: the following routes are currently implemented that allow you to retrieve metadata stored in the mongodb

  • POST /get-media-urls: gets presigned urls for the media to play from S3, needs S3 path of the media
  • POST /get-metadata: gets all metadata from the MongoDB
  • POST /search-solr: gets search results for a specific search from Solr

The specification below was autogenerated as http://localhost:8000/openapi.json in the setup with docker-compose

FastAPI 0.1.0

Endpoints


POST /get-media-urls

Get Media Urls

Description

Get signed media urls for a debate: these urls allow to directly access objects on S3

Request body

{
    "prefix": "string",
    "objectKeys": [
        "string"
    ],
    "mediaKey": "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
{
    "properties": {
        "prefix": {
            "type": "string",
            "title": "Prefix",
            "description": "S3 prefix",
            "examples": [
                "HRC_20220328T10000"
            ]
        },
        "objectKeys": {
            "items": {
                "type": "string"
            },
            "type": "array",
            "title": "Objectkeys",
            "description": "List of S3 object keys",
            "examples": [
                [
                    "HRC_20220328T10000-files.json"
                ]
            ]
        },
        "mediaKey": {
            "type": "string",
            "title": "Mediakey",
            "description": "Object key for main media file",
            "examples": [
                "HRC_20220328T10000.mp4"
            ]
        }
    },
    "type": "object",
    "required": [
        "prefix",
        "objectKeys",
        "mediaKey"
    ],
    "title": "S3MediaUrlRequest"
}

Response 200 OK

{
    "signedUrls": [
        {
            "url": "string",
            "label": "string"
        }
    ],
    "signedMediaUrl": "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
{
    "properties": {
        "signedUrls": {
            "items": {
                "$ref": "#/components/schemas/S3MediaUrls"
            },
            "type": "array",
            "title": "Signedurls",
            "description": "List of presigned URLs"
        },
        "signedMediaUrl": {
            "type": "string",
            "title": "Signedmediaurl",
            "description": "Presigned URL for the main media file"
        }
    },
    "type": "object",
    "required": [
        "signedUrls",
        "signedMediaUrl"
    ],
    "title": "S3MediaUrlResponse"
}

Response 422 Unprocessable Entity

{
    "detail": [
        {
            "loc": [
                null
            ],
            "msg": "string",
            "type": "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
{
    "properties": {
        "detail": {
            "items": {
                "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
        }
    },
    "type": "object",
    "title": "HTTPValidationError"
}

POST /mongo-metadata

Mongo Metadata

Request body

{
    "prefix": "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
{
    "properties": {
        "prefix": {
            "type": "string",
            "title": "Prefix",
            "description": "S3 prefix",
            "examples": [
                "HRC_20220328T0000"
            ]
        }
    },
    "type": "object",
    "required": [
        "prefix"
    ],
    "title": "MongoMetadataRequest"
}

Response 200 OK

{
    "debate": null,
    "speakers": null,
    "segments": null,
    "subtitles": null,
    "subtitles_en": null
}
⚠️ 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
{
    "properties": {
        "debate": {
            "anyOf": [
                {
                    "$ref": "#/components/schemas/DebateDocument"
                },
                {
                    "type": "null"
                }
            ]
        },
        "speakers": {
            "anyOf": [
                {
                    "$ref": "#/components/schemas/SpeakersDocument"
                },
                {
                    "type": "null"
                }
            ]
        },
        "segments": {
            "anyOf": [
                {
                    "$ref": "#/components/schemas/SegmentsDocument"
                },
                {
                    "type": "null"
                }
            ]
        },
        "subtitles": {
            "anyOf": [
                {
                    "$ref": "#/components/schemas/SubtitlesDocument"
                },
                {
                    "type": "null"
                }
            ]
        },
        "subtitles_en": {
            "anyOf": [
                {
                    "$ref": "#/components/schemas/SubtitlesDocument"
                },
                {
                    "type": "null"
                }
            ]
        }
    },
    "type": "object",
    "title": "MongoMetadataResponse"
}

Response 422 Unprocessable Entity

{
    "detail": [
        {
            "loc": [
                null
            ],
            "msg": "string",
            "type": "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
{
    "properties": {
        "detail": {
            "items": {
                "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
        }
    },
    "type": "object",
    "title": "HTTPValidationError"
}

POST /search-solr

Search Solr

Description

Fetch search results from Solr

Request body

{
    "queryTerm": "string",
    "sortBy": "string",
    "facetFields": [
        "string"
    ],
    "facetFilters": [
        {
            "facetField": "string",
            "facetValue": "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
{
    "properties": {
        "queryTerm": {
            "type": "string",
            "title": "Queryterm",
            "description": "Solr query term can be empty",
            "examples": [
                "honor"
            ]
        },
        "sortBy": {
            "type": "string",
            "title": "Sortby",
            "description": "Solr sort option",
            "examples": [
                "start asc"
            ]
        },
        "facetFields": {
            "items": {
                "type": "string"
            },
            "type": "array",
            "title": "Facetfields",
            "description": "Solr facet field to return",
            "examples": [
                [
                    "debate_schedule",
                    "statement_type"
                ]
            ]
        },
        "facetFilters": {
            "items": {
                "$ref": "#/components/schemas/FacetFilter"
            },
            "type": "array",
            "title": "Facetfilters",
            "description": "Solr facet filters with set values"
        }
    },
    "type": "object",
    "required": [
        "queryTerm",
        "sortBy",
        "facetFields",
        "facetFilters"
    ],
    "title": "SolrRequest"
}

Response 200 OK

Schema of the response body

Response 422 Unprocessable Entity

{
    "detail": [
        {
            "loc": [
                null
            ],
            "msg": "string",
            "type": "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
{
    "properties": {
        "detail": {
            "items": {
                "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
        }
    },
    "type": "object",
    "title": "HTTPValidationError"
}

Schemas

DebateDocument

Name Type
created_at string(date-time)
media Media
public boolean
s3_keys Array<S3Key>
s3_prefix string
schedule string(date-time)
session string
type string

FacetFilter

Name Type
facetField string
facetValue string

HTTPValidationError

Name Type
detail Array<ValidationError>

Media

Name Type
format string
key string
type string

MongoMetadataRequest

Name Type
prefix string

MongoMetadataResponse

Name Type
debate
segments
speakers
subtitles
subtitles_en

S3Key

Name Type
description string
name string
type string

S3MediaUrlRequest

Name Type
mediaKey string
objectKeys Array<string>
prefix string

S3MediaUrlResponse

Name Type
signedMediaUrl string
signedUrls Array<S3MediaUrls>

S3MediaUrls

Name Type
label string
url string

Segment

Name Type
end number
segment_nr integer
speaker_id string
start number

SegmentsDocument

Name Type
segments Array<Segment>

SolrRequest

Name Type
facetFields Array<string>
facetFilters Array<FacetFilter>
queryTerm string
sortBy string

Speaker

Name Type
name string
role_tag string
speaker_id string

SpeakersDocument

Name Type
speakers Array<Speaker>

Subtitle

Name Type
content string
end number
index integer
segment_nr integer
speaker_id string
start number

SubtitlesDocument

Name Type
subtitles Array<Subtitle>

ValidationError

Name Type
loc Array<>
msg string
type string