Search
The search method performs a text-based search across records in the collection.
Configuration Example
# spec.yml
name: Collection Name
methods:
  search:
    parametersSchema:
      type: object
      properties:
        searchFields:
          type: array
          items:
            type: string
            enum: ["name", "email", "phone"]
          default: ["name", "email"]
          description: Fields to search inImplementation Examples
module.exports = async ({ query, cursor, credentials, parameters }) => {
  const response = await makeApiRequest({
    method: "GET",
    path: "/api/contacts/search",
    query: {
      q: query,
      limit: 50,
      offset: cursor || 0,
    },
    credentials,
  })
  return {
    records: response.data,
    cursor: response.hasMore ? String((cursor || 0) + 50) : undefined,
  }
}Input
| Property | Type | Description | 
|---|---|---|
query | string | The search query string | 
cursor | string | Pagination cursor from previous request | 
credentials | object | Authentication credentials | 
parameters | object | Method-specific parameters | 
Return Value
| Property | Type | Description | 
|---|---|---|
records | array | Array of matching records | 
cursor | string | Cursor for next page (optional) | 
Updated 10 days ago
