Fetching Infor Public Sector Records

Christian Berger
Christian Berger
  • Updated

FME Version

  • FME 2021.0

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 fetch and query Work Order records using the InforRecordFetcher. In subsequent articles, you will learn how to update, and create new records as well.

Step-by-step Instructions

1. Add an InfoRecordFetcher to a Blank Workspace
Open FME Workbench and start a blank workspace. Add both a Creator and InforRecordFetcher transformer to the canvas. 

 

1_Workspace.png

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. 
2_API_Endpoint.png

​​​​​​​
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.​​​​​​​

3_Fetcher_Parameters.png

4. Run the Workspace
Now that the authentication is set, you can either run the workspace to return all work orders, or you can specify a SELECT statement to limit the number of features that will be returned by Infor. 

For example, you can SELECT an ID from the specified Resource to fetch a single feature. Alternatively, a query string may be provided to fetch multiple resources. See the following examples (bold indicates a valid parameter value):

  • Example 1: To query for a Work Order with Id 1014: 1014
  • Example 2: To query page 1 with a max of 10 features: page={Start:1,Max:10}

To set the number of features to read, set the select statement to: Page=[{Max:10}]


Note: If the InforRecordFetcher is rejecting features, try limiting the number of features you are fetching using the page query (example 2). This limits responses returned to a paged set using the max property. For additional information on formulating SELECT queries, please refer to the Infor documentation guide


5. Fragment and Flatten the JSON.
The data returned from the InforRecordFetcher will be formatted as JSON. You can preview the JSON response by inspecting the value of the /workmanagement/workorders (different for other resources) attribute. The remainder of the article will be broken into two scenarios:

 

Example 1: Exposing attributes after fetching a single record.

When querying a single record, there is no need to fragment the JSON response. Simply use a JSONFlattener to flatten the /workmanagement/workorders attribute. This will flatten the JSON structure into dot notation attributes like data.activity.code and data.activity.id. 

At this point, it is best to run the workspace up to the JSONFlattener as we will expose the attributes using a feature cache in the next step. 


4_Flatten.png

​​​​​​​Next, using an AttributeExposer, we can expose the desired attributes from the feature cache. 
5_Expose.png

At this point, our attributes will be exposed as attributes in our feature table. All unexposed attributes are still available; however, they need to be exposed before they can be utilized in the workspace. 
6_Exposed.png
 

Example 2: Fragmenting and exposing attributes after fetching multiple records. 

When querying multiple records, you will need to fragment the JSON response. This will extract portions of JSON formatted text into new FME features. Simply use a JSONFragmenter to both Fragment and Flatten the /workmanagement/workorders attribute. This will fragment the JSON from a single feature into multiple features and flatten the JSON structure into dot notation attributes like activity.code and activity.id. 

Set the JSON Query parameter to json[“data”][*] and flatten attributes to YES. This will split the JSON fragment into multiple features (10 in this example) and flatten the JSON attributes for use in the next step.

7_Fragment.png

At this point, it is best to run the workspace up to the JSONFragmenter as we will expose the attributes using a feature cache in the next step. 

Next, using an AttributeExposer, we can expose the desired attributes from the feature cache. In Example 1, we exposed attributes using the Import button. It is also possible to expose attributes by typing the name or selecting from the drop-down list in the AttributeExposer. 
8.png
At this point, our attributes will be exposed as attributes in our feature table. All unexposed attributes are still available; however, they need to be exposed before they can be utilized in the workspace. 

Please see the Tutorial: Getting Started with JSON articles to learn more about parsing JSON responses from an API.

Note: the original JSON is also preserved in the /<resourceName> attribute that is exposed. 

Build out the rest of your workspace. Schema map, enrich, etc using any combination of FME’s 450+ transformers to get your data into the desired output format/system. 
 

Summary

After completing this tutorial, you should now be able to successfully fetch records from your Infor Public Sector instance via the Infor REST API. If the resource you are trying to connect to 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.

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.