Sandbox Data Management
Managing data in the sandbox
On this page
Sandbox default dataset
During the project creation workflow the smart sandbox database is populated with an initial default dataset. This data helps you get started with sandbox testing and is associated with the project client ID, so it's exclusive to the members of your Corporate sandbox project.
The default dataset can be for corresponding APIs can be found from the Sandbox Data Management Summary.
Adding data to the sandbox
Currently the sandbox supports file upload via the Developer Portal project details page or via self-service API.
The steps of adding data to the sandbox can be for corresponding APIs can be found from the Sandbox Data Management Summary.
Adding data via the Developer Portal
To add data to the Sandbox via the Developer Portal site, follow the steps below :
- Use the Dev Hub link to navigate to the project details page associated with your sandbox testing project.
- Scroll to the Sandbox Management section on the sandbox details page.
- The Test Data section contains the controls required to upload csv input files and reset the sandbox back to the default dataset.
- Download the csv template to populate your test data files in accordance with the required field names, please verify the input values against the above table schema to prevent file upload validation errors.
Adding data via the sandbox Management API
The swagger definition for this API is available here: Sandbox Management API
The Sandbox Management API is available to upload test data files and reset the sandbox directly from your development environment.
- Sandbox Management API:
POST/DELETE https://sandbox.corporate-api.hsbc.com/v1/sandbox-self-service/data
POST
method adds rows to the table defined in the headertable-name
DELETE
resets the sandbox table defined in the headertable-name
to the default dataset.
This example is a POST request that adds user generated data to the Sandbox. In the Treasury APIs example below, the authentication credentials are inserted as 'x-hsbc-client-id' and 'x-hsbc-client-secret'. The target table to update is specified in the ‘table-names' header field.
Treasury APIs |
Trade Finance APIs |
---|---|
curl --location --request POST 'https://sandbox.corporate-api.hsbc.com/v1/sandbox-self-service/baseline/data' \ |
curl --location --request POST 'https://sandbox.corporate-api.hsbc.com/v1/sandbox-self-service/baseline/data' \ |
Note: The cURL script above creates new entries in the Sandbox database based on the CSV file attached to the request. The table to update is specified in the table-names header. If the database contains an entry matching a row in the CSV (same accountNumber, accountCountry, institutionCode, and accountType), that row is updated with new data taken from the CSV.
Postman Collection
Postman is a third-party desktop application that is used to make API calls from a user interface. A complete API OAS specification, or a collection is imported and managed in Postman. A Postman Collection is generally a group of API calls saved in JSON, or some other format i.e. YAML, RAML cURL etc.
Read more about Postman at this website https://www.getpostman.com.
The attached collection in the Sandbox Data Management Summary is used to setup a Postman session for the Corporate APIs. Note the following points:
- Please download the file, unzip the content and load to your instance of Postman.
- Configure the Request Headers to use the credentials provided in your Sandbox project.
- If you are calling the Smart sandbox you need to encrypt, sign and base64 encode the payload using the keys provided in the Sandbox project.
- Please read the API reference documentation for any specific treatment required when calling your chosen API.
The below collection can be used to add new data into the sandbox database:
Sandbox Management APIs.postman_collection.zip
See also:
Detailed guide to Sandbox Data Management
Sandbox Data Management Summary
Section | Detail Steps | |
---|---|---|
Treasury APIs | Trade Finance APIs | |
Sandbox default dataset | Click here | Click here |
Adding data to the sandbox | Click here | Click here |
Sandbox management Postman collection | Perform the upload and rest commands for both the account and transaction table via Postman | Perform the upload and rest commands for bank guarantee, standby-dc and guarantee documents transaction table via Postman |