Skip to content
+1-888-319-3663

EONE BLOG

Tech Tuesday : Using Parameters to Enhance the REST Connector Setup


Hey everyone! Today we are looking at using different parameters within the REST Connector to either give additional options during running the map, pass through header information on any request, or to allow for bulk adjustments on the setup of the endpoints/methods themselves.

This article is aimed at users who have worked with the REST Connector inside of SmartConnect before, and are looking to either modify an existing provider or create their own definition.

 

The first time we would use a parameter is if we want to send header data through for the method we are calling. Most often this will be the Authorization parameter or something similar.

In the screenshot above, I have opened the Authorization parameter for my Shopify connection definition. The “Is Header” flag is marked on the parameter and I’ve set a “Default Value” for it. Now when this parameter is added to a particular method, it will automatically pass through its default value when the method is called. Again, this is most commonly used with the Authorization parameter for headers – but if you find an API that requires additional header parameters then this same process can be used for each.

 

Parameters can also be used as part of the method URL. The first occasion you would use them would be to simplify the process for changing the URL path – whether you are just switching instances within a system or are moving from a dev to production API.

Continuing with the Shopify API, the base URL for any methods would look similar to the following:
  https://eOneStore.myshopify.com/admin/

The actual method ends would then change on the end of that URL to call customers.json, products.json, etc. The base URL will change from client to client, however, as the subdomain that is currently called “eOneStore” will be different for every instance. Rather than hardcoding the value in the API definition, we will use a parameter as a placeholder.

In the screenshot above, we have set up each URL to use the {Store_Prefix} parameter as a placeholder for the subdomain. We have added both the Store_Prefix and Authorization parameters to the method as well so SmartConnect knows to reference them when calling the method.

In the background of the screenshot, you can see that every method in my definition is set up in this manner. Now when we export this definition and import it to another system – or if we just need to change the subdomain from a dev instance to production – we no longer have to update each method. Instead, we just switch to the Parameter tab and update the Default Value for the Store_Prefix parameter.

Parameters can also be used on a method when needing to filter the data being returned. These parameters can be changed at runtime on the map – either manually or through a script.

The following method is used to return orders from Shopify:
https://{Store_Prefix}.myshopify.com/admin/orders.json?status=any

 

That URL has the subdomain URL added to it, but is not using a parameter for the query portion of the URL “?status=any”. If we leave the URL set to this, we can’t update the status filter without changing the definition setup. Instead, we will make a new parameter called “status” and insert it into the URL like we did with the subdomain.

The {status} parameter now has a default value of “any” which will be used if we don’t change anything on the map we use it in. It is also placed into the URL so the value for the parameter will be used in the filter.

When we select that method in a map we now get the option to change and set the parameters in use:

 

Any parameter used in a method that is not marked as a Header parameter can be updated or changed within the map. In this case, we could change the value of the status being passed through to adjust the records returned.

 

2 Comments

  1. John V on October 29, 2020 at 9:17 am

    The last screen shot is missing.

  2. Sean Yildirim on January 31, 2021 at 9:00 am

    Any parameter used in a method that is not marked as a Header parameter can be updated or changed within the map. In this case, we could change the value of the status being passed through to adjust the records returned.

    This last statement, how do you pass the parameter at the map level? I want to be able to pass multiple parameters dynamically?

Leave a Comment





RECENT POSTS


Happy Thanksgiving from eOne! - US Office Closed November 25 & 26
Popdock: What is your Locale?
Q4 2021 Partner All Hands Call - Recording Now Available
An Announcement regarding SmartList Builder and SmartView from eOne Solutions
Join us for the Q4 2021 Partner All Hands Call!

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 partners Popdock release Reporting 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.