Cirqll Core
HomeCirqll
HomeCirqll
  1. Query Parameters
  • Query Parameters
    • Eager Loading
    • Partial Data
    • Count Relations
    • Pagination
      • Filter
      • Order By
  • Authentication
    • OAuth2
      • Authorize
        • Authorize
      • User
        • Me
      • Client
        • Index
        • Create
        • Update
        • Delete
      • Token
        • Create
        • Refresh
        • Index
      • Scopes
  • User
    • Index
      GET
    • Show
      GET
    • Create
      POST
    • Update
      PATCH
    • Delete
      DELETE
  • Role
    • Index
      GET
    • Show
      GET
    • Create
      POST
    • Update
      PATCH
    • Delete
      DELETE
  • Customer
    • Index
      GET
    • Show
      GET
    • Create
      POST
    • Update
      PATCH
    • Delete
      DELETE
  • Contact
    • Index
      GET
    • Show
      GET
    • Create
      POST
    • Update
      PATCH
    • Delete
      DELETE
  • Appointment
    • Index
    • Show
    • Create
    • Update
    • Delete
  • Task
    • Index
    • Show
    • Create
    • Update
    • Delete
  • Financial
    • Chance
      • Index
      • Show
      • Create
      • Update
      • Delete
    • Assignment
      • Index
      • Show
      • Create
      • Update
      • Delete
    • Contract
      • Index
      • Show
      • Create
      • Update
      • Delete
  • Email
    • Index
    • Show
    • Create
    • Update
    • Delete
  • Field
    • Index
    • Show
    • Create
    • Update
    • Delete
  • Note
    • Index
    • Show
    • Create
    • Update
    • Delete
  • To-do
    • Index
    • Show
    • Create
    • Update
    • Delete
  • Template
    • Index
    • Show
    • Update
    • Create
    • Delete
  • Setting
    • Index
    • Update
  • Webhook
    • Index
    • Show
    • Create
    • Update
    • Delete
  1. Query Parameters

Eager Loading

Eager loading is a technique used to load related data along with the primary resource in a single query or API call, reducing the need for subsequent, separate requests to fetch related data. This can improve performance and reduce the number of queries made to the API.
In the API, eager loading is facilitated by the with parameter. For example, when fetching a user (either via an index or a show request), you can include related data, such as the user's company, by passing company to the with parameter. This ensures the user's company is loaded alongside the user resource, eliminating the need for additional API calls to retrieve that relationship.

Example#

1.
Without eager loading:
First, fetch the user (GET /api/user/1).
Then, fetch the user's company (GET /api/company/42).
2.
With eager loading:
Fetch the user and their company in one request:
GET /api/user/1?with=company
This approach reduces network overhead and latency while making our API more efficient and easier to use for clients that require related data.

Multiple Relations#

The with query parameter accepts arrays and comma-separated keys. The two formats look like this:
It is also possible to use the dot notation to fetch nested relations, like company.subscription. This will result in the subscription being loaded inside the company.
Should not be used in conjuction with Partial Data (show)
Modified at 2025-01-26 13:29:59
Previous
Query Parameters
Next
Partial Data
Built with