Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
The first stage of adding a new system is to provide basic details - these determine how your system will be presented throughout Patchworks,
Step 1 Having launched the connector builder, the basic details page is displayed - this is where you provide a name and other general details for your new connector:
Complete fields on this page using the table below as a guide:
Enter a name for your new system
Enter a version for your new connector
Enter version information for this connector - for example: Version 1 - 28th July 2023.
Enter a description for your new system
Select system type
Select protocol
Upload an icon
.jpg
.gif
.png
.svg
Note: Images must be square and the file size cannot exceed 10MB.
Primary colour
Step 2 Having entered all required details, click the next step button for connector variables.
This name is displayed for this system throughout Patchworks - for example, in the .
Enter a description to provide a bit more information about this system. Text entered here is displayed beneath the connector title, whenever it is displayed in the system. For example:
Choose the required system type (e.g. eCommerce, ERP, Warehouse) from the dropdown list. The selected system type may determine what options are prompted subsequently. It's also used to categorise this connector.is displayed in the for this system.
Choose the appropriate protocol for your connector protocol. For a REST or SOAP API, the protocol will be HTTP
.
Upload an icon to be displayed for this system throughout Patchworks - for example, in the and in the connector wizard when a connector is added for this system. The following image file types are supported:
Use the colour picker to select a background colour for your icon. This can be used to ensure that all of your connector icons are displayed in a consistent form:
With Patchworks, you can install and then use instances of prebuilt connectors, which are available from the Patchworks marketplace.
But what if there is no prebuilt connector for a business application that you want to integrate? Maybe you have a bespoke, in-house system - or perhaps you want to connect an application that's completely outside of the eCommerce arena.
The Patchworks connector builder enables you to build your own connectors, which can then be used in exactly the same way as the prebuilt connectors found in the Patchworks marketplace.
Any connectors that you build will be available to all users within your company profile. They are not visible to anyone outside of your organisation.
The connector builder is designed to take away as much of the heavy lifting required to integrate systems from scratch, as possible - no coding is required!
If you're comfortable working with APIs and data structures, you can use the connector builder to integrate any application with an API.
If you know your way around Postman, we think you'll get on just fine with the connector builder. In fact, if you have a Postman collection for the connector you want to build, you can use our Postman importer! This will create a connector directly from your collection, which you can then edit (using information found in this section) as required.
The connector builder walks you through a series of configuration pages so you can complete all required setup that's needed to make your connector available in Patchworks.
Once your connector is built, it is displayed in the Patchworks marketplace, so users associated with your company profile can add instances of it.
Prebuilt connectors must be installed before instances can be added for them. However, when you build your own connector it's automatically installed, ready for instances to be added.
Before you start work with the connector builder, make sure that you have the API documentation to hand for whichever third-party application you're building.
We also recommend that you fire up Postman, so you can test any API requests that you're adding to the connector builder.
As you step through the connector builder, you are prompted to complete the following configuration steps.
Make sure that you have the API documentation to hand for whichever third-party application you're building!
The Patchworks marketplace includes a curated range of prebuilt connectors for you to browse, install and update. If the system that you need to integrate isn't listed, you can access the connector builder from here.
Step 1 Log into Patchworks and select connectors & instances from the left-hand navigation menu.
Step 2 Select the add new connector button at the top of the page:
Step 3 The connector builder is launched, ready for you to get started!
We need to tell Patchworks what authentication methods can be used when someone chooses to , for use in .
Any authentication methods added here will be available to users when they choose to add an instance of this connector - for example:
Patchworks supports the following authentication types:
Please see for general steps required to add a new authentication method for a connector.
You'll find detailed information about options and settings in the section, and step-by-step examples for each type in the section.
URL parameters are used to apply queries/filters to the authentication request URL:
Any parameters added here are appended to the authentication URL as a query.
In reality, it's unlikely that URL parameters will be commonly used when defining authentication methods however, you can absolutely add them if needed.
URL parameters are added as 'key pairs' - so you specify a 'key' (a valid field name for this API) and then the required value.
A URL parameter value can be static - for example:
In this case, the value would be appended to the request endpoint as a URL query with the value exactly as it is defined - for example:
A URL parameter value can be dynamic, using auth variables that you've previously defined for the authentication method. In the example below, we have an auth variable named warehouseID:
So, when a user adds an instance of this connector, they are asked to provide a value for this field - for example:
...and when a process flow runs for this connector, associated API requests are injected with this value wherever a {{warehouseID}}
variable is found. So, if we've added this variable in a URL parameter, as below:
...the resulting API request would include a parameter for whatever Warehouse ID
the user entered when the instance being used was created.
Please refer to the API documentation for your underlying third-party application to find parameters that can be passed in authentication requests.
URL parameters are added as key pairs. To add a URL parameter, follow the steps below:
Step 1: Click the add new parameter button:
Step 2: Complete key pair details as required:
The add option page is the same for all types of parameters that you may encounter in the connector builder. For information about these options please see the Working with parameters page.
For guidance on configuring parameters for specific authentication types, please see our Supported authentication types section.
Step 3 Click the save button.
URL parameters are standard key pairs - techniques for working with these parameters are the same as those for working with header parameters, body parameters, etc. For more information about these techniques, please see the Working with parameters page.
The connector builder supports a range of authentication types. Before a connector can be used (i.e. before instances of it can be added for use in process flows) you must add at least one authentication method for your connector.
The steps and settings required will vary depending on which authentication type you choose to configure, but the general process is straightforward.
Please refer to your API documentation for specific authentication requirements for your own third-party application.
General steps are provided below, with links to detailed guidance for each of our supported authentication types.
Step 1 Click the add new authentication method button:
Step 2 You're prompted to enter some basic details for this authentication method:
Complete these details using the table below as a guide:
Enter a name
Enter the name to be displayed for this connector throughout Patchworks.
Select authentication type
Use the dropdown list to select the required authentication type. The selection made here determines subsequent settings and default options.
Step 3 Click the create button to confirm your updates. Basic details are saved and additional setup options are displayed over a series of 'metro stop' tabs - for example:
Step 4 Step through each tab and set configuration options as appropriate for your chosen authentication method.
For any authentication method, the following configuration options are available:
The auth variables tab is used to define authentication variables for any values that you need users to provide when they choose to add an instance of this connector, for use in process flows:
Here, you define what fields a user will be asked to complete when they choose to add an instance, select and authentication method, and provide credentials. For example:
You also define how any provided values are passed in authentication requests - i.e. are they included in the API request URL, the header, or the body?
Having chosen an authentication method to configure, any required variables for that method are listed by default - for example:
These are variables that are always required to authenticate using this authentication method. You can't remove or change the behaviour of these variables, but you can change the display name if required.
The display name is the name that users will see for this variable field, when they are adding an instance of this connector.
Default auth variables are pre-configured to be passed into API requests as needed. For example, token-based authentication has one default parameter, which is pre-configured on the header tab. If your requirements are different, you can change how/where these variables are used.
To add an auth variable, follow the steps below:
Step 1 Start by selecting the connector variables tab to check if there are any instance-level variables for this connector that you want to include. Any variables defined for the instance as a whole are shown here - click the use button for any that you wish to include as an auth variable - for example:
When you choose to use a connector variable, you'll see that it gets added to the auth variables tab - for example:
Step 2 Back in the auth variables tab, you can now add any other variables for information that you need to provide when they add an instance of this connector with this authentication method. To do this, click the add variable button:
Step 3 Complete details and set options on the add variable page:
The add variables page is the same for all types of variables that you may encounter in the connector builder (for information about these options please see the Working with variables page). However, it's worth noting the effect of setting required and configurable by user options in the context of auth variables:
When you add an auth variable and choose to make it required, you are effectively saying: 'When a user adds an instance of this connector, do not allow them to proceed without providing a value for this variable'.
When you add an auth variable and choose to make it only configurable by users, you are effectively saying: 'When a user adds an instance of this connector, allow them to provide a value for this variable if they have one but if they don't, let them proceed'.
Step 4: Click the save button.
Step 5 Having added a variable, make sure that you go on to define how any values captured for it should be passed in API requests. Typically, any user-provided variable that you define here would then be added to the authentication request URL path, authentication request URL parameters, the authentication request header, or the authentication request body for the authentication method.
If you add auth variables which require user-provided values but don't go on to add them to the authentication method's request URL path, header, or body the result will be that users are prompted to provide these details (if you chose to display these variable fields to users), but no action will be taken with that information.
Default auth variables (i.e. those which are displayed as soon as you add a new authentication method) are pre-configured to be passed into API requests as commonly needed. For example, token-based authentication has one default parameter, which is pre-configured on the header tab. You can change where these are passed if needed.
In the Patchworks connector builder, variables must be defined in double curly brackets.
The connector variables tab displays any i that you defined in - for example:
If you want to use any of these variables in this authentication method, click the use button:
This copies the variable into the auth variables tab - for example:
If you choose to use a connector variable- i.e. to copy it to the auth variables tab - but later change your mind - you can remove it by clicking the associated trash icon on the auth variables tab - for example:
This clears the connector variable from the auth variables tab but the original 'shared' connector variable remains available for future use.
Any key pairs added to the body tab are passed into the request body for authentication requests - for example:
By adding these as key pairs to the body, we pass any values provided for these fields in the authentication request body.
Please refer to the authentication section of your API documentation for specific guidance about what (if any) values need to be passed in the authentication body.
Body parameters are added as key pairs. To add a body parameter, follow the steps below:
Step 1: Click the add new required body parameter button.
Step 2: Complete key pair details as required and save changes - for example:
Any key pairs added to the header tab are passed into authentication request headers - for example:
By adding these as key pairs to the header, we pass any values provided for these fields in the authentication request headers.
You should refer to the authentication section of your your API documentation for specific guidance about what (if any) values need to be passed in authentication request headers. For example, in Shopify, it's noted that we need to send two values in the request header - Content-Type
and Shopify-Access-Token
:
When an authentication method is applied for an endpoint, any header/body parameters specified for the authentication method are also sent in the endpoint requests.
Header parameters are added as key pairs. To add a header parameter, follow the steps below:
Step 1: Click the add new header button:
Step 2: Complete key pair details as required and save changes:
From here, the variable is treated like any other - you will need to set options to determine if/how this variable is displayed to users, and how any values for it should be passed in API requests for authentication.
In this example, we need to pass a number of credentials for OAuth 2 authorisation into the body. Notice that the values in this example are defined as variables. We've already defined for these items, which means users will be prompted to enter these details when of this connector for use in . So, required body parameter values will use values that users have provided when the instance being used was created.
The add option page is the same for all types of parameters that you may encounter in the connector builder. For information about these options please see the page.
For guidance on configuring parameters for specific authentication types, please see our section.
Body parameters are standard key pairs - techniques for working with these parameters are the same as those for working with header parameters, URL parameters, etc. For more information about these techniques, please see the page.
In this example, we've already defined two for username and password, so users will be prompted to enter these details when of this connector for use in .
How we then pass this information into API requests is determined by the API documentation for the underlying third-party application. Often, these details are passed in request headers, but sometimes it will be via the request .
The add option page is the same for all types of parameters that you may encounter in the connector builder. For information about these options please see the page.
For guidance on configuring parameters for specific authentication types, please see our section.
Header parameters are standard key pairs - techniques for working with these parameters are the same as those for working with body parameters, URL parameters, etc. For more information about these techniques, please see the page.
Pre-request scripts allow you to modify authentication request parameters before sending the actual request. You can set dynamic values, compute signatures, or add headers based on specific conditions.
For example, you may have a third-party application which only accepts user passwords which are base 64 encoded. Expecting your users to know how to encode their password when they need to add connector instance for this application isn't always realistic, so a pre-request script can take care of this automatically.
Let's use the example scenario above to break down how pre-request scripts work:
A custom script should be created which takes a given password and performs base 64 encoding.
This script is applied to the pre-request script tab for the appropriate authentication method.
A user chooses to add an instance using this authentication method, and enters their username and password. Typically, an authentication request would be sent at this point - but NOT if a pre-request script is associated with the authentication method.
The pre-request script defined for this authentication method runs - any required values from authentication variables provided by the user are taken to manipulate the authentication request body as needed.
The authentication request is sent to to the given endpoint, including the manipulated body content.
Once the script has run, the authentication request is made, including the encoded password.
Both pre and post request scripts have an expected format, where the input expects two different keys:
payload
- most commonly used, and contains the payload for the script.
variables
- contains all authorisation variables, together with a hidden {{token}}
variable (which is created after the authentication request is sent).
Any script that you want to apply must first be created as a custom script.
Step 1 Select the pre-request script tab for your authentication method:
Step 2 Click in the select a script field and choose the script that you want to use - for example:
Step 3 Choose the script version that you want to use:
Step 4 Now you can review the script code to be applied and save changes:
If you need to change the script code, this should be done in the custom scripts area, then the updated script must be deployed.
Post-request scripts are useful for manipulating the response data before displaying or using it. You can extract specific values, format data, or even perform calculations. This helps in preparing the response data for further requests, or for displaying in a more user-friendly manner.
For example, we might have a connector which expects API requests to be authenticated with a {{token}}
value received in response to an authentication request. However, suppose that the authentication request response includes the required token value AND a client_id value in the same detail
field - somehow we need to ensure that only the token element is injected into a {{token}}
variable, to be used for authenticating subsequent API requests.
To achieve this, we could create a custom script to extract the the token element from the detail
field and then apply this to the post-request script tab for the required authentication method.
Let's use the example scenario above to break down how post-request scripts work:
A custom script should be created which extracts the token element of the detail
field and applies this as the {{variable}}
value.
This script is applied to the post-request script tab for the appropriate authentication method.
A user adds an instance using this authentication method, and enters their username and password.
The authentication request is sent and a successful response is returned, with client id and token values in the same detail
field.
The post-request script defined for this authentication method runs, extracting the token element from the detail
field and injecting it into the {{token}}
variable for the authentication method.
Both pre and post request scripts have an expected format, where the input expects two different keys:
payload
- most commonly used, and contains the payload for the script.
variables
- contains all authorisation variables, together with a hidden {{token}}
variable (which is created after the authentication request is sent).
Any script that you want to apply must first be created as a custom script.
Step 1 Select the post-request script tab for your authentication method:
Step 2 Click in the select a script field and choose the script that you want to use - for example:
Step 3 Choose the script version that you want to use:
Step 4 Now you can review the script code to be applied and save changes:
If you need to change the script code, this should be done in the custom scripts area, then the updated script must be deployed.
Basic authentication is the simplest (though not the strongest) method for authenticating API requests.
With basic authentication, a username and password are sent in the HTTP header of each API request, to authenticate a client application (in this case, Patchworks) and grant access to the associated resource.
Be aware that username and password are just labels for two pieces of information that must be provided in the header to authenticate API requests with basic authentication.
Some third-party applications WILL look for a username and password but others may require something else - for example, application id and API key. This is fine - it’s still basic authentication - we just need to configure basic authentication variables to use different display labels.
Here's how basic authentication works:
The client-server (i.e. Patchworks) sends an API request to the required third-party application server (e.g. Shopify). The request includes username and password authentication credentials in the HTTP header of the request, encoded in Base64 format.
Upon receipt of the request, the third-party application server extracts authentication credentials from the header. It then validates these credentials by comparing them with the stored user credentials in its own system/database.
If the credentials provided are valid, the third-party application server grants access to the requested resource. If the credentials are invalid or missing, the third-party application server denies access and returns an appropriate error response.
When a Patchworks user adds an instance of a connector and chooses to authenticate with basic authentication, they will see something similar to the example below:
It can be useful to compare how existing connectors have been configured for token-based authentication. The Patchworks marketplace includes many connectors that are configured to use this authentication type - a few examples are linked below:
You can install any of these for comparison.
This page walks through the steps required to configure token authentication for a connector.
Here, we're using Shopify as an example. General principles will be the same for any system that supports this authentication method but please refer to your own API documentation for specific setup requirements.
For this task, we'll be using techniques described in previous connector variables and authentication method options sections - we advise getting familiar with these before attempting the steps detailed here.
Ensure that you have API documentation to hand, for your third-party application (we're using Shopify as an example).
Ensure that you have all the required credentials for testing.
We recommend using Postman to test any authentication methods that you're adding for a connector.
Step 1 Check the API documentation for the third-party application that you're using - confirm that token authentication is supported and for any special requirements. Looking at the authentication section in Shopify's API documentation, there are three key points to note:
Whilst OAuth is the authentication method used to generate tokens when Shopify custom apps are installed, we've retrieved our generated token from the Shopify admin portal and will use this to set up token-based authentication.
We must pass our token into request headers, via a parameter called X-Shopify-Access-Token
.
All requests must include a store_name
value.
Step 2 Log in to the Patchworks dashboard and navigate to process flows > connectors & instances, where all your installed connectors are shown. From here, access settings for the connector that you need to update with a new authentication method - for example:
If you're building a new connector, you can pick up these steps when you reach the authentication section of the connector builder.
Step 3 Access authentication details:
Step 4 Click the add new authentication method button:
Step 5 Complete basic details for this authentication method - ensure that you set the authentication type to token-based and enter the required URL from your API documentation. Click the create button when you've finished, for more configuration options - for example:
Step 6 By default, the token-based authentication type includes one required auth variable - token:
These are known variables that a user must provide to authenticate an instance of this connector using this authentication method. Mandatory variables are locked however, you can change the display name if required.
If required, you can add more auth variables here.
Some APIs are case-sensitive when it comes to adding variables - be sure to enter key names exactly as they are specified in API documentation.
Step 7 Now we need to define where information that users provide for these fields should be injected into the authentication requests.
Commonly, tokens are passed into request headers - as such, a default authorisation option is ready to use:
You can edit this option as needed - or remove it from the header altogether if your API documentation requires an alternative approach for passing in tokens.
At the very start of this exercise, we noted that our Shopify token must be passed into request headers via a parameter called X-Shopify-Access-Token
. So, we can edit the default authorisation option to reflect this:
We leave the value set to {{token}}
, so when a user adds an instance of this connector using token-based authentication and provides a valid token, the value they provide will be injected into this variable and passed in the request header:
Don't forget to save any changes that you make.
Step 8
Remember that at the very start of this exercise, we noted that a store_name
value must be passed in the URL for all Shopify API requests. To achieve this, we need to ask users to provide a store_name
value when they add an instance of this connector using token-based authentication (in addition to the token value we defined earlier).
We already have a store_name
connector variable defined, so we can choose to 'use' it as an auth variable for token-based authentication:
To do this:
Click the connector variables tab.
Click the use button associated with the variable we want to use for our new authentication method.
That variable is added to token-based authentication as an auth variable.
Step 9 This completes our setup for token-based authentication. Now, when a user adds an instance of this connector and chooses to use this authentication method, they are prompted to provide all required/configurable authentication variables (in our example, store name and token).
When configuring a process flow connection shape to use a given instance, you can choose from a list of available endpoints. For example:
This list will only include endpoints for which the same authentication method is enabled, as was used to add/authenticate the selected instance.
So, having added a new authentication method, you must enable it for any connector endpoints that you might want to use with instances that are added using this authentication method.
A variable is a value that can change, depending on conditions or information supplied by the user. Using the Patchworks connector builder, variables can be defined at different levels:
Endpoint variables are displayed as fields for your users to complete whenever they configure a process flow connection shape to use an associated endpoint.
The variables tab for a connector is used to define connector instance-level variables :
Users are prompted to provide values for these variables when they add and authenticate an instance of this connector. These values are then applied wherever this instance is used in process flows.
Any variables defined here are available for use when you move on to define authentication methods for your connector.
If you choose to use one of these variables in an authentication method, the result will be that your users are asked to provide a value for this field when they add an instance of this connector, with the associated authentication method.
Any value that the user provides during instance creation will be used whenever this instance is selected for use in process flows.
When a process flow runs (i.e. when API calls associated with selected endpoints for this instance are made), Patchworks grabs all defined variables and then injects them where a corresponding {{variable}}
is found.
In the Patchworks connector builder, variables must be defined in double curly brackets.
A great example of where defining an connector instance-level variable here is useful, can be found in the Shopify API. For any API request, Shopify requires a given store_name
- for example:
All API calls that users might want to use in process flows are added to the Shopify connector as endpoints. So, when a user configures a connection shape in a process flow and selects a connector instance to use, they will have a list of endpoints associated with the selected instance to choose from - for example:
Whilst you COULD ask your users to enter the appropriate store name whenever they select an endpoint (via an endpoint variable), this would be inefficient, and open to error.
A more efficient, reliable approach is to define a required {{store_name}}
variable at the instance level. In doing so, the appropriate store name would be entered just once when an instance of this connector is added - for example:
The value provided here is injected into any {{store_name}}
variables found when this instance is used subsequently, in process flows.
If two variables with the same key are defined in two different places, we also prioritise them in connector
-> connector instance
-> endpoint
order.
For example, if you define a {{store_name}}
variable in an authentication method for a connector and then another {{store_name}}
variable on an endpoint, the endpoint value would take precedence.
To add new system variables, follow the steps below:
Step 1 Click the add new system variable button:
Step 2 Complete fields on the add variable page - for example:
The add variables page is the same for all types of variables that you may encounter in the connector builder. For information about these options please see the Working with variables page.
For guidance on configuring variables for specific authentication types, please see our Supported authentication types section.
Step 3 Click save to add this variable to the variables list - for example:
Step 4 Repeat steps 2 and 3 for all required variables.
Step 5 Click next for authentication methods, where you can choose to use these variables, if needed.
Token-based authentication allows users to verify their identity with a third-party server using a token. This is a more secure approach than basic authentication because username and password credentials are never passed in API requests.
Token-based authentication works by authenticating with a token that you already have available - perhaps it was given to you by a third-party application provider, or you have generated a token from the API - it doesn't matter how you obtain the token.
If you'd like more detailed information about how Token authentication works, there's some great background information on the Postman website.
When a Patchworks user adds an instance of a connector and chooses to authenticate with token-based authentication, they will see something similar to the example below:
It can be useful to compare how existing connectors have been configured for token-based authentication. The Patchworks marketplace includes many connectors that are configured to use this authentication type - a few examples are linked below:
You can install any of these for comparison.
This page walks through the steps required to configure basic authentication for a connector.
Here, we're using as an example. General principles will be the same for any system that supports this authentication method but please refer to your own API documentation for specific setup requirements.
For this task, we'll be using techniques described in previous and sections - we advise getting familiar with these before attempting steps detailed here.
Ensure that you have API documentation to hand, for your third-party application.
Ensure that you have all required credentials for testing.
We recommend using to test any authentication methods that you're adding for a connector.
Step 1 Check the API documentation for the third-party application that you're using - confirm that basic authentication is supported, and for any special requirements.
For our example, we can see that basic authentication is permitted and that we need to pass consumer_key as the username and consumer_secret as the password:
If you're building a new connector, you can pick up these steps when you reach the authentication section of the connector builder.
Step 3 Access authentication details:
Step 4 Click the add new authentication method button:
Step 5 Complete basic details for this authentication method - ensure that you set the authentication type to basic and enter the required URL from your API documentation. Click the create button when you've finished, for more configuration options - for example:
If your API documentation requires users to provide an actual username and password to authenticate this connector, these can be left as they are. However, many APIs expect alternative information to be passed as these fields.
As such, we need to rename the default username and password fields. To do this, click the field name and update the display name as appropriate - we do this for both username and password:
Some APIs are case sensitive when it comes to adding variables - be sure to enter key names exactly as they are specified in API documentation.
Step 7 With username and password fields renamed (or not) as required, we now need to define where any information that users provide for these fields should be injected into the API request. For basic authentication, these details are always passed in request headers.
To set this up, click the header tab, followed by the add new header button.
Step 8 You can now enter your authentication options as key pairs:
Here, the key is the name of the parameter that you're passing in as the username / password, as defined in the API documentation for your third-party application. Taking our example, we know that the consumer_key is required for username and consumer_secret is required for password:
So, our key pair for username would be defined as follows (injecting consumer_key
information into the {{username}}
variable:
And our key pair for password would be defined as follows (injecting consumer_secret
information into the {{password}}
variable:
This list will only include endpoints for which the same authentication method is enabled, as was used to add/authenticate the selected instance.
The OAuth 2 authorisation code flow requires a user (in this case, a Patchworks user, for use in ) to log into an authorisation server and grant permission for Patchworks to access the required data.
When a Patchworks user and chooses to authenticate with OAuth 2 (authorisation code) they are directed to the authorisation server for a third-party service, where they log in and 'allow' requested access. A sample user journey for NetSuite is shown below:
Here, we:
Add an instance and confirm credentials.
Are redirected to NetSuite, where we log in.
Are presented with information about what access is being requested, and choose to proceed.
Return to the Patchworks connector page, where our new NetSuite instance is added and ready to use in process flows.
When setting up OAuth 2 (authorisation code) authentication, two URLs are required. The first (URL) is the authentication endpoint and the second (Additional URL 1) is the authorise endpoint.
The following example is for a NetSuite implementation - please check your API documentation for your own required values:
When specifying redirect URIs for OAuth 2, the following values can be used:
It can be useful to compare how existing connectors have been configured for OAuth 2 (authorisation code) authentication. The Patchworks marketplace includes many connectors that are configured to use this authentication type - a few examples are linked below:
You can install any of these for comparison.
The OAuth 2 client credentials flow allows client applications (i.e. Patchworks) to authenticate and obtain access to resources, without involving specific user intervention.
The exact mechanism used for client credentials authentication depends on the implementation of the authorisation server for the system in question, but a common mechanism is client secret.
This is where a client application (in this case, Patchworks) authenticates itself by sending its unique client identifier and client secret to the authorisation server, and receives a token in response.
If you'd like more detailed information about how OAuth 2 client credentials authentication works, there's some great background information on the .
It can be useful to compare how existing connectors have been configured for OAuth 2 (client credentials) authentication. The Patchworks marketplace includes many connectors that are configured to use this authentication type - a few examples are linked below:
You can install any of these for comparison.
Connector instance variables defined here can be used when you . If you're defining multiple authentication methods which share common variables, define them once here and then choose to 'use' them in subsequent authentication methods.
Auth variables (whether added directly or picked up and 'used' from predefined connector instance variables) are displayed as fields for your users to complete whenever the associated authentication method is used to .
Step 2 Log in to the and navigate to process flows > connectors & instances, where all of your installed connectors are shown. From here, access settings for the connector that you need to update with a new authentication method - for example:
Step 6 By default, the basic authentication type includes two required - username and password:
These are known variables that a user must provide to using basic authentication. You can also add more if required.
Taking our example, the states that a consumer key should be provided as the username and a consumer secret should be provided as the password:
If required, you can add more here.
Step 9 This completes our setup for basic authentication. Now, when someone chooses to for this connector, basic authentication will be an option that they can choose. If selected, the user will then be prompted to enter a username and password - or in the case of our example - a consumer key and a consumer secret:
When you configure a to use a given instance, you can then choose from a list of available endpoints. For example:
So, having added a new authentication method, you must .
If you'd like more detailed information about how OAuth 2 authorisation code authentication works, there's some great background information on the .
Production
This page is in development.
OAuth 1.0 involves the use of cryptographic signatures for message integrity and verification. It requires the consumer (in this case, Patchworks) to sign API requests using a consumer secret, which is provided by the service provider. The service provider verifies these signatures to ensure the integrity of the requests.
Patchworks supports the following signature methods:
HMAC-SHA256
OAuth 1.0 has been largely superseded by OAuth 2.0.
Here's how OAuth 1 authentication works:
1
Consumer registration
Resource owner/user
The Patchworks customer completes the consumer registration process with the third-party application service provider. During registration, the consumer obtains a unique consumer key and consumer secret.
2
User initiation
Resource owner/user
3
Token request
Consumer/client(Patchworks)
A request is sent to the service provider's token endpoint. This request includes a signature (generated by Patchworks), the consumer key, and a callback URL (where the user will be redirected after authentication).
4
User authentication
Service provider/ authorisation server
The service provider validates the request and authenticates the user. If the user is not already logged in, they are prompted to enter their credentials on the service provider's website.
5
Request token issued
Service provider/ authorisation server
After successful authentication, the service provider issues a request token, confirming approved access for Patchworks to access the user's resources.
6
User authorisation
Resource owner/user
The user is presented with a permission prompt by the service provider. The prompt explains what access the consumer is requesting and asks the user to grant or deny permission.
7
Redirect to consumer
Service provider/ authorisation server
When the user grants permission, the service provider redirects the user back to the Patchworks callback URL, together with the request token and additional parameters.
8
Access token request
Consumer/client(Patchworks)
Patchworks receives the request token and sends a request to the service provider's token endpoint, including the request token, consumer key, signature, and other necessary parameters. Note that the signature is the same signature that was used in step 3.
9
Access token issued
Service provider/ authorisation server
The service provider validates the request token and consumer credentials. If everything is OK, the service provider issues an access token and an access token secret to Patchworks.
10
Resource access
Consumer/client(Patchworks)
The consumer can include the access token in API requests to the service provider, to access the user's protected resources.
It can be useful to compare how existing connectors have been configured for OAuth 1 authentication.
Since OAuth 2 has largely taken over from OAuth 1, there aren't many examples in the Patchworks marketplace however, you will find both OAuth 1 and OAuth 2 defined for our NetSuite connector. You can install this for comparison.
This page walks through the steps required to configure OAuth 2 authentication (authorisation code flow) for a connector.
Here, we're using NetSuite as an example. General principles will be the same for any system that supports this authentication method but please refer to your own API documentation for specific setup requirements.
For this task, we'll be using techniques described in previous connector variables and authentication method options sections - we advise getting familiar with these before attempting steps detailed here.
Ensure that you have API documentation to hand, for your third-party application (we're using NetSuite as an example).
Check the documentation for your third-party application and ensure that any in-app setup required for OAuth 2 has been completed. For example, NetSuite's documentation includes a section on tasks that administrators must complete to support OAuth 2 for integrations.
Ensure that you have all required OAuth 2 credentials for testing.
We recommend using Postman to test any authentication methods that you're adding for a connector.
When specifying redirect URIs for OAuth 2, the following values can be used:
Staging
Production
Step 1 Check the API documentation for the third-party application that you're using - confirm that OAuth 2 authentication (authorisation code flow) is supported, and for any special requirements.
Step 2 Log in to the Patchworks dashboard and navigate to process flows > connectors & instances, where all of your installed connectors are shown. From here, access settings for the connector that you need to update with a new authentication method - for example:
If you're building a new connector, you can pick up these steps when you reach the authentication section of the connector builder.
Step 3 Access authentication details:
Step 4 Click the add new authentication method button:
Step 5 Complete basic details for this authentication method - ensure that you set the authentication type to OAuth 2 authorisation code and enter the required URL(s) from your API documentation.
For OAuth 2 (authorisation code) authentication, two URLs are required. The first (URL) is the authentication endpoint and the second (Additional URL 1) is the authorise endpoint. Please refer to your API documentation for these values.
Click the create button when you've finished, for more configuration options - for example:
Step 6 By default, the OAuth 2 authorisation code type includes a range of default auth variables:
These are known variables that a user must provide to authenticate an instance of this connector using this authentication method.
Consider the following when setting your client_type
parameter value:
confidential
. Setting this value means that when a second call is made to get a token, basic auth is added to the header using the client_id
and client_secret
.
public
(or any other value). Setting this value means the second request does not send authorisation in the header.
Mandatory variables are locked however, you can change the display name if required. You can also add more auth variables here if needed.
Some APIs are case sensitive when it comes to adding variables - be sure to enter key names exactly as they are specified in API documentation.
Step 7 Now we'll check to see if there are any shared connector variables that need to be used as auth variables.
In our example, we need to use the accountid
connector variable for authentication, because this is a user-provided value that forms part of our authentication request URL path (defined in step 5). So, we can simply choose to use the accountid
connector variable as an auth variable for this authentication method:
To do this:
Click the connector variables tab.
Click the use button associated with the variable we want to use for our new authentication method.
That variable is added to this authentication method as an auth variable.
Step 8 Next, we need to confirm/change where any information that users provide for auth variables should be injected into authentication requests.
Default auth variables are pre-configured to be passed into API requests, as most commonly needed. For example, if we check the URL parameters tab now, we'll see that some of our user-provided auth variables have been added automatically:
And if we check the body tab now, we'll see that remaining user-provided auth variables have been added automatically:
Check the API documentation for your third-party application and ensure that all required auth variables have been added, and are being passed in the right place. Don't forget to save any changes that you make.
Step 9 This completes our setup for OAuth 2 authorisation code authentication. Now, when a user adds an instance of this connector and chooses to use this authentication method, they are prompted to provide all required/configurable authentication variables. Upon confirmation, they will be directed to your third-party authorisation server and asked to authorise access - then redirected back to Patchworks.
When you configure a process flow connection shape to use a given instance, you can then choose from a list of available endpoints. For example:
This list will only include endpoints for which the same authentication method is enabled, as was used to add/authenticate the selected instance.
So, having added a new authentication method, you must enable it for any connector endpoints that you might want to use with instances that are added using this authentication method.
This page walks through the steps required to configure OAuth 2 authentication (client credentials flow) for a connector.
Here, we're using Shopware as an example. General principles will be the same for any system that supports this authentication method but please refer to your own API documentation for specific setup requirements.
For this task, we'll be using techniques described in previous connector variables and authentication method options sections - we advise getting familiar with these before attempting steps detailed here.
Ensure that you have API documentation to hand, for your third-party application (we're using Shopware API docs for this example).
Check the documentation for your third-party application and ensure that any in-app setup required for OAuth 2 has been completed.
Ensure that you have all required OAuth 2 credentials for testing.
We recommend using Postman to test any authentication methods that you're adding for a connector.
Step 1 Check the API documentation for the third-party application that you're using - confirm that OAuth 2 authentication (client credentials code flow) is supported, and for any special requirements.
Step 2 Log in to the Patchworks dashboard and navigate to process flows > connectors & instances, where all of your installed connectors are shown. From here, access settings for the connector that you need to update with a new authentication method - for example:
If you're building a new connector, you can pick up these steps when you reach the authentication section of the connector builder.
Step 3 Access authentication details:
Step 4 Click the add new authentication method button:
Step 5 Complete basic details for this authentication method - ensure that you set the authentication type to OAuth 2 client credentials and click the create button.
Step 6 Authentication variables are displayed. By default, the OAuth 2 client credentials type includes a range of default authentication variables:
These are known variables that a user must provide to authenticate an instance of this connector with this authentication method.
The following parameters are required for the OAuth 2 client credentials flow, and are configured to be displayed to users when they attempt to add an instance for this connector:
Scope
scope
If your API documentation does't direct you to add a specific value, leave the default value of scope
in place. The default value is displayed to your users when they choose to add an instance for this connector.
Grant type
client_credentials
If your API documentation does't direct you to add a specific value, leave the default setting of client_credentials
in place. The default value is displayed to your users when they choose to add an instance for this connector.
Client ID
None
A client id
is required whenever a user chooses to add an instance for this connector - default values are not applicable.
Client secret
None
A client secret
is required whenever a user chooses to add an instance for this connector - default values are not applicable.
Response authentication token key
access_token
If your API documentation does't direct you to add a specific value, leave the default value of access_token
in place. The default value is displayed to your users when they choose to add an instance for this connector.
In each case, you can change the parameter name, default value and settings for how the field is made available to users when they choose to add connector instances. You cannot change the parameter key
.
Step 7 Check your API documentation for any additional parameters that are required for authentication - do you need users to provide any additional information to authenticate instances of this this connector?
Some APIs are case sensitive when it comes to adding variables - be sure to enter key names exactly as they are specified in API documentation.
Step 8 Select the URL parameters tab and provide a request URL for authentication - you'll find this in your API documentation:
Also check your API documentation for any query parameters required for this URL and add them as needed.
Depending on the authentication method, you may find that some default authentication and/or other variables have been added as URL
parameters, automatically. For OAuth 2 (client credentials) there are no default URL parameters.
Step 9
Select the header tab and add any authentication variables that need to be passed in the authentication request header
- you'll find this in your API documentation:
For OAuth 2 (client credentials), a content-type
parameter is added by default, with a value of application/x-www-form-urlencoded
. Check your API documentation - if necessary you can change this value.
Step 10 Select the body tab and add any authentication parameters/content to be passed in the authentication request body - you'll find this in your API documentation.
Depending on the authentication method, you may find that some default authentication and/or other variables have been added as body
parameters/content, automatically. For OAuth 2 (client credentials) there is no defaultbody
content.
Step 11 This completes our setup for OAuth 2 (client credentials) authentication. Now, when a user adds an instance of this connector and chooses to use this authentication method, they are prompted to provide all required/configurable authentication variables.
SOAP (Simple Object Access Protocol) is a messaging protocol for exchanging structured information in a web environment. SOAP authentication is used specifically for authenticating SOAP-based web services.
The Patchworks Connector Builder incorporates token-based authentication for SOAP. When requests are made, user credentials (provided when the connector instance was created) are passed for authentication and a token is returned - tokens are incorporated into SOAP messages.
Your authentication setup will typically include variables for user credentials (e.g. username and password) and a response_authentication_token_key
(or similar) which tells Patchworks where to find a token in authentication response SOAP messages. For example:
In this example, notice that a response_authentication_token_key
field value is defined as part of the setup (because it never changes). As such we don't need to display this as a field for users to complete, so it's NOT required
, configurable
, or advanced
.
If the field you define as the location for tokens contains anything more than just the token, you'll need a POST authentication request script to strip out the token. For an example, we recommend installing the Peoplevox connector from the Patchworks marketplace and checking the setup.
When a Patchworks user adds an instance of a connector and chooses to authenticate with SOAP authentication, they will see something similar to the example below:
Required variables will vary, depending on the API but in general there will be at least fields for users to enter their credentials.
It can be useful to compare how existing connectors have been configured for SOAP-based authentication. Some examples are linked below:
You can install any of these for comparison.
DB user pass authentication is only used for building database connectors. Here, database access is authenticated with username and password over SSL (if unavailable, falling back to no SSL).
Here's how basic authentication works:
Patchworks sends an API request to the required database (e.g. MySQL). The request includes username and password authentication credentials in the HTTP header of the request, encoded in Base64 format.
Upon receipt of the request, authentication credentials are extracted from the request header and validated.
If the credentials provided are valid, access is granted for the requested resource. If the credentials are invalid or missing, an appropriate error response is returned and access is denied.
When a Patchworks user adds an instance of a connector and chooses to authenticate with db user pass authentication, they will see something similar to the example below:
Endpoint options are used to define the API requests for any endpoints you want to make available for use with of this connector:
When configuring endpoints, you choose a direction to confirm the direction of data flow:
Receive - where a connection will receive data from the endpoint resource.
Send - where a connection will send modified data to the endpoint resource.
Be sure to configure one endpoint for each direction your users may need in process flows.
This page walks through the steps required to configure no auth authentication for a connector.
Step 1 Log in to the and navigate to process flows > connectors & instances, where all of your installed connectors are shown. From here, access settings for the connector that you need to update with a new authentication method - for example:
If you're building a new connector, you can pick up these steps when you reach the authentication section of the connector builder.
Step 2 Access authentication details:
Step 3 Click the add new authentication method button:
Step 4 Complete basic details for this authentication method - ensure that you set the authentication type to no auth (public) - for example:
Step 5 You don't need to add any settings under authentication setup - although if you want users to provide variable values when they add instances for this connector, or pass in header/body content, etc. then you can update these tabs:
Step 6 Save changes.
The endpoint URL page is used to define the HTTP method and URL to be used, and any required URL parameters:
To add an endpoint URL, you must select the appropriate HTTP method:
...and then add the required URL:
You can define two types of parameter:
In the example below, our endpoint URL is set to GET all products, but we are adding a default URL parameter to add a query which will only retrieve products with a product_type
of snowboard
:
Optional parameters are available for your users to update with their own required values, in process flows.
If we consider the example above - we are always restricting our 'GET all products' endpoint to return only products with a product_type
of snowboard
. But suppose we wanted to allow users to choose a product_type
at the point they are running a process flow?
When a process flow runs for this connector, associated API requests are injected with the user-provided URL parameter value wherever a {{product_type}}
parameter is found.
These are optional parameters - users are not required to provide a value for the associated connection shape in process flows.
However, there may be scenarios where you need to ensure that a URL parameter is always provided by users running a process flow. For this, a slightly different approach is needed - in this case, you would:
Before a connector can be used (i.e. before for use in ) you must add at least one endpoint. The steps and settings required will vary depending on which type of endpoint you're adding, and how you want it to behave - general steps can be found below.
The steps detailed on this page show how to create an endpoint from first principles. However for speed, it's usually more efficient to clone an existing endpoint and then make required configuration changes. The clone option is available from the endpoints list:
Step 1 Click the add new endpoint button:
Step 2 You're prompted to enter a name, and to select an entity type:
...enter a name for this endpoint and select the appropriate entity type from the dropdown list:
The entity type is used to organise endpoints whenever they are displayed to users in process flows.
Step 3 Click the create button. Basic details are saved and the manage endpoint page is displayed:
This page is split into upper and lower panes - endpoint details at the top and endpoint setup in the lower panel.
Step 4 In the top endpoint details panel, use dropdown options to set the direction as required:
This determines the direction that data associated with this endpoint will flow:
Choose receive if you will be pulling (i.e. receiving) data for this endpoint - typically these endpoints are associated with a GET http method.
Choose send if you will be pushing (i.e. sending) data to this this endpoint - typically these endpoints are associated with PUT, POST, PATCH or DELETE http methods.
For any endpoint, the following options are available:
The authentication tab for an endpoint is where you decide which of your for this connector, can be used for this endpoint:
AND
AND
So, if you have configured two authentication methods and added an instance for each - and you want your endpoint to be available whichever instance a user chooses to use in a process flow - you need to activate both of these for your endpoint.
For example, let's say that:
You've configured basic auth and OAuth 2 authentication methods for your connector, and have added instance 1 with basic auth credentials and instance 2 using OAuth credentials.
You add an 'orders' endpoint but you ONLY activate the basic auth authentication method.
The effect will be:
It's not mandatory to activate all of your configured authentication methods for an endpoint. For example, you might have some endpoints that are fine to use basic auth, but others which need the extra security provided by OAuth 2.
To activate an authentication method for an endpoint, simply set the appropriate toggle option to 'on' - for example:
The user initiates the authorisation process by clicking on a login or authorisation button in the client application - in this case, .
Any endpoints added here will be available for your users to select when they choose to of this connector to a - for example:
If you are building a database connector (e.g. for a MySQL database), you'll see a queries tab instead of an endpoints tab. Please see for more information.
Please see for general steps required to add a new endpoint for a connector. You'll find detailed information about options and settings in the section.
parameters are added as key pairs and are always applied for the endpoint, whenever it is used. Use the top panel to add required parameters.
parameters are displayed as filters, so users can apply with their own values when using this endpoint as a data source in . Use the lower panel to add optional parameters.
Any parameters that you add (to either panel) here are automatically appended to the existing as a query parameter when this endpoint is used in .
If you have parameters that must always be passed in the endpoint request URL, add them to the top panel. Default parameters are added as key pairs, and are passed straight into requests - users are never asked to provide values for these in .
By adding this as a default URL parameter for the endpoint, this query will be applied whenever this endpoint is added to (via a ). The actual endpoint used will be:
You can define static values for a default URL parameter, or use a variable. For an example of where variables might be useful here, see
When a includes a which is configured to use this endpoint, users can see/update filter fields for any optional URL parameters that have been defined for the endpoint. For example, let's add an optional parameter for product_type
:
Now if we configure a with this endpoint, a product_type filter option is available, so the person running this flow can choose to use it if they wish:
are just that - users can choose to add a parameter value if they wish. If a user doesn't choose to update an optional URL parameter field, then no query is applied.
Step 1 Add a 'required' for the field that you want to force users to update in process flows.
Step 2 Update the to include a query for this variable.
Step 3 Add a , specifying your endpoint variable (added in step 1) as the parameter value.
Step 4 Now when a user adds this endpoint to a in a , they must update this variable field before proceeding.
Techniques for adding URL parameters are same as all other types of parameters that you may encounter in the connector builder. For information about these options please see the page.
The name is displayed to users when configuring s in , so it's advisable to be as clear as possible about what this endpoint does. For example, an endpoint defined to retrieve all products might be named: 'List all products'.
Step 5 Use the lower endpoint setup panel to update as required for the new endpoint - options are available over a series of 'metro stop' tabs:
These determine the experience your users will have when they choose to add a to a and associate it with an instance of this connector, using this endpoint.
Step 6 Having completed all required configuration for this authentication method, click next to complete the setup. Your new connector is now available in the , so users associated with your company profile can add of it.
When an authentication method is activated for an endpoint, it means that that the endpoint will be available in when:
You
You
That instance was
When you for a connector, you must provide a set of credentials for authentication. Any for the connector will be available to choose from.
If you and associate it with instance 1 (i.e. using basic auth), the 'orders' endpoint will be available for selection - this is because we've activated basic auth for the endpoint.
If you and associate it with instance 2 (i.e. using OAuth 2), the 'orders' endpoint will NOT be available for selection - this is because we didn't activate OAuth 2 for the endpoint, but the instance is authenticated using OAuth 2 credentials.
If an authentication variable is required elsewhere in the connector setup (for example, we know that the url
variable is required for authentication AND endpoint requests) it's worth adding it to the connector variables tab once and then choosing to 'use' it wherever needed in the connector setup.
If this option is OFF, users won't see it unless they select the add new filter button and add it manually - for example:
Choose which apply for this endpoint.
For more information about working with authentication settings, please see the page.
For more information about working with these variables, please see the page.
Define the HTTP method and URL for authentication, and any required URL parameters. You can define default parameters which are always applied to requests, and optional filters which your users can define when working with this endpoint in .
For more information about working with URL parameters, please see the page.
For more information about working with headers, please see the page.
For more information about working with body parameters, please see the page.
For more information please see the page.
Add a schema for this endpoint, so Patchworks knows what data structure to expect and which fields to make available for instances of this connector in .
For more information, please see the page.
GraphQL cursor pagination is a method for paginating GraphQL APIs.
Here, we send a GraphQL query requesting a list of items. This query includes parameters such as the number of items to fetch and any filtering or sorting criteria required. In response, requested items are received, together with cursor information (each item in the response is associated with a cursor, which is typically a unique identifier for that item).
The GraphQL cursor pagination method was developed for the Shopify GraphQL API however, the same principles apply for other GraphQL systems.
EndCursor path
Always defined in the following form:
data.
{type}
.pageInfo.endCursor
Here, the {type}
element should be replaced with the type that's defined by the schema - for example:
data.products.pageInfo.endCursor
HasNextPage path
Always defined in the following form:
data.
{type}
.pageInfo.hasNextPage
Here, the {type}
element should be replaced with the type that's defined by the schema - for example:
data.products.pageInfo.hasNextPage
The GraphQL cursor pagination method works in conjunction with a query on the endpoint body, which determines required settings. For example:
If you need to change the existing query for an endpoint, you should edit the connector and access body options for the required endpoint.
Pagination continues until hasNextPage
is returned as false
.
Each page is denoted by the ID of the last object it holds, rather than its page. For example, if a 'page' returns 10 customers, then the ID of the last customer will be passed in the URL to get the next page.
Link parameter path
Enter the dot notation path for the data element in your response which contains the maximum number of items that the API should return in a single page of a paginated response. Commonly (though not necessarily), this would be a path to a limit
field.
Last ID parameter name
Enter the name of the query parameter to be passed into the URL to tell the receiving system the last record we received (so the receiving system knows where to start for the next page of data to return). A commonly used name is: last_id
.
Limit
Enter the number of items to be returned per page. For example: 10
.
ID key
Enter the unique identifier key for each item in your data. For example, if the endpoint is pulling a list of users, this might be: user_id
.
Suppose we set the following options:
Link parameter path
limit
Last ID parameter name
starting_after
Limit
10
ID key
id
The following URL will be generated to get the first page:
Notice our link parameter path (limit
) and the actual limit value (10
) at the end of the request. Our first page would look something like the example below:
When pagination runs, it will look for the last id
key in the payload, and use that as the starting point for the next request. So the request for page 2 will be:
Notice our link parameter path (limit
) and the actual limit value (10
) at the end of the request, followed by our Last ID parameter name (starting_after
) set to the last id
in the response.
A sample response for this request is below:
Pagination continues until the the number of items in the payload is less than the limit, or the page returns an error code.
This method is a slight variation on the next page URL approach. Instead of receiving a full URL in the response, it contains a 'token' (usually a random string/hash). The receiving system uses this token to keep track of the position of the last record in the current page of data.
Token parameter name
Enter the name of the URL parameter which holds the token for requesting the next page.
Limit parameter path
Enter the dot notation path for the data element in your response which contains the maximum number of items that the API should return in a single page of a paginated response. Commonly (though not necessarily), this would be a path to a limit
field.
Limit
Enter the number of items to be returned per page. For example: 10
.
Path to token in payload
Enter the dot notation path of the next page token within the payload.
Suppose we set the following options:
Token parameter name
page_token
Limit parameter path
limit
Limit
10
Path to token in payload
links.next
...and we send a request to get the first page of data:
The response will include the first page of data, together with a next page token that should be used to get the next page of results. For example:
Notice the links.next
section at the end of this response, which includes our next page URL. So, our request for the next page of results would be:
Pagination continues until the token is no longer included in the payload.
The next page token pagination method is implemented using a Patchworks pagination variable which contains a token for the next page:
This note is for reference only - there should never be a need to access/change this variable.
Some APIs include pagination functionality so that large HTTP responses can be served as multiple pages, which are more manageable. Different APIs use different methods to approach this.
Paginating requests for resources that might be large is recommended - otherwise the API may truncate the result or timeout whilst attempting to gather the data. Limiting requests to a smaller number of objects at a time typically results in a faster, more reliable outcome.
When paginated data is pulled, a payload is generated for each page.
To set a pagination method for an endpoint, click in the pagination method field to activate a dropdown list of supported methods:
Having selected a method, click save. Any required options for the selected method are displayed.
The following pagination methods are supported:
The body tab is primarily used for creating or updating resources (i.e. for POST, PUT, PATCH and DELETE requests).
Any parameters added here are passed in the endpoint request body. You can define default body parameters, and optional body parameters:
It's important to note that when a process flow runs and reaches a destination connection (i.e. a connection shape associated with a POST, PUT, PATCH and DELETE endpoint), the payload generated from previous steps is automatically added to the body of that request. You do not need to add anything to the endpoint body tab for this to happen - it's automatic.
When an authentication method is applied for an endpoint, any header and body parameters specified for the authentication method are also sent in the endpoint requests - you don't need to add them twice.
The body tab is split into upper and lower panels:
If you have parameters that must always be passed in the endpoint request body, add them to the required body parameters panel. Default parameters are passed straight into requests - users are never asked to provide values for these.
Required body content can be none, or added as raw, form, or text data:
Use this option to pass static content or an incoming payload into the request body. Select the raw
option and choose the required data type:
...then (if required) use the editor provided to add the required data:
If no static content is added, any incoming payload is passed into the request body.
Select the form
option to add data as key pairs:
Select the text
option and add the required text content to the body content field:
Set this option to none
if no body content is expected.
It's important to note that this option is ignored if data is found in the body. This handles scenarios where body content isn't typically expected so body format
is set to none
, but later (for example) a custom script is introduced which adds a payload to the body.
In order to send an empty body, no Content-Type
header should be set. If a Content-Type
header IS set (within header options), then 'none' will still fall back to sending the default payload (the output of the previous shape).
If you have parameters that you want to expose to users when they configure a connection shape to use this endpoint in process flows and then pass provided values into the endpoint request body, add them to the lower panel:
Body filters are available for your users to update with their own required values, in process flows. These work in exactly the same way as noted for optional URL parameters, except any values provided by users (via the connection shape in process flows) are passed into the request body, rather than being added as URL queries.
Techniques for adding header parameters are the same as all other types of parameters that you may encounter in the connector builder. For information about these options please see the Working with parameters page.
Any parameters added to the header tab are passed in the endpoint request headers. You can define default header parameters and optional header parameters:
Notice that the header tab is split into upper and lower panels:
When an authentication method is applied for an endpoint, any header and body parameters specified for the authentication method are also sent in the endpoint requests - you don't need to add them twice.
Please refer to your API documentation for specific guidance about what values need to be passed in authentication headers.
If you have parameters that must always be passed in the endpoint request header, add them to the required parameters panel. Default options are added as key pairs, and are passed straight into request headers - users are never asked to provide values for these.
If you have parameters that you want to expose to users in process flows and then pass provided values into the endpoint request header, add them to the lower panel.
Optional parameters are available for your users to update with their own required values, in process flows. These work in exactly the same way as noted for optional URL parameters, except any values provided by users (via the connection shape in process flows) are passed into the request headers, rather than being added as URL queries.
If you are building a connector for a webhook, you must include a content-type
header.
Techniques for adding header parameters are the same as all other types of parameters that you may encounter in the connector builder. For information about these options please see the Working with parameters page.
This method is similar to the approach, except that the URL for the next page is included in the response body, rather than the header.
Suppose we set the following options:
...and we send a request to get the first page of data:
The response will include the first page of data, together with a URL that should be used to get the next page of results. For example:
Notice the links.next
section at the end of this response, which includes our next page URL. So, our request for the next page of results would be:
Pagination continues until the next page URL is no longer included in the payload.
This pagination method has been developed specifically for PeopleVox. It should not be used with other systems.
PeopleVox GET endpoints include body content which handles specific requirements for PeopleVox data. This includes a Patchworks pagination variable, which is used to calculate page numbers:
This note is for reference only - there should never be a need to change this content.
This pagination method has been developed specifically for the NetSuite SOAP connector. It should not be used with other systems.
To find the required xPaths, tools such as can be useful. Paste in a sample NetSuite SOAP response (first page) to obtain the required paths to fields.
In this method, the required page number is included as a parameter in the API request, and is incremented in each request to get the next page.
Suppose we set the following options:
...and we send a request to get the first page of data:
The response will include the first page of data (sometimes with metadata regarding pagination). For example:
Our request for the next page of results would be:
Pagination continues until the last page, when there is no more data to return.
The page number parameter pagination method is implemented using a Patchworks pagination variable which contains the next page number:
This note is for reference only - there should never be a need to access/change this variable.
OAuth 2 is a protocol which allows users to grant limited access to their resources/data in an application or service (e.g. NetSuite), to another application or service (in this case, Patchworks) without ever sharing their login credentials.
The authentication flow and associated configuration for OAuth 2 vary according to which grant type is used. Patchworks supports the following OAuth 2 grant types:
OAuth 2 provides a more streamlined, standardised approach than - it’s easier to implement and more suitable for a wide range of applications.
Limit
Enter the number of items to be returned per page. For example: 50
.
Total count tag field
The name of the PeopleVox response field which contains the total number of records available. For PeopleVox this is TotalCount
.
Link header name
Enter a name for the header that will contain link information. A commonly used name is: Link
.
Limit parameter name
Enter the name of the query parameter to be passed into the URL to tell the receiving system the maximum number of items that the API should return in a single page of a paginated response. A commonly used name is: limit
but total
or count
are also popular.
Limit parameter path
Enter the dot notation path to the limit parameter name.
Page parameter name
Enter the name of the query parameter to be passed into the URL to tell the receiving system the required page number. A commonly used name is: page
.
Limit
Enter the number of items to be returned per page. For example: 10
.
Path to the data in the response
If required, you can add a dot notation path to an element in the payload that you would expect to contain data if the data pull has not completed. For example, if you are pulling orders, you might expect to see data in an orders
element of the response.
This is a 'belts and braces' option to handle edge cases where a system continues to send data of some type, even when there is no more required data to be pulled - so pagination would never stop. If you don't want to use this option, click the allow empty button.
Limit parameter name
limit
Page parameter name
page
Limit
10
Path to the data in the response
data
Limit
Enter the number of items to be returned per page. For example: 50
.
XPATH to the search ID field in the response
Enter the XPath to the ID field in your request responses.
XPATH to the total pages field in the response
Enter the XPath to the total pages field in your request responses.
Next page field
Enter the location of the next page URL within the payload.
Next page field
links.next
This is a placeholder page - please check back later!
Schemas aren't mandatory but they make things much simpler when building process flows. If your flow includes endpoints associated with schemas, any field selector options in process flow shapes are populated with the schema structure - all you need to do is choose the required field.
For example, the below is picking up the schema associated with the Shopify endpoint, configured in the preceding connector shape:
If a process flow uses an endpoint without a schema, any field paths defined in shapes must be defined manually.
The required schema for your third-party application should be available in the associated API documentation.
To apply a schema for an endpoint, follow the steps below:
Step 1 Click the edit schema button:
Step 2 Paste in the required schema and save changes:
If you can't find a schema in your API documentation, you can run the API request in Postman, and then copy/paste the response as the schema.
This is particularly important for JSON payloads, where the data structure is nested. Let's take an example below:
Here, all of our data is nested within one, top-level customers array object. If you scan down this example, you'll notice that there are two customer objects, each starting with an id for a customer record:
Now let's look at the data path field at the bottom of this page:
If we leave this set to empty, any subsequent field tags, mappings and filters will work on the basis that the top-level array object is our target. What we'd be saying in this scenario is 'don't treat the nested objects as separate records'.
So, for example, if we went on to apply a filter to match on first_name
contains
bob
, we'd find a match in the second customer object but ALL objects would be returned because we're targeting the top-level array object. This isn't what we want - we need to treat each of the lower-level customer objects as separate records. To do this, we navigate the data path and select the parent object - in this case, its customers:
Typically, users need to provide valid authentication credentials for any instance of a connector that they add - when the instance is created, Patchworks checks that the credentials are valid and if they are, the instance is created.
However, there may be times where you wish to allow users to add an instance without providing any authentication credentials - perhaps you're connecting to a public-facing system, or to a Postman mock server (for example).
When a Patchworks user and chooses to authenticate with a configured no auth authentication method, they are not prompted to enter any credentials. Instead, they go directly to finalising the instance - for example:
When you add a schema, you can also choose to .
Use the data path field to define the hierarchical level to be used for and :
When you save your new data path, you won't see any changes to the schema - but the change will be applied in the tab. Here, the schema preview shows the structure that applies as per your selected data path in the schema tab.
When you come to use instances of this connector in process flows and apply a , you'll see confirmation of the selected data path in filter settings - for example:
This method is similar to the page number parameter approach. However, instead of appending a page number to the request URL, an offset parameter is used to indicate how many results have been returned so far (i.e. the start point for required data).
This method is rather like a database search: give me 5 records starting from the 15th record.
Limit parameter path
Enter the dot notation path for the data element in your response which contains the maximum number of items that the API should return in a single page of a paginated response. Commonly (though not necessarily), this would be a path to a limit
field.
Offset parameter path
Enter the dot notation path for the data element in your response which contains the required offset - i.e. how many items should be skipped before the next page starts. Commonly (though not necessarily), this would be a path to a page
field.
Limit
Enter the number of items to be returned per page. For example: 10
.
Count parameter path
If required, enter the dot notation path for the data element in your response which contains the current count of records that have come back from the system. Commonly (though not necessarily), this would be a path to a count
field. This value is not required for some APIs, therefore it's an optional field.
Total parameter path
Enter the dot notation path for the data element in your response which contains the total number of records that will be returned in this response, so we know when to stop paginating. Commonly (though not necessarily), this would be a path to a total
field. This value is not required for some APIs, therefore it's an optional field.
Suppose we set the following options:
Limit parameter path
limit
Offset parameter path
offset
Limit
5
Count parameter path
meta.count
Total parameter path
meta.total
...and we send a request to get the first page of data:
The response will include the first page of data (sometimes with metadata regarding pagination). For example:
Requests for subsequent pages would increment the offset
value by the limit
value - for example:
...and then:
...and so on until 50 items (i.e. the total parameter path value
) are returned.
Pagination continues until the last page, when there is no more data to return.
The limit offset pagination method is implemented using a Patchworks pagination variable which contains the next page offset:
This note is for reference only - there should never be a need to access/change this variable.
Created_DateTime
Order_ID
ID
Order_Number
Location_ID
Updated_DateTime
Order_Created_DateTime
Fulfillable_Quantity
Order_Number
Fulfillment_Created_DateTime
Price
Fulfillment_ID
Product_Exists
Fulfillment_Status
Product_ID
Gift_Card
SKU
ID
Taxable
Order_Created_DateTime
Variant_ID
Order_ID
Refund_ID
Order_ID
Created_DateTime
Order_Number
Order_Created_DateTime
Processed_DateTime
Currency_Code
Refund_Created_DateTime
Customer_Currency_Code
Refund_ID
Customer_Payment_Amount
Refund_Quantity
Gift_Card
Restock_Type
ID
Shop_Amount
Line_Item_ID
Shop_Currency_Code
Order_Created_DateTime
SKU
Order_ID
Status
Order_Number
Subtotal
Order_Quantity
Subtotal_Shop_Amount
Price
Total_Tax
Refund_As
Adjustment_Reason
Order_Number
Amount
Refund_Created_DateTime
Customer_Currency_Code
Refund_ID
Customer_Payment_Amount
Shop_Amount
Customer_Tax_Amount
Shop_Currency_Code
Customer_Tax_Currency_Code
Shop_Tax_Amount
ID
Shop_Tax_Currency_Code
Order_Created_DateTime
Tax_Amount
Order_ID
Amount
Refund_Line_Item_ID
Customer_Currency_Code
Shop_Amount
Customer_Payment_Amount
Shop_Currency_Code
Customer_Currency_Code
Shop_Amount
Customer_Payment_Amount
Shop_Currency_Code
Rate
Type
Refund_Line_Item_ID
Value
Amount
Processed_DateTime
Created_DateTime
Refund_Created_DateTime
Currency
Refund_ID
ID
Status
Order_Created_DateTime
Test
Order_ID
Type
Order_Number
Alternative_ID
Payment_Gateway
Cancel_Reason
Payment_Status
Canceled_DateTime
Referring_Site
Closed_DateTime
Shop_Currency
Confirmed
Source
Created_DateTime
Total_Discounts
Customer_Currency
Test_Line
Customer_ID
Total_Line_Items_Price
Fulfillment_Status
Total_Outstanding
ID
Total_Price
Location_ID
Total_Tax
Note
Updated_DateTime
Order_Number
Created_DateTime
Order_Number
Customer_Currency_Code
Quantity
Customer_Payment_Amount
Shop_Amount
Fulfillment_Status
Shop_Currency_Code
Gift_Card
SKU
ID
Taxable
Item_ID
Total_Discount
Item_Name
Total_Tax
Item_Price
Variant_ID
Order_ID
Vendor
Created_DateTime
Tax_Locale
Currency
Tax_Rate
Order_ID
Total
Customer_Discount_Amount
Shop_Discount_Amount
Customer_Discount_Currency_Code
Shop_Discount_Currency_Code
Order_Line_Item_ID
Customer_Tax_Amount
Shop_Tax_Amount
Customer_Tax_Currency_Code
Shop_Tax_Currency_Code
Order_Line_Items_ID
Title
Rate
Amount
Discount_Value
Code
Discount_Value_Type
Created_DateTime
Entitlement_Type
Discount_Applied_To
Order_ID
Discount_Type
Order_Number
Address1
Order_ID
Address2
Order_Number
City
Province_Code
Company
Province
Country
ZIP
Country_Code
Amount
Shipping_Lines_ID
Customer_Currency_Code
Shop_Amount
Customer_Payment_Amount
Shop_Currency_Code
Order_ID
Customer_Disc_Currency_Code
Order_Number
Price
ID
Shop_Amount
Discounted_Price
Shop_Currency_Code
Shop_Disc_Amount
Customer_Payment_Amount
Shop_Disc_Currency_Code
Customer_Currency_Code
Customer_Disc_Payment_Amount
Customer_Currency_Code
Shipping_Lines_ID
Customer_Payment_Amount
Shop_Amount
Price
Shop_Currency_Code
Rate
Title
We've already seen how variables are defined at instance and authentication method levels - the final level that variables can be defined at is on endpoints. Any variables added here are only applicable to the associated endpoint:
Typically, these are variables that you want your users to update when they configure a process flow connection shape with an instance of your connector, using this endpoint.
When the process flow runs (i.e. when API requests are performed) the information provided by your user is injected into any corresponding {{variable}}
tokens found in the endpoint requests.
For example, you might define an endpoint to retrieve a single customer record, and require your user to specify the required ID at runtime:
If two variables with the same key are defined in two different places, we also prioritise them in connector
-> connector instance
-> endpoint
order.
For example, if you define a {{store_name}}
variable in an authentication method for a connector and then another {{store_name}}
variable on an endpoint, the endpoint value would take precedence.
To add a variable for an endpoint, follow the steps below.
Step 1 Click the add new variable button:
Step 2 Complete details and set options on the add variable page:
The add variables page is the same for all types of variables that you may encounter in the connector builder (for information about these options please see the Working with variables page). However, it's worth noting the effect of setting required and configurable by user options in the context of endpoint variables:
When you add an endpoint variable and choose to make it required, you are effectively saying: 'When a user adds a connection shape to a process flow and selects an instance of this connector together with this endpoint, do not allow them to proceed without providing a value for this variable'.
When you add an endpoint variable and choose to make it configurable by users, you are effectively saying: 'When a user adds a connection shape to a process flow and selects an instance of this connector together with this endpoint, allow them to provide a value for this variable if they have one but if they don't, let them proceed'.
Step 3 Click the save button.
Step 4 Having added a variable, make sure that you go on to define how any values captured for it should be passed in API requests. Typically, any variable that you define here would then be added to the endpoint URL, or the header, or the body for the endpoint.
In the Patchworks connector builder, variables must be defined in double curly brackets.
You can remove an endpoint variable by clicking the associated trash icon on the auth variables tab - for example:
To access field tags, edit an endpoint for your connector and select the schema/taxonomy tab - for example:
Follow the steps below to add a new field tag for your schema:
Step 1 Click the add new tag button:
...the edit field tags modal is displayed:
All data fields found in the schema associated with this endpoint are available for selection.
Step 3 Move down to the select tags field and find a tag to apply from the Patchworks field tag taxonomy- for example:
Tags are organised by entity - customer tags, location tags, shipping address tags, orders tags, etc.
Step 4 Click anywhere outside of the list of fields to confirm your selection.
Tracked fields for endpoints is now deprecated. Fields can now be tracked via the track data shape.
Step 5 Save the tag - for example:
...the new tag is added to your list:
Follow the steps below to update an existing field tag for your schema:
Step 1 Click on an existing tag that you want to change - for example:
...the edit field tags modal is displayed and any existing tags are shown - for example:
Step 2 To remove an existing tag to replace it with another, click the associated 'cross' icon - for example:
You can associate multiple tags with any given field, so you don't have to remove an existing tag unless you need to.
...then use the select tags field to find a replacement tag from the Patchworks field tag taxonomy- for example:
All data fields found in the schema associated with this endpoint are available for selection.
Step 3 Save the tag.
Follow the steps below to remove an existing tag for your schema:
Step 1 Click on an existing tag that you want to remove - for example:
...the edit field tags modal is displayed and any existing tags are shown - for example:
Step 2 Remove all existing tags using the associated 'cross' icon - for example:
Step 3 Once all tags are removed, save the tag - for example:
Don't worry! The point of field tagging is that we tag the most common fields that Patchworks has identified. If your data schema includes fields where none of our tags apply, there's no need to tag it.
When you configure a process flow connection shape to use a given instance, you can then choose from a list of available endpoints. For example:
This list will only include endpoints for which the same authentication method is enabled, as was used to add/authenticate the selected instance.
So, having added a new authentication method, you must enable it for any connector endpoints that you might want to use with instances that are added using this authentication method.
Step 1 Log in to the Patchworks dashboard and navigate to process flows > connectors & instances, where all of your installed connectors are shown. From here, access settings for the connector that you need to update with a new authentication method - for example:
If you're building a new connector, you can pick up these steps when you reach the endpoints section of the connector builder.
Step 2 Access endpoints for the connector:
Step 3 Select the endpoint that you want to update - for example:
Step 4 Any authentication methods that have been added for this connector will be displayed on the endpoint authentication tab, with a toggle option to enable/disable use - for example:
Step 5 Toggle this option on/off as required - for example:
All prebuilt Patchworks connectors in the are maintained by Patchworks. Any updates required for these connectors (for example, if Shopify were to change their integration requirements) are completed by Patchworks and made available in the marketplace for you to install.
Any connectors that you build with the connector builder are your responsibility to maintain.
Parameters can be defined throughout the connector builder, in:
When a runs, any associated API requests are injected with given variable values wherever a corresponding {{key}}
is found - this is Irrespective of where parameters are defined
All parameters specified in connector builder API requests must be placed within double-curly brackets - for example: {{store_name}}
.
Depending on where you are in the connector builder, you will encounter both and parameters, where:
parameters are always applied to API requests, whenever it is used.
parameters are those that users can choose to apply with their own values - either when adding connector instances (in the case of parameters defined for ) or as filter parameters when configuring for .
Irrespective of where parameters are defined, any associated API requests are injected with given default and optional parameter values wherever a corresponding {{key}}
is found.
Default parameters are those which must always be passed into the request URL, header, or body using values that you specify as part of the configuration. They are added as key pairs:
Defined values can be static or dynamic. Default parameters are passed straight into requests - users are never asked to provide values for these.
When you choose to add an optional parameter, you're prompted to complete the fields as below:
Use the following table as a guide for completing these fields:
Having added a parameter, you can simply click its name to access details in edit mode - for example:
From here, you can edit key and value fields, or choose the delete this entry - for example:
When building connectors with the connector builder, you need to add/update variables and parameters in most stages of the process. Whilst the purpose of these will vary (for example, and variables are needed for different things), techniques for adding and managing variables and parameters is always the same.
In some places, you can only add , but in others you can add both types. In this case, the variables page is split into two panels - for example:
parameters are defined in the top panel, with parameters in the lower panel. The sections below explain the use of these parameters in general terms - for specific guidance in a particular context, please use the links provided .
There is one scenario where a user can influence the value of a default parameter. This is where you define a default parameter value as an endpoint {{variable}}. For an example scenario please see our section.
Optional parameters are those that you want to expose to your users in , and then pass values that they provide into your API requests (via the URL, header, or body).
Any optional parameters that you define are displayed as filter parameters for a when a user selects the associated instance/endpoint. Essentially, you are defining filter options for users to apply in process flows. For example:
As noted above, the parameter type selected determines the user experience of updating this parameter (via ) in . Below is an example of each parameter type, so you can see the resulting behaviour in a process flow.
Field
Enter a valid parameter field from the API documentation associated with the third-party application that you're building.
Select an operator
Operators determine how matching should be performed on the value given for this field (for example: contains
, equal to
, greater than or equal to
, etc.).
Select a type
Value
The essence of is to pull defined data from one Patchworks (i.e. a third-party system) and push it into at least one other connector (i.e. another third-party system). It’s unlikely that two third-party systems will have the same data structures, therefore we use the to define where a data field from one connector should be placed in another.
When you build a connector using the , available field mappings are determined by the specified for the endpoint. Field names used in data schemas can appear to be quite random and complex - this is fine if you know the schema and you're the only company ever likely to install the associated connector, but if you think that you might want to share your connector with other Patchworks customers in future, then field tagging is really important.
A field tag is a standard Patchworks tag that can be applied for a data field in the associated with a connector endpoint.
The covers a wide range of entities across orders, products, fulfilments, and inventory. You'll see this if/when you come to .
We are adding to the all the time, so you can expect the current list of tags to grow.
By standardising how fields are identified across all connectors, we can automate mappings between them.
So, if you add two to a - each with endpoints that have been fully tagged - you'll find that mappings are automatically created when you add a between them. Without field tagging, you need to apply mappings manually.
Field tagging isn't mandatory if you're building a connector that will only ever be used within your own company.
However, if there's a chance that you'd like to share your connector in the Patchworks marketplace for other organisations to install, then you must apply standard Patchworks field tags - this will be a condition of verification.
In the near future, you will be able to submit any connectors that you build for verification. Verified connectors will be available in the Patchworks Marketplace, for other Patchworks customers to install.
Yes - if a data field in your schema needs to be associated with more than one tag, you can apply as many as you need.
The Patchworks field tag taxonomy covers a range of entities across orders, products, fulfilments, and inventory. You'll see this if/when you come to . The current taxonomy is detailed in the following sections:
We are adding to the field tag taxonomy all the time, so you can expect the current list of tags to grow.
Choose the type of field that users will be prompted to update when they set this parameter in process flows. Available options are string
, number
, specific date
, and dynamic date
. For examples of these types, please see the section below.
Available value fields depend on your type selection above. For examples, please see the section below.
Currently, the includes Patchworks prebuilt connectors that can be viewed/installed by all Patchworks customers. Additionally, you'll see any connectors that you've built with the - right now, only users within your company will see these.
Tracked fields for endpoints is now deprecated. Fields can now be tracked via the shape.
Cost
Origin_Province_Code
Created_DateTime
SKU
ID
Updated_DateTime
Origin_Country_Code
Amount_Available
Location_ID
Inventory_Item_ID
Updated_DateTime
Active
Created_DateTime
Address1
ID
Address2
Legacy
City
Name
Country
Province
Country_Code
Updated_DateTime
Country_Name
Zip
Created_DateTime
Tags
Product_ID
Title
Product_Type
Updated_DateTime
Published_DateTime
Vendor
Status
Created_DateTime
Price
ID
Product_ID
Image_ID
SKU
Inventory_Item_ID
Taxable
Inventory_Quantity
TITLE
Original_Price
Updated_DateTime
Created_DateTime
SRC
ID
Updated_DateTime
Position
Variant_ID
Product_ID
When writing queries for a database connector, you use standard query language for the database type. However, there are some Patchworks-specific conventions to consider when passing in data from a Patchworks source, and some best practice recommendations.
Currently, MySQL is supported but further database types will be added in due course.
Conventions for working with Patchworks data in queries are detailed in the sections below:
If you want to retrieve data based on given values that vary at runtime, you can define query variables
in the connector setup, and include these in your queries:
Query variables
work in the same way as endpoint variables - they can be used to pass static values into queries or pass dynamic values at runtime.
To reference these variables in queries, we use the standard variable syntax for Patchworks endpoint/query variables:
{{variableName}}
For example, if we always wanted to target a row where the id
column is set to 4
, we might use the query below:
But if we want the flexibility to vary the target id
number, we can use a query variable:
In this case, the value of our {{id_to_use}}
variable would be passed into the query at runtime - perhaps specified by a user via connector shape settings, or generated from a script.
When defining a query variable for your connector, setting it to be configurable by a user
means that the variable is exposed in connector shape settings when the query is used - for example:
If we follow through with our example:
...and assume the value received at runtime is 8
, the query would resolved as below:
We don't interpret or sanitise query variable values - these are passed into the query as-is. As such, you'll need to consider if a variable should be escaped with quotes - see the Variable placement & escaping section below.
It's likely that you'll likely need to reference data from an incoming Patchworks payload in queries - for example:
Here we are saying: take id
, firstname
, surname
, and amount
values from the incoming payload and insert them into id
, firstname
, lastname
, and amount
columns in the orders
table. The query breaks down as follows:
As can be seen in the example above, we use colon-syntax parameters to reference payload data fields:
:placeholder
At runtime, parameter placeholders are replaced with corresponding values from the incoming payload.
Data is interpreted and inserted into the query as necessary - replacements with this syntax are completely safe and escaped.
You can access nested payload fields using dot notation (like standard payload variables). For example:
Patchworks meta-variables can be referenced in queries using the standard meta-variable syntax:
[[meta.variableName]]
For example:
In this example, we select all columns (*
) in our products
table but only for rows where the category
column is set to a value that will be passed in via a meta-variable [[meta.our_category]]
at runtime.
Meta-variable values can be set in a script, or via a set variables shape. If we follow through with our example:
...and assume the value received at runtime is bags
, the query would resolved as below:
We don't interpret or sanitise query variable values - these are passed into the query as-is. As such, you'll need to consider if a variable should be escaped with quotes - see the Variable placement & escaping section.
Patchworks flow variables can be referenced in database queries using the standard flow variable syntax:
{{flow.variables.variableName}}
For example:
In this example, we select all columns (*
) in our products
table but only for rows where the quantity
column is set to a value that will be passed in via a flow variable {{flow.variables.our_quantity}}
at runtime.
Flow variable values can be set in process flow settings, via a script, or in a set variables shape. If we follow through with our example:
...and assume the value received at runtime is 0
, the query would resolved as below:
We don't interpret or sanitise query variable values - these are passed into the query as-is. As such, you'll need to consider if a variable should be escaped with quotes - see the Variable placement & escaping section.
Any combination of variables can be used in both SELECT
and WHERE
sides of a query. For example:
On the SELECT
side, we don't need to worry about using escape quotes for string/varchar columns because we're always referring to column names.
On the WHERE
side, you should ensure that escape quotes are specified for variables where appropriate. Variables are not interpreted, sanitised or escaped - values are replaced as-is.
If you don’t properly escape variables being passed into queries, your database may interpret unescaped user input as part of the query itself, rather than treating it as plain data. As such, it's possible that a rogue actor could manipulate queries by injecting malicious code into your variables. With this in mind, always ensure you're working with known, safe data.
Escape character syntax may vary between database protocols but the principle is always the same.
Query character limit. Most database types will have a maximum character limit for queries - for example, MySQL has a limit of 1024K characters. Keep this in mind if you're inserting large amounts of data and consider batching your updates as appropriate.
A variable is a value that can change, depending on conditions or information supplied by the user. Using the Patchworks connector builder, variables can be defined at different levels:
Endpoint variables are displayed as fields for your users to complete whenever they configure a process flow connection shape to use an associated endpoint.
When a process flow runs, any associated API requests are injected with user-provided variable values wherever a corresponding {{variable}}
is found.
All variables added to connector builder API requests should be placed within double-curly brackets - for example: {{product_type}}
.
The sections below explain the use of variables in general terms - for specific guidance in a particular context, please use the links provided above.
When you choose to add or edit a variable, the add variable or manage variable page is displayed:
Options on this page are the same, irrespective of whether you're adding/managing connector variables, auth variables or endpoint variables. Use the table below as a guide for completing this page:
Key
The name to be used by Patchworks internally, when referencing this variable.
Display name
The field label that users will see if they are asked to enter a value for this variable.
Alias
The name used by the actual system when referencing this variable.
Default value
Enter a default value to be shown when this field is displayed to users. The maximum number of characters permitted is 1024.
The remaining fields on this page determine if/how your users will interact with this variable when adding an instance of this connector:
Is this required?
Toggle this option on to make this a mandatory field when a user either:
Is this configurable
Toggle this option on to make this an optional field when a user either:
Is this for advanced users only?
Advanced variables are those which 'regular' users would not typically need to see or change, but which advanced users might want to change in exceptional cases.
With this option toggled on, the field for this variable is hidden in an advanced section
when a user either:
Only select this option if this is a variable that 'regular' users would NOT typically need to see or change - but which advanced users might want to change in exceptional cases.
For example, the content-type
variable might typically be set too application/json
but you need to allow for edge cases in NetSuite, where an advanced user might want to change it to application/xml
.
Is this variable a secret?
Toggle this option on if values entered for this field are sensitive. Secret variables are encrypted and displayed as asterisks within the dashboard UI.
To edit a variable, simply click the variable name to open the standard variable settings page - for example:
From here, you can make your required changes and click the save button.
In some cases, a variable may be locked - these are variables which are required by Patchworks to perform a particular function (for example, default variables associated with authentication methods). In this case, you can't change settings or remove the variable, but you can change the display name.
In the case of a locked variable, you can change the name that users see for the associated field when they are asked to provide a value.
As such, we need to rename the To do this, click the field name and update the display name as appropriate - for example:
Building a database connector with the Connector Builder differs slightly from building standard connectors - instead of defining API endpoints, we define database queries. As such, you'll notice some UI variations from our standard Connector Builder guidelines.
Currently, the following database types are supported:
Database connectors are authenticated with username
and password
over SSL (if available, otherwise with no SSL).
We recommend ensuring that the accounts used to authenticate instances of this connector are associated with 'least privilege' permissions (so if you only need to read data, ensure that read-only permissions are applied).
Please ensure that any Patchworks variables used in queries are escaped, where appropriate - variable values are substituted at run time as-is; they are not interpreted, sanitised, or escaped automatically. For more information please see Working with queries.
Once you've chosen to add a new connector and launched the Connector Builder, a basic details form is displayed. For a database connector, you must set the system type
field to database
. This prompts a database type
field below - for example:
When you go on to choose a database type
and save this page, you'll step through a setup wizard to complete your connector setup:
This is very similar to the endpoint setup wizard, but there are some notable differences. These are detailed below:
As noted above, to build a database connector you must choose to set the system type
field to database
. This prompts a database type
field:
For more information on the basic details page please see our general Connector Builder section.
Variables are added and used as normal - i.e. any variables defined here are available when you move on to set up authentication for your connector:
For more information on the variables page please see our general Connector Builder section.
An authentication method must be defined as normal however, for a database connector the DB user pass authentication method should be used:
Having confirmed this selection, the default setup is displayed:
Values for all required authentication variables shown here must be provided when a user adds an instance of this connector. With the default (recommended) setup this means that the following values are expected:
username
password
port
host
database name
Unless you have a specific reason for changing this setup, you can just save this tab and continue.
Details for this authentication method are available on our DB user pass page. For more information on the authentication page please see our general Connector Builder section.
The queries tab is only displayed when you add a database
type connector. This is where you define queries that can be used in process flows (via the connector shape):
The process of adding a query is very similar to that of adding endpoints - having chosen to add a new system query
, you step through a series of pages to provide a name and a direction; define any required variables, add the query itself, and set pagination options.
If you're familiar with adding endpoints, you will recognise some of these options however, the steps below show specific setup requirements for queries.
Any issues found with queries at runtime (e.g. syntax errors) are reported from the database (verbatim) in run logs.
Connector instance variables defined here can be used when you . If you're defining multiple authentication methods which share common variables, define them once here and then choose to 'use' them in subsequent authentication methods.
Auth variables (whether added directly or picked up and 'used' from predefined connector instance variables) are displayed as fields for your users to complete whenever the associated authentication method is used to .
(in the case of and )
configures a with a given endpoint (in the case of ).
(in the case of and )
configures a with a given endpoint (in the case of ).
(in the case of and )
configures a with a given endpoint (in the case of ).
Specifies the table (orders
) into which the new row will be inserted.
Defines column names in the orders
table to receive values.
Defines placeholders for payload fields - these are replaced by actual values (from the payload) at runtime.
As noted above, to build a database connector, you must set the system type
field to database
. This prompts a database type
field below - for example:
Select your required database type from the dropdown field:
Add a name
for this query and choose the type of entity
that you're querying:
General details are added in the top panel, with query configuration in the tabs below:
In the top panel, set the direction of this query as appropriate - i.e. does it modify data (send
) or retrieve data (receive
)?
Move down to the authentication
tab and toggle the DB user pass
authentication method on
for this query:
If you want to add variables for inclusion in this query (so values can be provided at runtime and injected into queries), select the query variables
tab and add the required variables:
Select the query
tab to add your database query - for example:
If your query includes parameters for pagination (LIMIT
and OFFSET
), select the pagination
tab to define the required values to be passed in - for example:
When prompted, choose the DB user pass
authentication method, then enter your credentials and database details:
Complete other settings and save your changes. As soon as you save this page, the database connector setup wizard is launched.
The name
entered here is displayed to users when they configure a to use this connector and are looking for a query to apply. Click the create
button to confirm and access query configuration options.
For general information about these settings, please see our main - the same principles apply to both endpoints and queries.
For general information about these settings, please see our main - the same principles apply to both endpoints and queries.
For general information about these settings, please see our main - the same principles apply to both endpoints and queries.
For examples of how variables might be used, see . For general information about these settings, please see our main - the same principles apply to both endpoints and queries.
This is where you define your query using the required syntax for your database (in this case, it's MySQL). Syntax highlighting is included (verification is not currently available - any issues with queries will be ). Standard syntax is used for the database type however, there are some Patchworks conventions to consider - please see for more information.
Limit offset
is the most commonly used pagination method for databases. For general information on this topic please see our main - the same principles apply to both endpoints and queries.
Having created all your required queries, you can go on to add instances of this connector () in the :