Using Bruno
Less than to read
To see the Transaction Import Connector API in action you can use Bruno, a modern API client with an intuitive GUI for configuring HTTP requests, designing JSON payloads, and viewing HTTP responses.
A Bruno collection is available to illustrate the Transaction Import Connector API methods and workflow.
Setting up Bruno
Step 1: Get Bruno
Visit the Bruno website to Download and install Bruno.
Bruno is available for Windows, macOS, and Linux. You can also install it via package managers:
macOS:
brew install bruno
Windows:
winget install Bruno.Bruno
Linux:
snap install bruno
Step 2: Get the Bruno collection
Bruno supports collections which are a pre-packaged bundle of API requests. To assist in the development and testing of your integration, we have provided our Bruno collection.
Download the Banking Service Bruno Collection from GitHub.
Step 3: Import the Bruno Collection
- Unzip the collection file from the downloaded archive
- Open Bruno
- Click Open Collection or use
Ctrl/Cmd + O
- Navigate to the unzipped folder and select it
- The collection will appear in your workspace
Step 4: Import Postman environment files
Bruno can import Postman environment files, making it easy to migrate from Postman. The environment JSON provided by Sage during registration contains the details of the sandbox test environment including your client ID and secret.
- Unzip the JSON format file from the downloaded ZIP archive
- Open Bruno
- Go to Environments in the left sidebar
- Click Import and select the environment JSON file
- Ensure the new environment is selected once imported
Using the Bruno Collection
Setup an organisation, company and bank account
The first element which is required for the transaction import is to have a valid organisation, company and bank account. In order to set this up the following calls need to be executed in this order:
This first call will setup the organisation and company in banking Service, the next call to run is GET /accessToken:
A JWT is returned when using this call and will now allow you to successfully run the POST bankAccounts:
The above image shows the new bank account which has been created for this run, the first step of the setup is now complete.
Setting up the transactions file
Before we can create a transaction import on the system a file needs to be generated using the provided scripts. For a CAMT053 file there is only one element of the script which needs to be updated, and this is the ID section, this value must be unique when submitting a file. The script and associated element are highlighted below:
For a JSON transaction file there are a couple of items that need to be updated prior to running the script. First you need to take the organisationId from the POST / Organisations call and replace the principalId in the script, secondly take the bankAccountId from the POST bankAccounts call and replace both instances of the bankAccountId in the script with this value. All of the values that need to be updated are highlighted below:
Once the relevant script is up to date then it can be run from the terminal, both scripts as it stands will create a file containing 100 transactions in the requested format.
Submitting a transaction import
With the file created, you can then post a transaction import. There are two specific calls for this, one for JSON and one for CAMT053. These are both as follows:
JSON
CAMT053
Once you have created an import using either of the above calls, you can then submit the matching transaction file, there are two separate calls for these and these are shown below. For each call you need to update the file in the body section of the call to the one which you have just created.
JSON
CAMT053
After submitting the files, you can monitor the status of the import using either the Get all imports for company, or Get single import calls. These will return the transaction import record included within this will be the status, once the status has updated to awaitingConfirmation then the Confirm import call can be ran:
Once the Confirm import call has been ran, continue to monitor the status of the import using the calls above until the import reaches a status of either complete or error.