How to: Query Data Model Records Data

There are various methods for querying Data Model records data in Unqork. For example, authenticating and using Postman to retrieve your records data. These querying tools help test API calls and confirm records data are complete and accurate. To make it easier to query data on the Unqork Designer Platform, each environment includes a REST API method to query and perform SQL-like filtering commands on your Data Model's records. How you filter your data depends on the commands you configure in a remote execute API module.

Retrieving Data Model records using the Get Data Model Record API return a maximum of 200 records. This limitation applies to GraphQL and REST API methods.

Before querying data, there are three steps to follow to set up and authenticate your GraphQL Sandbox:

1. Locate the Data Model's model ID.
2. Configure an API module to query the records data.
3. Authenticate the GraphQL Sandbox to query your data.

Remember, Unqork workspaces, applications, and modules are assigned a unique identifier at creation. The same applies to Data Models. A Data Model's unique identifier is referred to as the model ID. To locate the model ID:

1. In Workspaces view, navigate to and select your Workspace.
2. To the left of the page, click  Data Models.
3. Click the Data Model tile of the records data you want to query.

Your browser window displays the following URL format: https://{your-env}.unqork.io/workspaces/{workspaceId}/data-model/{modelId}.

Highlight the {modelId} value and copy it for use in configuring your API module. The following image is an example of a model ID in the browser:

To save you time, we've created an API module that lets you query records data, as well as perform SQL-like count and filtering commands. You can find this remote execute API module in the Training environment here: https://training.unqork.io/#/form/63c94f7d9b81f136267efaf0/edit.

To take advantage of this preconfigured API module, copy and paste its module definition to a new module in your environment.

Confirm your new module exists in the same workspace as your Data Model.

Add Your Model ID

Now that you have your new API module, open it and add your model ID.

To add and connect your model ID to your new API module:

1. Open your new, preconfigured API module.
2. In the Module Builder, hover over the modelId Hidden component.

A 5-button toolbar displays above the component on hover-over.

3. Using the toolbar, click the (Settings) button.
4. In the Default Value field, replace the model ID with the model ID you copied in the Locate Your Model ID section.
5. Click Save & Close.
6. Save your module.

Explore the Preconfigured API Module

The various components in this module let you query Data Model records and count, filter, or skip records using logic components. Here are a few highlights on how the configuration works:

Component Description

method Hidden

This API module performs a POST request method so the GraphQL Sandbox can accept the data.

calcCleanVars  Calculator

This component applies a Lodash rule for the skip and limit arguments you can specify in the GraphQL Sandbox.

dwfFormatModelRecords Data Workflow

This component maps the key/value pairs of the data and outputs the records data.

plugGetModelRecords Plug-In

This component inputs the model ID and records data, mapping it to the GraphQL Sandbox. It also inputs arguments to filter, limit, or skip queried records. Then, it outputs the records in a new data structure.

calcClean Vars Calculator Component:

A static image displaying the infrastructure of AWS PrivateLink.

 

plugGetModelRecords Plug-In Component:

A static image displaying the layout of Azure PrivateLink Infrastructure.

 

Because this preconfigured API module is just a blueprint, you can adjust and reconfigure as you see fit.