REST API & Data Integration

Struktural automatically generates a comprehensive, secure REST API for every persistent and virtual entity defined in your schema. This allows external systems, custom frontends, and integration middleware (like Zapier or MuleSoft) to interact with your data programmatically.

Base URL & Authentication

All dynamic entity endpoints follow the tenant-based routing structure:

https://{your-server}/api/apps/{appId}/{EntityName}

Authentication & Authorization: Requests MUST include a valid authentication token (either an Authorization: Bearer <JWT> header or an ASP.NET Auth Cookie). The authenticated user must have the corresponding RBAC permission (Create, Read, Update, Delete) granted for the target entity.


1. Standard CRUD Operations

Get by ID

Create Record

Update Record

Delete Record


2. Advanced Query & Pagination

Instead of relying on complex URL query strings, Struktural provides a powerful POST endpoint for searching, sorting, and filtering data.

Payload Schema (EntityQueryRequest)

{
  "Page": 1,
  "PageSize": 50,
  "SortBy": "CreatedAt",
  "SortDirection": "desc",
  "SearchTerm": "John",
  "Includes": ["Customer", "OrderLines"],
  "Filter": {
    "Logic": "AND",
    "Children": [
      { "Field": "Status", "Operator": "eq", "Value": "Active" },
      { "Field": "TotalAmount", "Operator": "gte", "Value": 1000 }
    ]
  }
}

Response Schema (PagedResult<T>)

{
  "Success": true,
  "Value": {
    "Items": [ { "Id": 1, "Status": "Active", "TotalAmount": 1500 } ],
    "TotalCount": 1,
    "Page": 1,
    "PageSize": 50,
    "TotalPages": 1
  },
  "ErrorMessage": null,
  "ValidationErrors": [],
  "FieldErrors": {}
}

3. Standard API Error Handling

If a request fails validation (either static schema constraints or custom AddError() calls from a C# script), the API returns a 400 Bad Request with the following populated Result structure:

{
  "Success": false,
  "ErrorMessage": "Validation failed during script execution.",
  "ValidationErrors": [
    "The provided email is already in use."
  ],
  "FieldErrors": {
    "TotalAmount": [
      "Must be greater than 0"
    ]
  }
}

4. Bulk Data Import API

Struktural provides a native endpoint to upload and map external Excel (.xlsx) or CSV files directly into an entity. This process wraps all row insertions into a single database transaction and executes the BeforeImport and AfterImport scripts.

Form-Data Fields

  1. file: The physical file binary.
  2. mappingJson: A JSON string representing the ImportMappingRequest object, which tells the engine how to map file columns to entity properties.

mappingJson Structure

{
  "EntityName": "Employee",
  "SheetName": "Sheet1",
  "HeaderRow": 1,
  "FieldMappings": {
    "Excel Column A": "FirstName",
    "Excel Column B": "LastName",
    "Hire Date": "StartDate"
  }
}