If you want to connect an external system like an MES or ERP to Tulip, you will need to use an HTTP connector.

Within an HTTP connector, you can write a series of functions that will run common types of HTTP requests using predefined inputs. Options include:

  • GET
  • HEAD
  • POST
  • PUT
  • PATCH
  • DELETE

Here are all your options for writing functions within Tulip.

Modifiable Fields

You can customize your HTTP request with these options:

  • Authentication (none, Basic Auth, OAuth 2)
  • Request Headers
  • Query Parameters
  • Request Body (JSON, Form URL-Encoded or Plain Text)
  • Response Body (JSON or XML)

Creating A Connector

Click the "Add Connector" button in the top right of the Connectors page, then name the Connector and select 'HTTP".

Then, you will see the Environments tab. If you want to set up multiple environments, see this separate guide.

Then, after selecting your Connector, choose "Add Connection Details" to add more details about the server you would like to query.

There are 5 options.


Running On:
Most Tulip users should choose "Cloud Connector Host". If you are running Tulip on premises, refer to this guide on connector hosts.

Host: Only include the domain that you would like to query. Do not include http:// or https:// Eg. myaccount.restlet.api.netsuite.com

Port: This should be specified by the service you are querying. HTTP requests typically use port 443.

TLS: Select "Yes" if you are using HTTPS, and "No" if just "HTTP".

Click "Test" to see if you can successfully connect to the server, then click "Save".

To duplicate or delete the connector, go back to the Connectors page, and then click the three dots on the right side of the specific connector. 

Creating a Function

Click the "Add New Function" button on the Functions tab to create a new function.

You will then see a series of options for editing your function.

First, name the function in the top left of the page.

Then, click "Add Function Inputs" to begin adding inputs. Example:

If you want to test your HTTP connector function, add a "Test Value" for each input.

Then, add an endpoint to the end of the URL and choose the type of HTTP request.

Select "Query Parameters" to begin adding key/value pairs. Use your defined Inputs in the "Value" field. 

Add a $ before and after the Input name, for example, if the input name is "city_name", type in $city_name$.

Handling Responses

After you are satisfied with your inputs and outputs, select "Test" in the top right corner to create a sample response.

You will see a JSON or XML response in the "Test Results" section. Now, you can map parts of this response to "Outputs" and then use them in apps.

JSON extractors use the json-query syntax. To test the syntax, use this online tool.

XML extractors use XPATH syntax.

There are two ways to do this:

  1. Click on properties in the body of the response to map them to outputs
  2. Manually specify the path using JavaScript

Here's how to specify the extractors using point and click:

If you want to use JavaScript, add a few outputs so you can map the contents of the response to Tulip.

Next, you will need to specify "extractors" next to each output to indicate the data from the body of the response that you would like to store.

Here's an example with JavaScript. let's say that you write a GET request that returns an array of objects. You want to return the value of the name property from the first object in the array.

This is what you would write in the path field:

0.name 

You can also store values from the "Headers" and "Cookies" section of the response.

Similar to the section above, you must specify a specific output in the "Output" section. Then, click on a part of a sample response or use JavaScript to access the correct property from the JSON in the HTTP response.

Here is an example where an output named "csrf_token" stores the value called "x-csrf-token" from the property in the header.

Outputs are stored as properties of an object when they are shared with an app. You must then store the object in a variable in an app. For more details, see this guide to using connector outputs with apps.

Using RegEx To Modify Outputs

You can also use RegEx to refine text values from the response. To do this, add one of these functions in the "Path" field to pass the value through a regular expression:

:regexp()

To capture multiple substrings within the string-

:regexpGroup()

Examples:

0.name:regexp(^N)
0.name:regexpGroup(^\w + (w+))

Using RegEx group, you may want to capture a single group within a larger string. To do this, add a comma to the end of your RegEx string and add the number of the specific group within the string.

parts[0].inputs:regexpGroup(^\w\w\s(\w\w)\s(\w\w)\s(\w\w),2)

Or, use it to select a specific item in an array that matches a rule. For example, the first object with an email value that starts with n.

.[email:regexp(^N)]

We recommend RegExr to test your RegEx. Tulip uses the JavaScript (ECMA) RegEx engine.

Past Integrations

Tulip can integrate with a variety of software systems. Here's a few examples of systems that have been integrated into Tulip in the past:

Further Reading

Did this answer your question?