Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Patchworks API requests must be authenticated with a bearer token. To obtain a token, you need to send a login request which includes credentials that you use to access the Patchworks dashboard.
Step 1 Create a POST request for the following endpoint:
This endpoint is for the Patchworks production environment.
Step 2 In the request body, add the email and password that you use to log into the Patchworks dashboard. You should add this as JSON - for example:
Step 3 Send the request - if successful, a token is returned. For example:
Access tokens are valid for 24 hours - for example: Issued: Wednesday 20th July at 10:03:08 GMT Expires: Tuesday 21st July at 10:03:08 GMT
Step 4 Save this token ready for use in your initialise request.
The Patchworks inbound API supports data within strings. This data must be passed within a payload
key.
The required data format is a JSON object with a payload key containing a string of data. For example:
Non-strings and raw payloads are not currently supported.
Here, note that the payload
key is in a JSON object, and is being used to hold different types of data as strings - text, XML and JSON.
All steps required to initialise a process flow via the Patchworks Core API are detailed below. This page provides a quick overview of these steps.
When you send a Patchworks API request to initialise a process flow, you must provide the internal IDs for the required process flow and version. This guide walks through the steps required to obtain this information.
Step 1 Log in to the Patchworks dashboard.
Step 2 Select process flows from the left-hand navigation menu and select the process flow that you want to update.
Step 3
Check the title bar in the top-left corner and make a note of the number above the title - this is the process flow ID
:
Step 4 Click the settings icon:
...to access process flow settings:
Step 5
Look in the versions panel and find the version of this process flow that you want to initialise, then note the associated ID - this is the process flow version ID
:
For more information about process flow versioning please see our Process flow versioning page.
Step 6 You'll use this information later in any API requests made to initialise this process flow.
This section walks through the steps required to pass data from your own system into a Patchworks process flow, via the Patchworks API.
To complete these steps it's assumed that you have:
Registered for a Patchworks account and have a username and password to access your Patchworks dashboard
Built at least one process flow that you want to update via the Patchworks API
The required steps are detailed in the following stages:
Stage # | Action | Tool |
---|---|---|
In this guide we're using Postman for API calls - you can use your preferred tool for these steps.
If your process flow is sending source data into a target connection, you should map this data using the map shape. This is done in the usual way with two points to note:
In a typical situation, the map shape is used to map data from a source connection to a target connection. However in this scenario, we don't have a source connection - Patchworks doesn't know what data you are sending in or what system it's coming from.
As such, you won't select any source details when configuring the map shape - just leave these field blank:
Because Patchworks has no way of knowing the structure of your incoming data, mapping rules must be added manually.
For further guidance please see our Working with field mappings page.
Having obtained a Patchworks token, it can be applied to an API request to initialise a process flow with your data passed in the request body.
You must control when your API requests are sent - the process flow trigger shape schedule cannot currently be used. With this in mind, please ensure that the default trigger shape in your process flow is not configured with any schedules.
Step 1 Create a POST request for the following endpoint:
...replacing <flowID>
and <flowVERSION>
with details for your required process flow noted previously.
This endpoint is for the Patchworks production environment.
Step 2
In the request headers
, pass in the token obtained previously - this should be prefixed with the word Bearer
- for example:
Step 3
In the request body
, pass in the required payload - for example:
Remember that the payload must be provided as a JSON object with a payload key containing a string of data. For more information please see Preparing your data.
Step 4
Send the request - if successful, a 200 'flow initialised' response is given, together with a flow run id
:
You can check the status of this flow run via the run logs.
1
Your preferred text editor
2
Patchworks dashboard (process flows)
3
Patchworks dashboard (process flows)
4
Postman
5
Postman