1. Home
  2. Knowledge Base
  3. Using a Maintainer to call Web Services API

Using a Maintainer to call Web Services API

Overview

This enhancement allows developers to call web service endpoints from m-Power maintainer applications on add/update/delete actions.

This feature only applies to bootstrap Data List with Web Form and Single Web Form templates.

This enhancement utilizes both the dictionary level web service endpoint configuration as well as the maintainer workflow designer to fully configure and customize the web service integration.

The configuration of authentication methods and dictionary sign on for read-only web services (documented here) also applies to maintenance web service call

Configure Web Service at Dictionary Level

Configure the web service at the dictionary admin level just as you would for a read-only web service. There is no need to provide a sample body or configure web service fields for a web service endpoint that is write only (POST, PUT, DELETE). You can leave those tabs in the interface blank. Navigate to Admin -> Web Services -> Web Service Endpoints. Then “Register New Web Service”

Create Maintainer that will Invoke Web Service

Create your maintainer just as you would any other normal application.

Some users don’t want m-Power to write to the database when calling an API. If this applies to you, you should set the Skip Database Actions options to Yes in your Maintainer’s Application Property window.

Invoke API via Workflow

Next, open the Workflow designer in the maintainer you just created. Create a conditional node to set whether you want to call your web service on add or update or delete.

Select the Conditional option of “Check the Action Mode (Add/Update/Delete)”

Name the condition, and select the appropriate action.

Add an action “If True” to the condition. Use the “Call an external API” action type. The API configuration modal provides a list of all the web service endpoints configured at the dictionary level. Select the appropriate web service you created earlier in this document:

In the image above, note the API Message Body, this is where you configure the message body to be posted to your web service endpoint. The interface allows for JSON or URL encoded form content types (shown above). The API dialog will attempt to construct a default message body using all the fields from the maintainer. It is likely not exactly what you want to POST but serves as an example or starting point to construct your message body. You can change any part of this body as needed to match the parameter names expected by your web service or remove fields not needed. The “MXXXX.fieldname.type” strings are field substitutions that will be replaced at runtime with values submitted from the app/webform. 

If you need help creating the field substitutions, just type the open square bracket key [ and select from the list of maintainer fields. It will insert the appropriate substitution for you.

Running the Application

At runtime, the user will interact with maintainer just like they would any standard m-Power built application. However, when the user submits the record, based on the rules found in the Workflow designer, the app will trigger the API call as specified above.

Updated on August 7, 2023

Was this article helpful?

Need Support?
Can’t find the answer you’re looking for? Don’t worry we’re here to help!
Contact Support