openapi: 3.0.3
info:
  title: RustOpus XML API
  version: 1.0.0
  description: Get Octopus 8 ERP SOAP XML with english tags instead of hungarians

paths:
  /get-product:
    get:
      summary: Get product data
      description: Returns basic data for the products.
      tags:
        - Products
      parameters:
        - name: url
          in: query
          required: true
          description: Endpoint URL with the ```.asmx``` file
          schema:
            type: string
        - name: authcode
          in: query
          required: true
          description: Authorization code
          schema:
            type: string
        - name: xmlns
          in: query
          required: false
          description: Optional XML namespace
          schema:
            type: string
        - name: language
          in: query
          required: false
          description: Optional language (only supports `HU`)
          schema:
            type: string
      responses:
        '200':
          description: XML product list
          content:
            application/xml:
              schema:
                $ref: '#/components/schemas/ProductResponse'

  /get-stock:
    get:
      summary: Get stock data
      description: Returns stock for the products.
      tags:
        - Stocks
      parameters:
        - name: url
          in: query
          required: true
          description: Endpoint URL with the ```.asmx``` file
          schema:
            type: string
        - name: authcode
          in: query
          required: true
          description: Authorization code
          schema:
            type: string
        - name: xmlns
          in: query
          required: false
          description: Optional XML namespace
          schema:
            type: string
        - name: language
          in: query
          required: false
          description: Optional language (only supports `HU`)
          schema:
            type: string
      responses:
        '200':
          description: XML stock list
          content:
            application/xml:
              schema:
                $ref: '#/components/schemas/StockResponse'

  /get-price:
    get:
      summary: Get price data
      description: Returns price for the products
      tags:
        - Prices
      parameters:
        - name: url
          in: query
          required: true
          description: Endpoint URL with the ```.asmx``` file
          schema:
            type: string
        - name: authcode
          in: query
          required: true
          description: Authorization code
          schema:
            type: string
        - name: xmlns
          in: query
          required: false
          description: Optional XML namespace
          schema:
            type: string
        - name: pid
          in: query
          required: true
          description: Partner ID
          schema:
            type: integer
        - name: language
          in: query
          required: false
          description: Optional language (only supports `HU`)
          schema:
            type: string
      responses:
        '200':
          description: XML price list
          content:
            application/xml:
              schema:
                $ref: '#/components/schemas/PriceResponse'
  
  /get-image:
    get:
      summary: Get image data
      description: Returns images for the products
      tags:
        - Images
      parameters:
        - name: url
          in: query
          required: true
          description: Endpoint URL with the ```.asmx``` file
          schema:
            type: string
        - name: authcode
          in: query
          required: true
          description: Authorization code
          schema:
            type: string
        - name: xmlns
          in: query
          required: false
          description: Optional XML namespace
          schema:
            type: string
        - name: language
          in: query
          required: false
          description: Optional language (only supports `HU`)
          schema:
            type: string
      responses:
        '200':
          description: XML image list
          content:
            application/xml:
              schema:
                $ref: '#/components/schemas/ImageResponse'
          
  /get-barcode:
    get:
      summary: Get barcodes data
      description: Returns barcodes/eans for the products
      tags:
        - Barcodes
      parameters:
        - name: url
          in: query
          required: true
          description: Endpoint URL with the ```.asmx``` file
          schema:
            type: string
        - name: authcode
          in: query
          required: true
          description: Authorization code
          schema:
            type: string
        - name: xmlns
          in: query
          required: false
          description: Optional XML namespace
          schema:
            type: string
        - name: language
          in: query
          required: false
          description: Optional language (only supports `HU`)
          schema:
            type: string
      responses:
        '200':
          description: XML barcode list
          content:
            application/xml:
              schema:
                $ref: '#/components/schemas/BarcodeResponse'        
  
  /get-invoice:
    get:
      summary: Get invoice data
      description: Returns invoice data.
      tags:
        - Invoices
      parameters:
        - name: url
          in: query
          required: true
          description: Endpoint URL with the ```.asmx``` file
          schema:
            type: string
        - name: authcode
          in: query
          required: true
          description: Authorization code
          schema:
            type: string
        - name: xmlns
          in: query
          required: false
          description: Optional XML namespace
          schema:
            type: string
        - name: pid
          in: query
          required: true
          description: Partner ID
          schema:
            type: integer
        - name: type_mod
          in: query
          required: false
          description: Invoice type
          schema:
            type: integer
        - name: from_date
          in: query
          required: true
          description: First date in YYYY-MM-DDThh:mm:ssZ format (2025-01-01T00:00:00Z)
          schema:
            type: string
        - name: to_date
          in: query
          required: true
          description: Last date in YYYY-MM-DDThh:mm:ssZ format (2025-01-01T00:00:00Z)
          schema:
            type: string
        - name: unpaid
          in: query
          required: false
          description: 1 if only the unpaid invoices should be inclouded
          schema:
            type: integer
        - name: language
          in: query
          required: false
          description: Optional language (only supports `HU`)
          schema:
            type: string
      responses:
        '200':
          description: XML invoice list
          content:
            application/xml:
              schema:
                $ref: '#/components/schemas/InvoiceResponse'        

  /get-bulk:
    get:
      summary: Get bulk data (XML)
      description: Returns concatenated data for the products. This containts every main information, but takes a long time to get.
      tags:
        - Bulk
      parameters:
        - name: url
          in: query
          required: true
          description: Endpoint URL with the ```.asmx``` file
          schema:
            type: string
        - name: authcode
          in: query
          required: true
          description: Authorization code
          schema:
            type: string
        - name: xmlns
          in: query
          required: false
          description: Optional XML namespace
          schema:
            type: string
        - name: pid
          in: query
          required: true
          description: Partner ID
          schema:
            type: integer
      responses:
        '200':
          description: XML bulk list
          content:
            application/xml:
              schema:
                $ref: '#/components/schemas/BulkResponse'

  /get-mat:
    get:
      summary: Get mathematican models data
      description: Returns the mathematican models (product attributes/concepts). Supports XML or CSV output.
      tags:
        - Mat
      parameters:
        - name: url
          in: query
          required: true
          description: Endpoint URL with the ```.asmx``` file
          schema:
            type: string
        - name: authcode
          in: query
          required: true
          description: Authorization code
          schema:
            type: string
        - name: xmlns
          in: query
          required: false
          description: Optional XML namespace
          schema:
            type: string
        - name: from_date
          in: query
          required: false
          description: Optional filter date in YYYY-MM-DDThh:mm:ssZ format (2025-01-01T00:00:00Z)
          schema:
            type: string
        - name: data_type
          in: query
          required: false
          description: Optional output format; set to `csv` for semicolon-delimited CSV
          schema:
            type: string
        - name: language
          in: query
          required: false
          description: Optional language (only supports `HU`)
          schema:
            type: string
      responses:
        '200':
          description: XML (or CSV) mathematican models list
          content:
            application/xml:
              schema:
                $ref: '#/components/schemas/MatResponse'
            text/csv:
              schema:
                type: string

  /post-order:
    post:
      summary: Submit an order to Octopus 8 ERP
      description: Submit an order in English XML format. Converts to Hungarian, sends to Octopus, and returns the response in English XML format.
      tags:
        - Orders
      parameters:
        - name: url
          in: query
          required: true
          description: Endpoint URL with the ```.asmx``` file
          schema:
            type: string
        - name: authcode
          in: query
          required: true
          description: Authorization code
          schema:
            type: string
        - name: xmlns
          in: query
          required: false
          description: Optional XML namespace
          schema:
            type: string
        - name: pid
          in: query
          required: true
          description: Partner ID
          schema:
            type: integer
      requestBody:
        required: true
        content:
          application/xml:
            schema:
              $ref: '#/components/schemas/OrderRequest'
      responses:
        '200':
          description: Order submission response with confirmation details
          content:
            application/xml:
              schema:
                $ref: '#/components/schemas/OrderResponse'
        '400':
          description: Invalid XML format
        '500':
          description: Failed to parse Octopus response
    
