Unqork’s Internal API: Update APIs

Estimated Reading Time:  3 minutes

Overview

Most of Unqork's internal 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. (applications programming interface) calls use one of the create, read, update, and delete (CRUD CRUD refers to the four critical operations for creating and managing data elements in your applications. It stands for create, read, update, and delete.) operations. In this article, you'll explore an example of an update API service in Unqork. Here, you'll explore the Update Module Submission API call.

What You'll Learn

In this article, you’ll learn about the Update Module Submission API call and how it's configured.

Update Module Submission

This call functions like the Create Module Submission(s) call. But, instead of a POST call, the Update Module Submission API is a PUT call. A PUT type updates existing data.

The Update Module Submission call supports partial data updates. So, the data object does not need to include all the submission data. That way, you can use the call to update specific fields.

Review the Update Module Submission API Configuration

To help explain how the Update Module Submission 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. works, we've configured a module and Plug-In component that uses this API call. The following sections explore the configuration and lets you test the API.

WARNING  Feel free to use the configuration created here for your own builds. But, please do not reconfigure the modules. If you want to use the configuration, make a copy of the module and paste it in your application.

Review the initNewSubmission Initializer Component

First, let's open the preconfigured module and look at the Initializer component configuration.

1. Open the preconfigured module in the Module Builder by clicking the following link: https://training.unqork.io/#/form/64cbebe31ad85439c6380675/edit.
2. Hover over the initNewSubmission Radio Button component icon Initializer component.

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

3. Using the toolbar, click the (Settings) button.

You can see the Trigger Type is set to New Submission, firing the Initializer on page load. In the Outputs table, the component outputs values from a schema module and stores them in the moduleId Hidden component.

A static image displaying the initNewSubmission Intializer component's configuration with the New Submission Trigger Type and outputs to the schema module.

Review the submissionIdUpdate Text Field Component

This Text Field component lets your enter a submission ID in Express View Express View is how your end-user views you application. Express View also lets you preview your applications to test your configuration and view the styling. This is also the view your end-users will see when interacting with your application. After configuring a module, click Preview in the Module Builder to interact with the module in Express View.. After entering the submission ID, you can update the first name, last name, joke question, and joke answer of that submission.

TIP  To learn how to retrieve a submission ID to update, view our Unqork's Internal API: Read APIs article.

A static image displaying the SubmissionId to Update Text Field in Express View.

Review the pluginUpdateModuleSubmission Plug-In Component

Let's take a closer look at the necessary Plug-In component configuration and settings to make the API work.

1. Hover over the pluginUpdateModuleSubmission Plugin Component Icon Plug-In component.

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

2. Using the toolbar, click the (Settings) button.

Internal Services

From the Internal Services drop-down, you'll see that the Update Module Submission API is selected. Once selected, the Data Source URL auto-populates with /fbu/uapi/modules/{moduleId}/submissions/{submissionId}. As you can see, the {moduleId} placeholder text in the URL was adjusted to {{data.moduleId}}. That way, you can update the specific data fields stored in the moduleId Hidden component. These fields are first name, last name, joke question, and joke answer.

The {submissionId} placeholder text in the URL was adjusted to {{data.submissionIdUpdate}}. This references a specified submission ID entered into the submissionIdUpdate  Text Field component in Express View Express View is how your end-user views you application. Express View also lets you preview your applications to test your configuration and view the styling. This is also the view your end-users will see when interacting with your application. After configuring a module, click Preview in the Module Builder to interact with the module in Express View..

TIP  To learn more about the Update Module Submission API, click the Learn More button in the Plug-In component's configuration window.

A static image displaying the Update Module Submisson Internal Service selection in the Plug-In component.

Request Type

The Request Type is also set to PUT. The PUT type is used to overwrite data.

Inputs

Lastly, the Inputs table specifies the schema module components that store the data to be updated. The module contains four Text Field components with Property IDs A Property ID is the unique field ID used by Unqork to track and link components in your module. of firstNameUpdate, lastNameUpdate, jokeAnswerUpdate, and jokeQuestionUpdate. To properly map the updated submission, we use the {{data.propertyId}} syntax.

By default, any fields sent with the API call can update that submission even if they are blank. But, if you mark fields as optional, the fields only update submission data if they have values.

A static image displaying the Put Request Type and the data field mapping of the Plug-In component.

TIP  After updating a submission, you can confirm the change using the Get Module Submission API. To learn more about the Get Module Submission API, view our Unqork's Internal API: Read APIs article.

Resources