FME Version
Introduction
Integrate the Infor Public Sector (IPS) platform directly into your FME workflows to achieve seamless communication between applications. By establishing a connection to Infor’s REST API, you can facilitate the flow of information and design responsive workflows. If you have not already set up your Infor Web Connection, please refer to the Connecting to Infor in FME article before proceeding.
In this example, you will learn the basics of how to create new records using the InforRecordCreator.
Step-by-Step Instructions
Starting from a blank workspace, add both a Creator and InforRecordCreator transformer to the canvas.
Select your Infor Web Connection (or create a new Infor Web Connection with the Infor Web Service).
Add your Infor IONAPI Endpoint (available in the Infor ION API documentation at the top of the page)
1. Add an InfoRecordCreator to a Blank Workspace
Open FME Workbench and start a blank workspace. Add both a Creator and InforRecordCreator transformer to the canvas.
2. Select Infor Web Connection
Select your Infor Web Connection (or create a new Infor Web Connection with the Infor Web Service).
3. Add Infor IONAPI Endpoint
Add your Infor IONAPI Endpoint, available in the Infor ION API documentation at the top of the page of the Infor app. See below image.
Bonus tip:
Save your IONAPI Endpoint and/or Web Connection settings as a default. You can also set this as the default parameters or easily reset using the presets drop-down menu.
4. Specify Which Resource to Create
Now that the authentication is set, specify which resource you want to create a new record for. In this example, we will create a new Work Order. Note: the Activity attribute is required to create new records. Activity is also CaSe SeNsItIVe.
- Common attributes, such as Activity, Assigned to, Comments, Start/End Time, and Address ID are available in the main parameters window and can be quickly set using attribute values.
- The JSON Body attribute allows you to add additional attributes (that are not provided above) to the JSON string sent via the REST API.
These must be formatted as key-value pairs, or arrays with key-value pairs as outlined in the ION API, Public Sector API documentation. The value of the JSON body parameter will be inserted between objects if any other [optional] parameters are specified above. See below for more examples:
Sample JSON Bodies:
Example 1
"usage": 0, "scheduledDateTime": "string", "scheduledFinish": "string", "comments": "string"'
Example 2
"priority": { "code": "Low" }
Example 3
"Parcel": [ { "id": 0, "parcelId": "string", "parcelName": "string", "isEffective": true, "isExpired": true, "effectiveDateCommonId": "string", "expiredDateCommonId": "string", "lastModifiedDateTime": "string", "includeAttachments": true, "gisKey": "string" } ]
Example 4
"serviceRequest": { "id": 0, "lastModifiedDateTime": "string", "includeAttachments": true }, "asset": { "id": 0, "assetId": "string", "type": "string", "includeAttachments": true, "lastModifiedDateTime": "string" }
Please refer to the Tutorial: Getting Started with JSON articles to familiarize yourself with the methods available to prepare a JSON Upload Body.
The remainder of the article will be broken into two scenarios:
- Example 1: How to create a record with hardcoded values
- Example 2: How to create records with attribute values
Example 1: Creating a new record using hardcoded values
In this scenario, we will create a new record and set the Assigned To, Comments, and Priority of an Infor Public Sector Work Order. In the InforRecordCreator, set the Activity parameter (required & case sensitive), AssignedTo (user ID in Infor), Comment, Start Date, End Date, and Address ID (existing Address ID).
In the JSON Body, since we will be setting priority code, we will need to format the JSON as an array with a key-value pair. Set the value to:
"priority": { "code": "High" }
Priority code: along with many other coded attributes must already be created in the Infor Public Sector instance.
New record in Infor
Although Example 1 demonstrates how to hard code values, this could easily be replaced with Published Parameters to set values. Using published parameters allows you to set the values prior to running the workspace or can be used to accept input via an FME Server Workspace App.
Example 2: Creating records using attribute values
In this scenario, we will create a new Infor Public Sector record using attribute values. In the InforRecordCreator, set the ID, Activity, Assigned To, Start Date, End Date, and comments to the attributes containing their respective attribute values.
Click the drop-down arrow in the JSON Body parameter and open the text editor.
In the JSON Body, since we will be setting the priority code, we will need to format the JSON as an array with a key-value pair.
"priority": { "code": "@Value(Priority)" }
As demonstrated in this screenshot, reviewing the API documentation will provide you with the exact JSON formatting. It’s easy to copy and paste the JSON from the API and replace the “string” with the actual attribute value in the text editor. If you are wanting to format a large number of attributes you may want to consider utilizing the JSONTemplater transformer.
Note: When setting dates, please ensure the date values are formatted in ISO Datetime with Offset standard (i.e. %Y-%m-%dT%H:%M:%S%Ez). This can be done either using a DateTimeConverter or by using a Date/Time Function in the text editor.
Summary
After completing this tutorial, you should now be able to successfully create records in your Infor Public Sector instance via the Infor REST API. If the resource you are trying to create records for is not available in the resource drop-down, please see the Getting Started with Infor Public Sector article to see the Adding Additional API Calls section.
Comments
0 comments
Please sign in to leave a comment.