Sandbox Data Management

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 :

  1. Use the Dev Hub link to navigate to the project details page associated with your sandbox testing project.
  2. Scroll to the Sandbox Management section on the sandbox details page.
  3. The Test Data section contains the controls required to upload csv input files and reset the sandbox back to the default dataset.
  4. 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.

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' \
--header 'x-hsbc-client-id: your-project-client-id' \
--header 'x-hsbc-client-secret: your-project-client-secret' \
--header 'x-hsbc-profile-id: your-project-profile-id' \
--header 'product-category: treasury' \
--header 'category-version: 1.0' \
--header 'table-names: comma-separated-table-names' \
--header 'product-names: comma-separated-product-names'

curl --location --request POST 'https://sandbox.corporate-api.hsbc.com/v1/sandbox-self-service/baseline/data' \
--header 'x-hsbc-client-id: your-project-hsbc-profile-id' \
--header 'x-hsbc-client-secret: your-project-client-secret' \
--header 'x-hsbc-profile-id: your-project-organisation-id' \
--header 'product-category: trade finance' \
--header 'category-version: 1.0' \
--header 'table-names: comma-separated-table-names' \
--header 'product-names: comma-separated-product-names'

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

 

Return to top