components:
  schemas:
    ProductResponse:
      type: object
      xml:
        name: Envelope
      properties:
        body:
          type: object
          properties:
            response:
              type: object
              properties:
                result:
                  type: object
                  properties:
                    answer:
                      properties:
                        version:
                          type: string
                        error:
                          type: object
                          properties:
                            code:
                              type: number
                            description:
                              type: string
                        products:
                          type: array
                          items:
                            $ref: '#/components/schemas/ProductProducts'
  
    ProductProducts:
      type: object
      properties:
        product:
          type: object
          properties:
            id:
              type: number
            no:
              type: string
            name:
              type: string
            unit:
              type: string
            base_unit:
              type: string
            base_unit_qty:
              type: number
            brand:
              type: string
            category_code:
              type: string
            category_name:
              type: string
            description:
              type: string
            weight:
              type: number
            size:
              type: object
              properties:
                x:
                  type: number
                y:
                  type: number
                z:
                  type: number
            oem_code:
              type: string
            main_category_code:
              type: string
            main_category_name:
              type: string
            sell_unit:
              type: number
            origin_country:
              type: string
    
    StockResponse:
      type: object
      xml:
        name: Envelope
      properties:
        body:
          type: object
          properties:
            response:
              type: object
              properties:
                result:
                  type: object
                  properties:
                    answer:
                      type: object
                      properties:
                        version:
                          type: string
                        error:
                          type: object
                          properties:
                            code:
                              type: number
                            description:
                              type: string
                        products:
                          type: array
                          items:
                            $ref: '#/components/schemas/StockProducts'
          
    StockProducts:
      type: object
      xml:
        name: products
      properties:
        product:
          type: object
          properties:
            id:
              type: number
            no:
              type: string
            stock:
              type: number
    
    PriceResponse:
      type: object
      xml:
        name: Envelope
      properties:
        body:
          type: object
          properties:
            response:
              type: object
              properties:
                result:
                  type: object
                  properties:
                    answer:
                      type: object
                      properties:
                        version:
                          type: string
                        error:
                          type: object
                          properties:
                            code:
                              type: number
                            description:
                              type: string
                        products:
                          type: array
                          items:
                            $ref: '#/components/schemas/PriceProducts'

    PriceProducts:
      type: object
      xml:
        name: products
      properties:
        product:
          type: object
          properties:
            id:
              type: number
            no:
              type: string
            list_price:
              type: number
            price:
              type: number
            sale_price:
              type: number
            currency:
              type: string
              
    ImageResponse:
      type: object
      xml:
        name: Envelope
      properties:
        body:
          type: object
          properties:
            response:
              type: object
              properties:
                result:
                  type: object
                  properties:
                    answer:
                      type: object
                      properties:
                        version:
                          type: string
                        error:
                          type: object
                          properties:
                            code:
                              type: number
                            description:
                              type: string
                        products:
                          type: array
                          items:
                            $ref: '#/components/schemas/ImageProducts'
              
    ImageProducts:
      type: object
      xml:
        name: products
      properties: 
        product:
          type: object
          properties:
            id:
              type: number
            no:
              type: string
            images:
              type: array
              items:
                $ref: '#/components/schemas/ImageImages'
                
    ImageImages:
      type: object
      xml:
        name: images
      properties:
        image:
          type: object
          properties:
            gallery:
              type: string
            url:
              type: string
              
    BulkResponse:
      type: object
      xml:
        name: Envelope
      properties:
        body:
          type: object
          properties:
            response:
              type: object
              properties:
                result:
                  type: object
                  properties:
                    answer:
                      type: object
                      properties:
                        version:
                          type: string
                        error:
                          type: object
                          properties:
                            code:
                              type: number
                            description:
                              type: string
                        products:
                          type: array
                          items:
                            $ref: '#/components/schemas/BulkProducts'
      
    BulkProducts:
      type: object
      xml:
        name: products
      properties:
        product:
          type: object
          properties:
            id:
              type: number
            no:
              type: string
            name:
              type: string
            unit:
              type: string
            base_unit:
              type: string
            base_unit_qty:
              type: string
            brand:
              type: string
            oem_code:
              type: string
            category_code:
              type: string
            category_name:
              type: string
            description:
              type: string
            weight:
              type: number
            size:
              type: object
              properties:
                x:
                  type: number
                y:
                  type: number
                z:
                  type: number
            main_category_code:
              type: string
            main_category_name:
              type: string
            sell_unit:
              type: number
            origin_country:
              type: string
            price:
              type: number
            currency:
              type: string
            stock:
              type: number
            ean:
              type: string
            images:
              type: array
              items:
                $ref: '#/components/schemas/BulkImages'
                
    BulkImages:
      type: object
      xml:
        name: images
      properties:
        url:
          type: string
    
    MatResponse:
      type: object
      xml:
        name: Envelope
      properties:
        body:
          type: object
          properties:
            response:
              type: object
              properties:
                result:
                  type: object
                  properties:
                    answer:
                      type: object
                      properties:
                        version:
                          type: string
                        error:
                          type: object
                          properties:
                            code:
                              type: number
                            description:
                              type: string
                        attributes:
                          type: array
                          items:
                            $ref: '#/components/schemas/MatAttributes'

    MatAttributes:
      type: object
      xml:
        name: attributes
      properties:
        attribute:
          type: object
          properties:
            id:
              type: number
            code:
              type: string
            name:
              type: string
            product_id:
              type: number
            product_no:
              type: string
            string_value:
              type: string
            num_value:
              type: number
            order:
              type: number
            delstatus:
              type: number
            filter:
              type: number
            data_type:
              type: number
            value_set:
              type: number

    BarcodeResponse:
      type: object
      xml:
        name: Envelope
      properties:
        body:
          type: object
          properties:
            response:
              type: object
              properties:
                result:
                  type: object
                  properties:
                    answer:
                      type: object
                      properties:
                        version:
                          type: string
                        error:
                          type: object
                          properties:
                            code:
                              type: number
                            description:
                              type: string
                        barcodes:
                          type: array
                          items:
                            $ref: '#/components/schemas/Barcodes'

    Barcodes:
      type: object
      xml:
        name: barcodes
      properties:
        barcode:
          type: object
          properties:
            ean:
              type: string
            id:
              type: number
            no:
              type: string
            unit:
              type: string
            main_ean:
              type: boolean

    InvoiceResponse:
      type: object
      xml:
        name: Envelope
      properties:
        body:
          type: object
          properties:
            response:
              type: object
              properties:
                result:
                  type: object
                  properties:
                    answer:
                      type: object
                      properties:
                        version:
                          type: string
                        error:
                          type: object
                          properties:
                            code:
                              type: number
                            description:
                              type: string
                        invoices:
                          type: array
                          items:
                            $ref: '#/components/schemas/Invoices'

    Invoices:
      type: object
      xml:
        name: invoices
      properties:
        invoice:
          type: object
          properties:
            head:
              type: object
              properties:
                id:
                  type: integer
                no:
                  type: string
                date:
                  type: string
                completition_date:
                  type: string
                payment_deadline:
                  type: string
                net_price:
                  type: string
                price:
                  type: number
                remaining:
                  type: number
                cancellation_no:
                  type: string
                currency:
                  type: string
                pid:
                  type: integer
                partner_name:
                  type: string
                status:
                  type: integer
                foreign_order_no:
                  type: string
                delivery_name:
                  type: string
                delivery_country:
                  type: string
                delivery_zip:
                  type: string
                delivery_city:
                  type: string
                delivery_street:
                  type: string
            products:
              type: array
              items:
                $ref: '#/components/schemas/InvoiceProducts'
                
    InvoiceProducts:
      type: object
      xml:
        name: products
      properties:
        product:
          type: object
          properties:
            lot_no:
              type: integer
            id:
              type: integer
            no:
              type:
                string
            name:
              type:
                string
            qty:
              type: number
            unit:
              type: string
            net_unit_price:
              type: number
            unit_price:
              type: number
            net_price:
              type: number
            price:
              type: number
            order_no:
              type: string
            order_foreign_no:
              type: string

    OrderRequest:
      type: object
      xml:
        name: order
      properties:
        version:
          type: string
          example: "1.0"
        header:
          type: object
          properties:
            pid:
              type: integer
              example: 7824
            foreign_order_number:
              type: string
              example: "rustopus_test_1"
            delivery_mode:
              type: integer
              example: 1
        items:
          type: array
          xml:
            name: items
          items:
            type: object
            xml:
              name: item
            properties:
              lot_no:
                type: integer
                example: 1
              no:
                type: string
                description: Product/article number
                example: "PAPIRA4CAN"
              qty:
                type: number
                example: 1.0

    OrderResponse:
      type: object
      xml:
        name: Envelope
      properties:
        body:
          type: object
          properties:
            response:
              type: object
              properties:
                result:
                  type: object
                  properties:
                    answer:
                      type: object
                      properties:
                        version:
                          type: string
                          example: "1.0"
                        header:
                          type: object
                          xml:
                            name: header
                          properties:
                            identifier:
                              type: integer
                              example: 1773747
                            web_identifier:
                              type: string
                              format: uuid
                              example: "f6f9f502-1446-4183-aaeb-9df2245457fe"
                            document_number:
                              type: string
                              example: "XKBRE2608459"
                            delivery_date:
                              type: string
                              format: date
                              example: "2026.03.31"
                        items:
                          type: array
                          xml:
                            name: items
                          items:
                            type: object
                            xml:
                              name: item
                            properties:
                              item_number:
                                type: integer
                                example: 1
                              recorded_item_number:
                                type: integer
                                example: 1
                              product_number:
                                type: string
                                example: "PAPIRA4CAN"
                              quantity:
                                type: object
                                properties:
                                  type:
                                    type: string
                                    example: "1"
                                  coverage:
                                    type: string
                                    example: "1-50"
                                  date:
                                    type: string
                                    format: date-time
                                    example: "2026-03-31T00:00:00"
                                  value:
                                    type: number
                                    example: 1.0
                              unit_price_net:
                                type: number
                                example: 1193.5007520
                              unit_price_gross:
                                type: number
                                example: 1515.74595504
                              value_net:
                                type: number
                                example: 1193.500752
                              value_gross:
                                type: number
                                example: 1515.745955
                              currency:
                                type: string
                                example: "HUF"
                        extra_items:
                          type: string
                          nullable: true
                        shipping_cost:
                          type: string
                          nullable: true
                        cash_on_delivery:
                          type: string
                          nullable: true
                        extra_services:
                          type: string
                          nullable: true
                        return_fee:
                          type: string
                          nullable: true
