openapi: 3.0.0
servers:
  - url: 'https://b2c.cpost.cz/services/Address/'
info:
  version: 1.0.0
  title: B2C Address API
  description: Služba poskytuje identifikátor adresy postupným výběrem kraje, okresu, obce, části obce, ulice, čísla. Identifikátor adresy slouží jako vstupní parametr pro poskytnutí informace o odpoledním doručování.
paths:
  /getRegionListAsXml:
    get:
      summary: Vrátí seznam krajů ve formátu XML.
      responses:
        '200':
          description: Seznam krajů
          content:
            application/xml:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Item'
        default:
          description: Unexpected error
          content:
            application/xml:
              schema:
                $ref: '#/components/schemas/Error'
  /getRegionListAsJson:
    get:
      summary: Vrátí seznam krajů ve formátu JSON.
      responses:
        '200':
          description: Seznam krajů
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Item'
        default:
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /getDistrictListAsXml:
    get:
      summary: Vrátí seznam okresů v regionu ve formátu XML.
      parameters:
        - in: query
          name: id
          required: true
          schema:
            type: string
          example: '1'
      responses:
        '200':
          description: Return configuration items.
          content:
            application/xml:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Item'
        '400':
          description: Bad request.
        default:
          description: Unexpected error
          content:
            application/xml:
              schema:
                $ref: '#/components/schemas/Error'
  /getDistrictListAsJson:
    get:
      summary: Vrátí seznam okresů v regionu ve formátu JSON.
      parameters:
        - in: query
          name: id
          required: true
          schema:
            type: string
          example: '1'
      responses:
        '200':
          description: Return configuration items.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Item'
        '400':
          description: Bad request.
        default:
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /getCityListAsXml:
    get:
      summary: Vrátí seznam obcí ve formátu XML.
      parameters:
        - in: query
          name: id
          required: true
          schema:
            type: string
          example: '1'
      responses:
        '200':
          description: Return configuration items.
          content:
            application/xml:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Item'
        '400':
          description: Bad request.
        default:
          description: Unexpected error
          content:
            application/xml:
              schema:
                $ref: '#/components/schemas/Error'
  /getCityListAsJson:
    get:
      summary: Vrátí seznam obcí ve formátu JSON.
      parameters:
        - in: query
          name: id
          required: true
          schema:
            type: string
          example: '1'
      responses:
        '200':
          description: Return configuration items.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Item'
        '400':
          description: Bad request.
        default:
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /getCityPartListAsXml:
    get:
      summary: Vrátí seznam částí obce ve formátu XML.
      parameters:
        - in: query
          name: id
          required: true
          schema:
            type: string
          example: '1'
      responses:
        '200':
          description: Return configuration items.
          content:
            application/xml:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Item'
        '400':
          description: Bad request.
        default:
          description: Unexpected error
          content:
            application/xml:
              schema:
                $ref: '#/components/schemas/Error'
  /getCityPartListAsJson:
    get:
      summary: Vrátí seznam částí obce ve formátu JSON.
      parameters:
        - in: query
          name: id
          required: true
          schema:
            type: string
          example: '1'
      responses:
        '200':
          description: Return configuration items.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Item'
        '400':
          description: Bad request.
        default:
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /getStreetListAsXml:
    get:
      summary: Vrátí seznam ulic městské části ve formátu XML.
      parameters:
        - in: query
          name: id
          required: true
          schema:
            type: string
          example: '1'
      responses:
        '200':
          description: Return configuration items.
          content:
            application/xml:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Item'
        '400':
          description: Bad request.
        default:
          description: Unexpected error
          content:
            application/xml:
              schema:
                $ref: '#/components/schemas/Error'
  /getStreetListAsJson:
    get:
      summary: Vrátí seznam ulic městské části  ve formátu JSON.
      parameters:
        - in: query
          name: id
          required: true
          schema:
            type: string
          example: '1'
      responses:
        '200':
          description: Return configuration items.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Item'
        '400':
          description: Bad request.
        default:
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /getNumberListAsXml:
    get:
      summary: Vrátí seznam čísel v ulici ve formátu XML.
      parameters:
        - in: query
          name: idStreet
          required: true
          schema:
            type: string
          example: '2'
        - in: query
          name: idCityPart
          required: true
          schema:
            type: string
          example: '1'
      responses:
        '200':
          description: Return configuration items.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Item'
        '400':
          description: Bad request.
        default:
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /getNumberListAsJson:
    get:
      summary: Vrátí seznam čísel v ulici ve formátu JSON.
      parameters:
        - in: query
          name: idStreet
          required: true
          schema:
            type: string
          example: '2'
        - in: query
          name: idCityPart
          required: true
          schema:
            type: string
          example: '1'
      responses:
        '200':
          description: Return configuration items.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Item'
        '400':
          description: Bad request.
        default:
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    Item:
      type: object
      properties:
        id:
          type: string
          example: 1
        name:
          type: string
          example: Hlavní město Praha
    Error:
      type: object
      properties:
        code:
          type: integer
          description: error code
          example: 400
        message:
          type: string
          description: error message
          example: Bad input param.
      required:
        - message
        - code
