How to: Query Data Model Records Data
Overview
There are various methods for querying A query lets you retrieve, access, manipulate, and delete data in a database. Data Model records data in Unqork. For example, authenticating and using Postman to retrieve your records data. These querying tools help test API APIs (application programming interfaces) are a set of protocols and definitions developers use to build and integrate application software. APIs act as the connective tissue between products and services. 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 SQL (Structured Query Language) is language used in programming and designed for managing data contained in a relational database system.-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. |
Locate Your Model ID
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 ![]() |
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:
Create an API Module to Query Records Data
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 ![]() |
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 |
This component applies a Lodash Lodash is a JavaScript library that lets you perform functions for common programming tasks. 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. |
Because this preconfigured API module is just a blueprint, you can adjust and reconfigure as you see fit.
Resources