services.data
CRUD runtime helper API for records (`get`, `find`, `create`, `update`, `delete`).
services.data
- Stability:
stable - Canonical source:
packages/client/src/index.ts
Methods
services.data.get<T = any>(object: string, id: string): Promise<GetDataResult<T>>
services.data.find<T = any>(object: string, options?: QueryOptions | QueryOptionsV2): Promise<PaginatedResult<T>>
services.data.create<T = any>(object: string, data: Partial<T>): Promise<CreateDataResult<T>>
services.data.update<T = any>(object: string, id: string, data: Partial<T>): Promise<UpdateDataResult<T>>
services.data.delete(object: string, id: string): Promise<DeleteDataResult>Parameters
object: short object name (for exampletask,account)id: record ID for single-record operationsdata: partial payload for create/updateoptions(find): filters, sorting, pagination (top,skip,filter,sort,select)
Returns
get: single record payloadfind: list payload + pagination metadatacreate/update: mutated record payloaddelete: success marker / deleted ID payload
Typical Errors
RECORD_NOT_FOUNDVALIDATION_FAILEDPERMISSION_DENIED
Example
const contact = await services.data.get('contact', ctx.input.contact_id);
const orders = await services.data.find('sales_order', {
filter: { contact_id: contact.id },
sort: [{ field: 'created_at', order: 'desc' }],
top: 20,
});