HAP icon

HAP

Interact with HAP (Hyper Application Platform) API

Record → Get Many

AI-generated

Overview

This node interacts with the HAP (Hyper Application Platform) API to retrieve multiple records from a specified worksheet. It supports advanced filtering, sorting, pagination, and field selection, making it useful for scenarios where users need to query large datasets efficiently and flexibly.

Typical use cases include:

  • Extracting filtered data sets from a worksheet based on complex conditions.
  • Paginating through records in batches to process or analyze them incrementally.
  • Selecting specific fields to reduce payload size and focus on relevant data.
  • Sorting records by one or more fields.
  • Performing keyword fuzzy searches across records.
  • Returning data either in a table view format or as raw JSON objects.

For example, a user might want to fetch all customer records whose names start with "张" and whose dates fall within January 2025, sorted by creation date descending, retrieving only certain fields for further processing.

Properties

Name Meaning
Worksheet ID The unique identifier of the worksheet from which to retrieve records.
Page Index The page number to retrieve, starting from 1. Used for paginated results.
Page Size Number of records per page, with a maximum limit of 1000. Controls batch size for each request.
View ID Optional filter to restrict records to those visible in a specific view.
Fields JSON array of field IDs to return for each record. If empty, all fields are returned. Allows limiting the response to relevant fields only. Example: ["field1", "field2"].
Filter JSON object defining complex filtering logic. Supports nested groups (AND/OR) and conditions with operators such as equals, not equals, greater than, less than, contains, starts with, between, is empty, etc. Filters must use field IDs and respect field types (e.g., option fields require keys). Supports up to two-level nesting. Example:
{
  "type": "group",
  "logic": "AND",
  "children": [
    {"type": "condition", "field": "name", "operator": "startswith", "value": "张"},
    {"type": "condition", "field": "date", "operator": "between", "value": ["2025-01-01", "2025-01-31"]}
  ]
}
```                                                                                                                                                                                                                              |
| Sorts                | JSON array specifying sort configurations. Each item includes a field ID and a boolean indicating ascending (`true`) or descending (`false`) order. Example: `[{"field": "field_id", "isAsc": false}]`.                                                                                                                                                                                                                                                                                                           |
| Search               | Keyword string for performing a fuzzy search across records.                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| Table View           | Boolean flag indicating whether to return data in a structured table view format (`true`) or as raw JSON objects (`false`).                                                                                                                                                                                                                                                                                                                                                                                     |
| Use Field ID as Key  | Boolean flag determining if the output keys should be field IDs (`true`) or their aliases (`false`).                                                                                                                                                                                                                                                                                                                                                                                                             |
| Include Total Count  | Boolean flag to include the total count of matching records in the response, useful for pagination UI.                                                                                                                                                                                                                                                                                                                                                                                                           |
| Include System Fields | Boolean flag to include system-generated fields in the response, such as metadata fields. Defaults to `false`.                                                                                                                                                                                                                                                                                                                                                                                                  |

## Output

The node outputs an array of records under the `json` property. Each record contains key-value pairs representing field data. The keys correspond either to field IDs or aliases depending on the `Use Field ID as Key` setting.

If `Table View` is enabled, the data is formatted as a table-like structure suitable for direct consumption or display.

If `Include Total Count` is enabled, the output also includes a total count of all matching records, enabling clients to understand the full dataset size beyond the current page.

No binary data output is produced by this operation.

## Dependencies

- Requires an API key credential for authenticating with the HAP API.
- The node expects network connectivity to the HAP service endpoint.
- No additional external dependencies are required beyond the configured API authentication.

## Troubleshooting

- **Invalid Worksheet ID**: If the worksheet ID does not exist or is incorrect, the API will likely return an error or empty result. Verify the worksheet ID is correct.
- **Filter Syntax Errors**: Improperly formatted filter JSON or unsupported operators will cause errors. Ensure filters conform exactly to the documented structure and allowed operators.
- **Page Size Limits**: Requesting a page size larger than 1000 may result in errors or truncated responses. Keep page size at or below 1000.
- **Authentication Failures**: Missing or invalid API credentials will prevent successful requests. Confirm that the API key credential is properly configured.
- **Field ID vs Alias Confusion**: If output keys do not match expectations, check the `Use Field ID as Key` setting to ensure keys align with downstream usage.
- **Empty Results**: If no records are returned, verify filters, view ID, and search keywords to confirm they match existing data.

## Links and References

- [HAP API Documentation](https://ncnod.com/9iger8kt) *(Replace with actual URL)*
- [n8n Documentation on Creating Custom Nodes](https://ncnod.com/gzcngyr6)
- JSON Filtering and Sorting Concepts: Refer to the node's filter and sort property descriptions above for supported operators and structures.

Discussion