Since SmartConnect 2015 we’ve been able to connect to a variety of REST services using the REST connector. This requires the service to provide a JSON or XML payload. I recently came across a service that doesn’t use JSON or XML. The GoToWebinar Admin API will only give back an Excel file, so I could not use the built-in REST connector in SmartConnect. The REST service essentially gives you the same file as if you logged into the GoToWebinar interface and manually exported the data you need. Using the REST service to automatically go pull down the latest Excel file will eliminate the need to manually go create an excel file when you need to run a map.
Since the current REST connector in SmartConnect will not handle this response we will have to write a pre-map task script to call the web service and save the Excel file. The following vb.net script will connect to the GoToWebinar Admin API, but you could modify it to connect to any web service that provides an Excel file. This web service only requires the Authorization parameter, but other services may require additional parameters to take into consideration.
You will need to provide your Authorization Token, Account Number, from and to dates (in Epoch milliseconds), and export path/name for the script to work correctly with your data. When the pre-map task script is properly setup it will look similar to this:
With the script in place, you can now continue the map setup and will be able to choose this Excel file as the source for the map. Note: You will need to have a placeholder Excel file to choose as a source file if this will be the first time setting up the map since the file from the pre-map task will not be available until the map is actually run.
This should get you started with a web service that returns an Excel file response. In this particular example, I would recommend using a couple global variables for the from and to dates that are calculated before this pre-map task. This will prevent the need to change the dates in the script for future use and make it more dynamic.