queryDataItems( )


Important:


Retrieves a list of items based on the provided filtering, sorting, and paging preferences.

Method Declaration
Copy
function queryDataItems(
  payload: QueryDataItemsEnvelope,
): QueryDataItemsResponse | Promise<QueryDataItemsResponse>;
Method Parameters
payloadQueryDataItemsEnvelope
Returns
Return Type:QueryDataItemsResponse | Promise<QueryDataItemsResponse>
Example of `items` and `pagingMetadata` return values
JavaScript
import { externalDatabase } from "@wix/data/service-plugins"; externalDatabase.provideHandlers({ queryDataItems: async (payload) => { const { request, metadata } = payload; // Use the `request` and `metadata` received from Wix and // apply custom logic. return { // Return your response exactly as documented to integrate with Wix. // Return value example: items: [ { name: "New York", _id: "c285e77c-a86b-4361-a55f-c6b934d70187", population: 8300000.0, country: "US", isCapital: false, }, ], pagingMetadata: { total: 1, }, }; }, });
Errors
BadRequestWixErrorclass
CollectionAlreadyExistsWixErrorclass
CollectionChangeNotSupportedWixErrorclass
CollectionNotFoundWixErrorclass
ItemAlreadyExistsWixErrorclass
ItemNotFoundWixErrorclass
ReferenceAlreadyExistsWixErrorclass
ReferenceNotFoundWixErrorclass
ValidationWixErrorclass
Did this help?