Charles University languages API

Operations with source and target languages

OpenAPI Specification

charles-languages-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: LINDAT Translation languages API
  version: '2.0'
  description: Public REST API for neural machine translation operated by the Institute of Formal and Applied Linguistics (UFAL) at Charles University as part of the LINDAT/CLARIAH-CZ research infrastructure. Converted faithfully from the upstream Swagger 2.0 specification at https://lindat.mff.cuni.cz/services/translation/api/v2/swagger.json
servers:
- url: https://lindat.mff.cuni.cz/services/translation/api/v2
tags:
- name: languages
  description: Operations with source and target languages
paths:
  /languages/:
    get:
      operationId: get_language_collection
      summary: Returns a list of available languages
      tags:
      - languages
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LanguagesResource'
    post:
      operationId: post_language_collection
      summary: Translate input from src lang to tgt lang
      description: It expects the text in variable called `input_text` and handles both "application/x-www-form-urlencoded" and "multipart/form-data" (for uploading text/plain files)
      tags:
      - languages
      parameters:
      - name: src
        in: query
        description: src query param description
        schema:
          type: string
        example: en
      - name: tgt
        in: query
        description: tgt query param description
        schema:
          type: string
        example: cs
      requestBody:
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                input_text:
                  type: string
                  description: text to translate
                  example: this is a sample text
          multipart/form-data:
            schema:
              type: object
              properties:
                input_text:
                  type: string
                  description: text to translate
                  example: this is a sample text
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: string
            text/plain:
              schema:
                type: string
        '415':
          description: You sent a file but it was not text/plain
  /languages/{language}:
    get:
      operationId: get_language_item
      summary: Returns a language resource object
      tags:
      - languages
      parameters:
      - name: language
        in: path
        required: true
        description: Language code
        schema:
          type: string
        example: en
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LanguageResource'
components:
  schemas:
    EmbeddedLanguages:
      type: object
      properties:
        item:
          type: array
          items:
            $ref: '#/components/schemas/LanguageResource'
    LanguageLinks:
      type: object
      properties:
        item:
          type: array
          items:
            $ref: '#/components/schemas/Link'
        self:
          $ref: '#/components/schemas/Link'
        translate:
          $ref: '#/components/schemas/Link'
    LanguageResourceLinks:
      type: object
      properties:
        translate:
          $ref: '#/components/schemas/Link'
        sources:
          type: array
          items:
            $ref: '#/components/schemas/Link'
        targets:
          type: array
          items:
            $ref: '#/components/schemas/Link'
        self:
          $ref: '#/components/schemas/Link'
    LanguageResource:
      type: object
      properties:
        _links:
          $ref: '#/components/schemas/LanguageResourceLinks'
        name:
          type: string
          example: cs
        title:
          type: string
          example: Czech
    Link:
      type: object
      properties:
        href:
          type: string
        name:
          type: string
        title:
          type: string
        type:
          type: string
        deprecation:
          type: string
        profile:
          type: string
        templated:
          type: boolean
        hreflang:
          type: string
    LanguagesResource:
      type: object
      properties:
        _links:
          $ref: '#/components/schemas/LanguageLinks'
        _embedded:
          $ref: '#/components/schemas/EmbeddedLanguages'