Oracle APEX Handlers API

REST template handler management. A handler implements an HTTP method on a template with source code.

OpenAPI Specification

oracle-apex-handlers-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Oracle REST Data Services (ORDS) REST AutoREST Handlers API
  description: REST API for managing Oracle REST Data Services (ORDS) RESTful service definitions including modules, templates, handlers, privileges, roles, OAuth clients, and AutoREST-enabled objects. ORDS provides a mid-tier Java application that maps HTTP requests to database transactions, enabling RESTful access to Oracle Database resources. This specification covers the ORDS REST Services Management endpoints available through the Database API stable interface.
  version: '25.4'
  contact:
    name: Oracle APEX Support
    url: https://apex.oracle.com/community
    email: apex-info_us@oracle.com
  license:
    name: Oracle Technology Network License
    url: https://www.oracle.com/downloads/licenses/distribution-license.html
servers:
- url: https://{host}:{port}/ords/_/db-api/stable
  description: ORDS Database API stable endpoint
  variables:
    host:
      default: localhost
      description: Hostname of the ORDS instance
    port:
      default: '8443'
      description: Port number for the ORDS instance
- url: https://{host}/ords/_/db-api/stable
  description: ORDS Database API stable endpoint (default port)
  variables:
    host:
      default: example.com
      description: Hostname of the ORDS instance
security:
- basicAuth: []
- oauth2: []
tags:
- name: Handlers
  description: REST template handler management. A handler implements an HTTP method on a template with source code.
paths:
  /ords/rest/handlers/:
    get:
      operationId: listHandlers
      summary: Get all REST template handlers
      description: Retrieves a paginated list of all REST template handlers defined in the current schema.
      tags:
      - Handlers
      parameters:
      - $ref: '#/components/parameters/offset'
      - $ref: '#/components/parameters/limit'
      responses:
        '200':
          description: Paginated list of REST handlers
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ItemsCollection'
    post:
      operationId: createHandler
      summary: Create a REST template handler
      description: Creates a new REST template handler that implements a specific HTTP method on a template. The handler contains the source code (SQL query or PL/SQL block) that will be executed when the template URI is accessed with the specified HTTP method.
      tags:
      - Handlers
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/HandlerCreate'
      responses:
        '201':
          description: REST handler created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ResourceItem'
        '400':
          description: Missing required parameters
        '404':
          description: Template does not exist
        '409':
          description: A handler for that method already exists on the template
  /ords/rest/handlers/{id}:
    get:
      operationId: getHandler
      summary: Get a REST template handler
      description: Retrieves details of a specific REST template handler by its identifier.
      tags:
      - Handlers
      parameters:
      - $ref: '#/components/parameters/resourceId'
      responses:
        '200':
          description: REST handler details
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ResourceItem'
        '404':
          description: Handler not found
    put:
      operationId: updateHandler
      summary: Update a REST template handler
      description: Updates an existing REST template handler including its source code, source type, and pagination settings.
      tags:
      - Handlers
      parameters:
      - $ref: '#/components/parameters/resourceId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/HandlerCreate'
      responses:
        '200':
          description: REST handler updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ResourceItem'
        '404':
          description: Handler not found
    delete:
      operationId: deleteHandler
      summary: Delete a REST template handler
      description: Deletes a specific REST template handler.
      tags:
      - Handlers
      parameters:
      - $ref: '#/components/parameters/resourceId'
      responses:
        '200':
          description: REST handler deleted successfully
        '404':
          description: Handler not found
  /ords/rest/handlers/{id}/source:
    get:
      operationId: getHandlerSource
      summary: Get a REST handler source
      description: Retrieves the source code implementation of a specific REST template handler.
      tags:
      - Handlers
      parameters:
      - $ref: '#/components/parameters/resourceId'
      responses:
        '200':
          description: REST handler source code
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ResourceItem'
        '404':
          description: Handler not found
components:
  schemas:
    ItemsCollection:
      type: object
      description: Paginated collection of resource items following the ORDS standard collection format
      properties:
        count:
          type: integer
          description: Total number of records in the current response page
        hasMore:
          type: boolean
          description: Indicates whether additional pages of results are available
        limit:
          type: integer
          description: The page size limit applied by the server
        offset:
          type: integer
          description: The starting index of items in this page
        items:
          type: array
          description: Array of resource items in this page
          items:
            $ref: '#/components/schemas/ResourceItem'
        links:
          type: array
          description: Pagination navigation links (first, next, prev, last)
          items:
            $ref: '#/components/schemas/LinkRelation'
    LinkRelation:
      type: object
      description: HATEOAS link relation describing a related resource or action
      required:
      - rel
      - href
      properties:
        rel:
          type: string
          description: Link relationship type (e.g., self, describedby, edit, collection)
        href:
          type: string
          description: URI of the related resource
    ResourceItem:
      type: object
      description: A single resource item with HATEOAS navigation links. Additional properties are included depending on the resource type.
      additionalProperties: true
      properties:
        links:
          type: array
          description: HATEOAS links for the resource
          items:
            $ref: '#/components/schemas/LinkRelation'
    HandlerCreate:
      type: object
      description: Request body for creating or updating a REST template handler
      required:
      - template_id
      - source
      properties:
        template_id:
          type: integer
          description: ID of the parent REST template
        source:
          type: string
          description: The source code implementation (SQL query or PL/SQL block) executed when this handler processes a request
        source_type:
          type: string
          description: The type of source code that determines how the source is executed
          enum:
          - source_type_collection_feed
          - source_type_collection_item
          - source_type_media
          - source_type_plsql
          - source_type_query
          - source_type_csv_query
          - source_type_query_one_row
          - source_type_feed
        method:
          type: string
          description: HTTP method this handler responds to
          enum:
          - GET
          - POST
          - PUT
          - DELETE
        items_per_page:
          type:
          - integer
          - 'null'
          description: Pagination size for GET handlers. NULL defers to the module-level setting.
          minimum: 1
        mimes_allowed:
          type: string
          description: Comma-separated list of MIME types accepted by PUT and POST handlers
        comments:
          type: string
          description: Descriptive comment for the handler
        run_mode:
          type: string
          description: Set to 'codePreview' to return the PL/SQL code instead of executing it
          enum:
          - codePreview
  parameters:
    offset:
      name: offset
      in: query
      required: false
      description: The index of the first item to return (0-based). Default is 0.
      schema:
        type: integer
        default: 0
        minimum: 0
    resourceId:
      name: id
      in: path
      required: true
      description: Unique identifier of the resource
      schema:
        type: integer
    limit:
      name: limit
      in: query
      required: false
      description: Maximum number of items to return per page. Default is 25.
      schema:
        type: integer
        default: 25
        minimum: 1
        maximum: 500
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
      description: HTTP Basic authentication using ORDS-enabled database schema credentials
    oauth2:
      type: oauth2
      description: OAuth 2.0 authorization using ORDS OAuth client credentials or authorization code flow
      flows:
        clientCredentials:
          tokenUrl: /ords/{schema}/oauth/token
          scopes: {}
        authorizationCode:
          authorizationUrl: /ords/{schema}/oauth/auth
          tokenUrl: /ords/{schema}/oauth/token
          scopes: {}