Data Import format for creating sandbox data. - OpenBankProject/OBP-API GitHub Wiki
This page refers to a data import format. (The API does not return data like this)
If you would like to create new banks, accounts and transactions on our sandbox, use this json format and send the file to us at contact AT openbankproject.com and we'll import it for you.
An example file for data import can be found in the repo.
If you wish to create your own sandbox, follow the Custom Instance instructions below.
Notes:
- bank id must be unique
- email must be unique
- account id must be unique for the bank
- accounts.bank must be specified in the top level "banks"
- accounts.number must be unique for the bank
- accounts.balance amount represented as a string
- transactions.id must be unique for the account
- accounts.owners: at least one is required, and must be specified in the top level "users"
- generate_public_view: if this account and its data should be visible to anyone without authentication (some fields will be hidden)
- transactions.this_account: must be specified in the top level "accounts"
- transactions.counterparty: optional, but useful if specified.
- transactions.details.new_balance: represented as a string (the balance of the account after this transaction)
- transactions.details.value: represented as a string (the amount of the transaction, negative if money left the account, positive if it came in)
Once the data has been imported you can view it / manage it using: https://sofisandbox.openbankproject.com
Custom data
To populate your OBP database with sandbox data:
- In the API's props file, set
allow_sandbox_data_import=true
Probably best then, is to use the API Explorer (https://github.com/OpenBankProject/API-Explorer):
-
Get your
user_id
from the API Explorer at/#2_0_0-getCurrentUser
-
Add this id to
super_admin_user_ids
in the API's props file and restart the API -
Go back to API Explorer, log in again and grant your user the role
CanCreateSandbox
at/#2_0_0-addEntitlement
(makebank_id
empty) -
Now post the JSON data using the payload field at
/#2_1_0-sandboxDataImport
-
If successful you should see an empty result
{}
and no error message
Docker instance
If you are using an OBP Docker image e.g.: https://hub.docker.com/r/openbankproject/obp-full/
Follow the link to it's docker file e.g. https://github.com/OpenBankProject/OBP-Docker
and then the props e.g. https://github.com/OpenBankProject/OBP-Docker/blob/master/props/OBP-API.default.props
use the value in sandbox_data_import_secret for the "CHANGE_ME" value in the POST request above.
Add more transactions after initial import
If you wish to sync your sandbox / OBP instance with an incoming source of transactions you have at least 3 choices:
1) Use the management endpoint: /obp_transactions_saver/api/transactions
to POST new transactions. You will need to set the following in your Props file: importer_secret=change_me
See this test for the json format required
2) Use the OBP Kafka connector to source transactions in real time.
See here. You can write your OBP Kafka connector in any language you like.