This enhancement allows developers to call web service endpoints from m-Power maintainer applications on add/update/delete actions.
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.
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.
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.
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.