Verified Commit 3bf16a48 authored by Jakob Moser's avatar Jakob Moser
Browse files

Prepare APIv2 endpoint

parent 9b0f787d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
RedirectMatch 302 ^/api/?$ /api/v1
 No newline at end of file
RedirectMatch 302 ^/api/?$ /api/v2
 No newline at end of file

api/v2/.htaccess

0 → 100644
+3 −0
Original line number Diff line number Diff line
RewriteEngine on
RewriteRule status$ /api/v2/status.php
RewriteRule services$ /api/v2/services.json

api/v2/index.html

0 → 100644
+22 −0
Original line number Diff line number Diff line
<!doctype html>
<html lang="en">
    <head>
        <title>Status API | Fachschaft Computerlinguistik</title>

        <link rel="shortcut icon" href="/lib/fscoli-next/img/favicon.png" />

        <meta charset="utf-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1" />

        <style>
            body {
                margin: 0;
            }
        </style>
    </head>

    <body>
        <redoc spec-url="./openapi-spec.yaml"></redoc>
        <script src="/lib/redoc/redoc.standalone.js"></script>
    </body>
</html>
+95 −0
Original line number Diff line number Diff line
---
openapi: 3.0.2
info:
    title: fscoli Status
    version: 2.0.0
    description: |
        Monitor the status of services of the Fachschaft Computerlinguistik, Universität Heidelberg
paths:
    /status:
        summary: Path used to manage the list of services' status.
        description: ""
        get:
            responses:
                "200":
                    content:
                        application/json:
                            schema:
                                type: array
                                items:
                                    $ref: "#/components/schemas/ServiceWithStatus"
                    description: Successful response, returns a list of all known services and their status.
            operationId: getStatus
            summary: List all status
            description: "Main endpoint of this API, returns a status report."
    /services:
        summary: Path used to manage the list of services.
        description: ""
        get:
            responses:
                "200":
                    content:
                        application/json:
                            schema:
                                type: array
                                items:
                                    $ref: "#/components/schemas/Service"
                    description: Successful response, returns a list of all known services (without status).
            operationId: getServices
            summary: List all services
            description: |-
                Secondary endpoint of this API, only lists all services (without status).
                
                Unlike `/status`, this does not send requests to the services in the backend, meaning it will respond
                as fast as this server here is capable of responding. Can be useful to build a UI which first lists all
                services with a loading spinner, and then later fills in the status as soon as it is there.
components:
    schemas:
        Service:
            title: Root Type for Service
            description:
                "A service. Has a name, a category and runs on a host."
            required:
                - name
                - host
                - category
            type: object
            properties:
                name:
                    description: Human-readable name of the service.
                    type: string
                    readOnly: true

                host:
                    description: |-
                        The host name of the service.

                        This is not the URL, i.e. is not prefixed with a protocol (e.g. `example.com` and not `https://example.com`)
                    type: string
                    readOnly: true
                category:
                    description: A category this service fits in. Can be used on the UI to display it in a different section.
                    type: string
                    readOnly: true
            example:
                name: Website
                host: fachschaft.cl.uni-heidelberg.de
                category: public
        ServiceWithStatus:
            title: Root Type for a Service with a status
            description: "A service with a status"
            allOf:
                - $ref: "#/components/schemas/Service"
                - type: object
                  required:
                    - status
                  properties:
                    status:
                        description: The curl response code when sending a HTTPS GET request to the service. Usually the HTTP status code (e.g. 200, 404), in case of network errors, it might be a different code.
                        type: integer
                        readOnly: true
            example:
                name: Website
                host: fachschaft.cl.uni-heidelberg.de
                category: public
                status: 200

api/v2/services.json

0 → 100644
+23 −0
Original line number Diff line number Diff line
[
    {"name": "Automation", "host": "automation.fachschaft.cl.uni-heidelberg.de", "category": "auth"},
    {"name": "Framadate", "host": "framadate.fachschaft.cl.uni-heidelberg.de", "category": "public"},
    {"name": "Inventar", "host": "inventar.fachschaft.cl.uni-heidelberg.de", "category": "public"},
    {"name": "Notenrechner", "host": "notenrechner.fachschaft.cl.uni-heidelberg.de", "category": "public"},
    {"name": "PDF-Tools", "host": "pdf.fachschaft.cl.uni-heidelberg.de", "category": "public"},
    {"name": "CDN", "host": "cdn.fachschaft.cl.uni-heidelberg.de", "category": "public"},
    {"name": "Newsletter", "host": "newsletter.fachschaft.cl.uni-heidelberg.de", "category": "public"},
    {"name": "Portal", "host": "portal.fachschaft.cl.uni-heidelberg.de", "category": "public"},
    {"name": "Protokolle", "host": "protokolle.fachschaft.cl.uni-heidelberg.de", "category": "public"},
    {"name": "Tacos", "host": "tacos.cl.uni-heidelberg.de", "category": "public"},
    {"name": "Tickets", "host": "tickets.fachschaft.cl.uni-heidelberg.de", "category": "public"},
    {"name": "Todo", "host": "todo.fachschaft.cl.uni-heidelberg.de", "category": "public"},
    {"name": "Traefik", "host": "traefik.fachschaft.cl.uni-heidelberg.de", "category": "auth"},
    {"name": "Website", "host": "fachschaft.cl.uni-heidelberg.de", "category": "public"},
    {"name": "Website (Mirror)", "host": "fsco.li", "category": "public"},
    {"name": "GitLab", "host": "gitlab.cl.uni-heidelberg.de", "category": "public@institute"},
    {"name": "Overleaf", "host": "overleaf.cl.uni-heidelberg.de", "category": "public@institute"},
    {"name": "Mail", "host": "mail.cl.uni-heidelberg.de", "category": "public@institute"},
    {"name": "Mailinglisten", "host": "lists.cl.uni-heidelberg.de", "category": "public@institute"},
    {"name": "heiCO", "host": "heico.uni-heidelberg.de", "category": "public@uni"},
    {"name": "SOGo", "host": "sogo.uni-heidelberg.de", "category": "public@uni"}
]