Skip to content

OpenAPI Specification

The JDX Odoo REST API follows OpenAPI 3.0 specification.

Customization Required

Replace {your-domain} with your actual domain in all examples.

Interactive Documentation

  • Swagger UI: Available at /api/swagger (production)
  • ReDoc: Available at /api/redoc (production)

API Version

Current Version: 1.0.0

Base URLs

Environment Base URL
Production https://{your-erp-domain}/restapi/1.0
Test http://localhost:8016/restapi/1.0

Configure your domain in .env.prod:

# Examples:
DOMAIN_ERP=erp.yourcompany.com
DOMAIN_ERP=odoo.yourcompany.com
DOMAIN_ERP=app.yourcompany.com

OpenAPI Spec

openapi: 3.0.3
info:
  title: JDX Odoo REST API
  description: |
    REST API for JDX Odoo 15 ERP System.

    ## Authentication

    All endpoints require authentication via one of:
    - Bearer token (OAuth2)
    - JWT token
    - API Key header

  version: 1.0.0
  contact:
    name: Support
    email: support@yourcompany.com

servers:
  - url: https://{your-erp-domain}/restapi/1.0
    description: Production (replace with your domain)
  - url: http://localhost:8016/restapi/1.0
    description: Test/Development

security:
  - bearerAuth: []
  - apiKeyAuth: []

paths:
  /common/oauth2/token:
    post:
      tags:
        - Authentication
      summary: Get access token
      description: Exchange credentials for access token
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              required:
                - grant_type
                - client_id
                - client_secret
              properties:
                grant_type:
                  type: string
                  enum: [client_credentials, authorization_code, refresh_token]
                client_id:
                  type: string
                client_secret:
                  type: string
                token_format:
                  type: string
                  enum: [jwt]
                  description: Request JWT token format
      responses:
        '200':
          description: Token issued successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TokenResponse'
        '401':
          description: Invalid credentials

  /object/{model}:
    get:
      tags:
        - Data
      summary: Search and read records
      parameters:
        - name: model
          in: path
          required: true
          schema:
            type: string
          example: res.partner
        - name: domain
          in: query
          schema:
            type: string
          example: "[('is_company','=',True)]"
        - name: fields
          in: query
          schema:
            type: string
          example: "['name','email','phone']"
        - name: limit
          in: query
          schema:
            type: integer
          example: 50
        - name: offset
          in: query
          schema:
            type: integer
        - name: order
          in: query
          schema:
            type: string
          example: "name asc"
      responses:
        '200':
          description: Records retrieved successfully
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
    post:
      tags:
        - Data
      summary: Create new record
      parameters:
        - name: model
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
      responses:
        '200':
          description: Record created
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: integer

  /object/{model}/{id}:
    get:
      tags:
        - Data
      summary: Read single record
      parameters:
        - name: model
          in: path
          required: true
          schema:
            type: string
        - name: id
          in: path
          required: true
          schema:
            type: integer
        - name: fields
          in: query
          schema:
            type: string
      responses:
        '200':
          description: Record retrieved
        '404':
          description: Record not found
    put:
      tags:
        - Data
      summary: Update record
      parameters:
        - name: model
          in: path
          required: true
          schema:
            type: string
        - name: id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
      responses:
        '200':
          description: Record updated
    delete:
      tags:
        - Data
      summary: Delete record
      parameters:
        - name: model
          in: path
          required: true
          schema:
            type: string
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: Record deleted

  /object/{model}/{id}/{method}:
    post:
      tags:
        - Methods
      summary: Call model method
      parameters:
        - name: model
          in: path
          required: true
          schema:
            type: string
        - name: id
          in: path
          required: true
          schema:
            type: integer
        - name: method
          in: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
      responses:
        '200':
          description: Method executed

components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
    apiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key

  schemas:
    TokenResponse:
      type: object
      properties:
        access_token:
          type: string
        token_type:
          type: string
          example: Bearer
        expires_in:
          type: integer
          example: 3600

    Error:
      type: object
      properties:
        error:
          type: string
        error_description:
          type: string
        message:
          type: string

tags:
  - name: Authentication
    description: OAuth2 token endpoints
  - name: Data
    description: CRUD operations on models
  - name: Methods
    description: Custom method calls

Using the Specification

The complete OpenAPI 3.0 specification is embedded above. To use it:

  1. Copy the YAML content from the OpenAPI Spec section above
  2. Paste into Swagger Editor for interactive testing
  3. Or import into Postman/Insomnia for API client generation