Entity CRUD API

Universal REST API for all entities — standard and custom objects

Overview

OptiCRM provides a unified REST API for all entities. The same endpoints work for standard entities (Student, Staff, Invoice) and custom objects.

List Records

GET /api/v1/entities/{apiName}

Query Parameters:

  • search — Full-text search across name fields
  • status — Filter by status field
  • sortBy — Sort column
  • sortOrder — asc or desc
  • cursor — Pagination cursor
  • limit — Records per page (default 20, max 100)

Example:

GET /api/v1/entities/Student?search=john&status=ACTIVE&limit=10

Response:

{
  "data": [
    {
      "id": "clx...",
      "firstName": "John",
      "lastName": "Smith",
      "studentCode": "STU-2026-00042",
      "status": "ACTIVE"
    }
  ],
  "nextCursor": "clx...",
  "totalCount": 156
}

Get Single Record

GET /api/v1/entities/{apiName}/{id}

Create Record

POST /api/v1/entities/{apiName}
Content-Type: application/json
 
{
  "firstName": "John",
  "lastName": "Smith",
  "dob": "2010-05-15",
  "gender": "MALE"
}

The system automatically:

  • Generates auto-number fields (e.g., studentCode)
  • Evaluates default values and formulas
  • Runs validation rules
  • Triggers before/after save hooks
  • Fires notification rules and workflows

Update Record

PATCH /api/v1/entities/{apiName}/{id}
Content-Type: application/json
 
{
  "status": "ALUMNI"
}

Delete Record

DELETE /api/v1/entities/{apiName}/{id}

Bulk Operations

POST /api/v1/entities/{apiName}/bulk
Content-Type: application/json
 
{
  "operation": "update",
  "ids": ["id1", "id2", "id3"],
  "data": { "status": "ACTIVE" }
}

Entity Metadata

GET /api/v1/entities/{apiName}/meta

Returns the entity definition including all fields, field types, picklist values, and relationships.

Import

POST /api/v1/entities/{apiName}/import
Content-Type: multipart/form-data
 
file: students.csv

Supports CSV and Excel files. Maps columns to entity fields automatically.