top of page

Unqork's Internal APIs, External APIs, Schema, and Transform: An insight for configuration

APIs in unqork have an interesting concept behind them. In my current project, I have been extensively using external APIs to save and retrieve data and are not storing internally in the unqork platform.


Whenever we post data to external APIs, then by default it's a server-side execution. Hence whatever data manipulation happens at the backhand, the user is unaware of it, even if he investigates the console.


But that is not what happens internally in Unqork if you intend to save data in the Unqork platform. As it's a single platform, whatever data manipulation we do, we can see it in the console. Hence, they have an option of server-side execution in the module.



Unqork Internal APIs


If you intend to post data, get it, or manipulate it and don't want the user to know about it. You simply create a separate module, configure it, and make it server-side execution. When you run the application, in the network, you can only see the execute call and no components can be seen in the console related to it. This is what is recommended by Unqork.


I will be switching to the classic designer view from the new designer view of unqork, as the old one is easy to work with and it provides ample space to see the configuration rather than be confined on the right side. Bit trouble for small screen users like when accessing in a laptop.



Unqork designer view


Unqork designer view


The first one is the main module, whereas the below one is the API module which is configured to server-side execution.



Unqork designer view


Below is the express view or UI app screen with no component calls being shown in the console and an execute call shown in the network tab.



Unqork express view of an application


Unqork express view of an application


Schema Module


In the external API call, the data is stored or retrieved from an external database like AWS, Azure, etc. But in unqork, it stores internally. Hence we use something called a schema module to store data, which enhances the security of the application. Though it's not necessary but is highly recommended.


The schema module is simply a new module with all the required fields to be stored in the database. It contains all the hidden components with the same property ID as given in the main module where the user is interacting with the application.



Unqork designer view


Every new set of data created in Unqork is stored and identified via a submission ID which is linked to its module ID. Hence, we can easily retrieve and manipulate data as per our requirements with the help of module IDs and Submission IDs.



Unqork express view of the application


Unqork External APIs


When interacting with the external database and not using the Unqork platform for data storage then we need to use them;

  • Plugin - to call the APIs

  • Transformer - to format the data in the required format such as JSON


First, we create a plugin to access the transform and provide the required input. As well as provide the output to store the formatted data to be used to send to the external API.



Unqork designer view



Unqork Designer View


Further, in the post-trigger, we triggered the external API call. The config structure in main module looks like this



Unqork designer view


The final plugin is configured with the external API endpoint with the payload as the transformer output which we saved in the hidden component.



Unqork designer View


Unqork designer view


The transform is present in the top right corner inside the triple dot



Unqork designer view


Unqork designer view


Below is a reference transform code, It can be extremely long depending on the input and database requirements.



{

"commandID": "sdjfhsdjh8734hrj87738hhdfj",

"commandName": "APIUpdateExternalAPI",

"XYZID": "ABC",

"userID": "{{data.currentUser}}",


"submissionList": [{

"firstName": "{{data.firstName}}",

"lastName": "{{data.lastName}}",

"DateOfBirth": "{{data.dateOfBirth}}",

"documentType": "{{data.documentType}}",

}

{% endif %}

]

}



Unqork platform highly relies on internal and external APIs to make its functionality incredible. It uses internal APIs to call or execute other modules, data collection, etc.


**END

Yorumlar


bottom of page