This document describes a simple set up for retrieving data from an HTTP endpoint, splitting the given data, changing the split data and sending it to another HTTP endpoint.
To set up a simple connector httpbin.org is a simple resource to prove core features of Alumio. This document describes a simple set up for retrieving data from an HTTP endpoint, splitting the given data, changing the split data and sending it to another HTTP endpoint.
Scenario
A webservice offers slideshows which holds slides which need to be imported slide by slide into another webservice. The slideshow data is too rich for the destination, which does not accept “type” as an element for the data. Furthermore, it has incompatible data with the destination (“title” should be called “name”).
Step by step
To create a basic route in Alumio which connects with httpbin.
- Log in to Alumio, e.g.: https://admin.alumio.com/yourenvironment
- Create an incoming configuration
- Go to the Connections > Incoming page
- Click the + button on the Incoming page
- Enter a name: Slides from httpbin
- Specify a subscriber: HTTP Subscriber
- Enter the request URI: https://httpbin.org/json
- Specify the HTTP Client: Default client
- Add a transformer (click on the + Add transformers button)
- Specify a transformer: Get branches from a pattern
- Enter a pattern: slideshow.slides.*
- Press the Save button
- Create an outgoing configuration
- Go to the Connections > Outgoing page
- Click the + button on the Outgoing page
- Enter a name: Slides to httpbin
- Specify a publisher: HTTP Publisher
- Enter the request URI: https://httpbin.org/anything
- Specify the HTTP Client: Default client
- Press the Save button
- Create a route
-
- Go to the Connections > Routes page
- Click the + button on the Routes page
- Enter a name: Slides from httpbin to httpbin
- Specify an incoming configuration: Slides from httpbin
- Specify an outgoing configuration: Slides from httpbin
- Press the Save button
-
Now a basic route has been set up to retrieve data from httpbin and send it back.
Execute the route
To execute the route, please follow these steps:
- Go to the Connections > Incoming page
- Click the Run button of the Slides from httpbin incoming configuration
- Go to the Connections > Routes page
- Click the Run button of the Slides from httpbin to httpbin route
- Go to the Tasks page (and clear possible filters)
- Select the task matching the route to view its details
Apply data filters filters
To add a data filter to this route, please follow these steps:
- Go to the Connections > Transformers page
- Click the + button on the Transformers page
- Enter a name: Slides data filter
- Enter a description: Filters 'type' from data
- Specify a Prototype (dropdown under Settings): Data, transform data using mappers and conditions
- Add a transformer (click on the + Add transformers button)
- Specify a transformer: Key filter
- Specify an accessor: Pattern accessor
- Enter a pattern: *
- Add a condition (click on the + Add conditions button)
- Specify a condition: Equals
- Specify the Value type (click the dropdown): string
- Enter a value: type
- Press the Save button
- Go to the Connections > Incoming page
- Go to the Incoming configuration page of Slideshows from httpbin
- Scroll down and click the + Add transformers button
- Specify the transformer: Slides data filter
- Press the Save button
Add the data mapper to the route
To add a data mapper to this route, please follow these steps:
- Go to the Connections > Transformers page
- Click the + button on the Transformers page
- Enter a name: Slides data mapper
- Enter a description: Maps 'title' to 'name'
- Specify a Prototype (dropdown under Settings): Data, transform data using mappers and conditions
- Add a transformer (click on the + Add transformers button)
- Specify a transformer: Key mapper
- Specify an accessor: Pattern accessor
- Enter a pattern: *
- Add a mapper (click on the + Add mappers button)
- Specify a mapper: Dictionary map
- Add a map (click on the + Add map button)
- Specify the Value types (click the dropdowns): string
- Enter the first value: title
- Enter the second value: name
- Specify a comparator: Equals
- Press the Save button
- Go to the Connections > Incoming page
- Go to the Incoming configuration page of Slideshows from httpbin
- Scroll down and click the + Add transformers button
- Specify the transformer: Slides data mapper
- Press the Save button
The following data is assumed to come from http (copy this):
{
"title": "Wake up to WonderWidgets!",
"type": "all"
}
This data is also available from the task detail page for any task of this route. It can be found under the entity data tab.
Test a Transformer
To test the transformers without running parts of a route, please follow these steps:
- Go to the Incoming > Transformers page
- Select either Slides data filter or Slides data mapper
- Paste the copied data in the top right text area
- Press the Test button
- Notice the changes in the data (type removed in Slides data filter, title renamed to name in Slides data mapper)
Explaining the data which is incoming
Data from https://httpbin.org/json
{
"slideshow": {
"author": "Yours Truly",
"date": "date of publication",
"slides": [
{
"title": "Wake up to WonderWidgets!",
"type": "all"
},
{
"items": [
"Why <em>WonderWidgets</em> are great",
"Who <em>buys</em> WonderWidgets"
],
"title": "Overview",
"type": "all"
}
],
"title": "Sample Slide Show"
}
}
Questions and answers
- What is an Accessor?
It allows Alumio to find data that is supposed to be addressed with transformers and other objects. - What is an Accessor pattern?
It is a method to find any number of data points in the given data. An * (asterisk) is a wildcard when used in patterns and is used to find any data points in the structure. - What is a Mapper?
It translates a given value to another based on the configuration supplied. In the example above it translates the ‘title’ field to ‘name’. - What is a Data filter?
It filters data points which match the given configuration. In the example above it removes the ‘type’ field from the data set. - What is a Filter?
A filter will prevent a task from being created when it matches the logic given to it. Using the slideshows as an example, it would be possible to filter slides that hold the ‘type’ field in the data. - What is the "Get branches from" a pattern transformer?
It is used to split the slideshow data into several slide tasks, so it is possible to create multiple tasks from one data set. - How does this read/write data from/to a SOAP/REST/OpenAPI/etc. service?
The incoming and outgoing configuration can be used to connect to different services. Now a simple HTTP client is configured for both sides, but it can be exchanged for something else. From databases to SOAP services, Alumio has many elements that can be configured using generic elements.