Skip to content
+1-888-319-3663

EONE BLOG

Tech Tuesday: REST Lookups


This week we are going to look at REST Lookups and how they can simplify your integrations with REST APIs. We will be investigating several REST API features. We will be showing the configuration in SmartConnect.com, but all the same features are available in SmartConnect 21.

Table of Contents

  1. What are REST Lookups?
  2. Adding a Lookup to the REST Connector
  3. Using a REST Lookup as Mappable Fields
  4. REST Lookup Options
  5. REST Lookup as a Restriction

What are REST Lookups?

Lookups are available on all the standard SmartConnect connectors allowing the integration to dynamically retrieve data from the target system prior to sending the data to the target system. REST lookups are the most recent lookup feature added to SmartConnect, allowing users to define custom lookups for REST destination integrations. These lookups can retrieve data that can then be used as a mappable field, part of a calculation or a restriction.

The below video walks through setting up and using a REST Lookup.


Adding a Lookup to the REST Connector

The first step is to add the REST Lookup to the

  1. Navigate to Maintenance > REST Services > “Your Connector” > Service Lookups
  2. Type a Name for the lookup column and click the pencil to edit
  3. Set the endpoint and REST Method as outlines in the REST API documentation
  4. Switch to the Returnable Fields tab and define at least one returnable field
  5. Add any Body, Headers, or Parameters that will be used as part of the filter criteria.
  6. Switch the Filter Criteria tab and check the “Display in filter” option for any variables, headers, or parameters you want to use as the filter criteria
  7. Save the Lookup setup

Using a REST Lookup as Mappable Fields

Once the REST Lookup has been created, it can be added to the integration process.

  1. Open the integration process that will use the lookup
  2. Navigate to Integration > Additional Columns > Add Additional Column
  3. Add at least one return field and Filter Criteria
  4. Save the lookup and map the REST Lookup fields as needed
These lookup fields can now be mapped directly to any target fields, or used in a calcuation.


REST Lookup Options

When configuring the additional column there are two check boxes.

  1. Late Bound Lookups: will be run after all data is calculated, which means this lookup can use a calculation as the filter criteria column
  2. Include lookup result in scripting: will run the lookup before other additional columns, which means the result can be used in a calculation
  3. Neither checkbox is used: will allow the lookup to be used as a restriction

In the “If No Data” drowdown there are 6 options. The below table describes each of the options in the dropdown and if they can be used in combination with the two check boxes.


Option Description Late Bound Lookups Result in Scripting
Continue If the lookup does NOT return data, the integratin will continue to process Allowed Allowed
Restrict line out if data exists If lookup DOES return data, the integration will not send any lines that use this lookup Not Allowed Not Allowed
Restrict line out if no data exists If the lookup does NOT return data, the integration will not send any lines that use this lookup Not Allowed Not Allowed
Return failure for current integration line If the lookup does NOT return data, the current document will fail and the integration will continue processing the next document Allowed Allowed
Stop processing integrations If the lookup does NOT return data, the integration will stop processing all documents with an error Allowed Allowed


REST Lookup as a Restriction

A REST Lookup can be used to dynamically restrict data based on if the lookup criteria returns data from the API.

At least one field from the lookup column must be mapped to a target field on the line which should use the lookup as a restriction.

A common use for this feature is to create a single integration capable of performing both Creates and Updates. Without using a lookup the only way to know if a record already exists in the target system is to writeback the target identifier to the source system.

Example Scenario

I am importing Items from Business Central into WooCommerce. The WooCommerce API requires separate API endpoints for creating products than for updating products. To accommodate this, I will setup the integration to use two REST destinations in one integration. When querying the item list from Business Central, SmartConnect doesn’t know if the data already exists in WooCommerce. Therefore, I need to use REST Lookups to query WooCommerce to check if the product already exists. The lookups will be setup this way:

  1. Create a new Lookup named “LKUP_NEW_ITEM”
  2. Set the lookup to “Restrict line out if data exists”
  3. Create a new Lookup named “LKUP_EXISTING_ITEM”
  4. Set the lookup to “Restrict line out if no data exists”
  5. Map the “LKUP_NEW_ITEM” field to a field on the “Create Product” line
  6. Map the “LKUP_EXISTING_ITEM” field to a field on the “Update Product” line
The integration will now dynamically use the Create and Update product endpoints based on if the product already exists in WooCommerce.


If you have any further questions, you can email us at support@eonesolutions.com.

Using REST Connector Lookups

Leave a Comment





RECENT POSTS


eOne Sessions at Community Summit North America 2022
Dynamics SL to D365 Business Central Migration - Recordings Now Available!
Technical Update for SmartConnect regarding D365 Business Central
Connect with eOne at Summit North America 2022 - Live in Orlando!
NEW WEBINAR: Dynamics SL to D365 Business Central Migration - Next Week!

POPULAR POSTS


2016 SmartConnect Integration Bootcamps
Tech Tues: Automatically refreshing Pivot Tables in Excel Refreshable Reports
Happy Thanksgiving from the eOne team!
2017 SmartConnect Integration Bootcamps
New Releases of Extender and SmartList Builder

CATEGORIES

TAGS

Business Central CRM D365 Business Central Dynamics 365 dynamics crm Dynamics GP Dynamics NAV Econnect Employee Spotlight eone eOne News error Error Message Events Excel Excel Report Builder Extender Flexicoder GP integration Map Meet the Team Microsoft dynamics crm Microsoft Dynamics GP Navigation List Builder Office Relationships Partner All Hands Call Popdock promotions release SalesForce SalesForce.com SmartConnect SmartConnect.com SmartConnect Bootcamp SmartConnect Maps SmartConnect Office Hours SmartList SmartList Builder SmartPost SmartView SQL Tech Tuesday Templates training

Integrate & Automate without Any Code.

SmartList Data has Never Been Faster.

The Easiest Way to Report on GP Data.