HomeGuidesAPI ReferenceChangelogDiscussions
Log InAPI Reference
Guides

Batch transforming

You can easily make a chunk of code to transform grid data into the account request access and retrieve at the end an account context.
Let illustrate this with Bank of America (40002).

The data received from the bank


878

The options for the target connector

{
  ...
  "additionalPropertiesRequested": [
    {
      "name": "accountId",
      "title": "Account Id",
      "required": true,
      "description": "Id of the account given by the bank",
      "template": null
    },
    {
      "name": "bankId",
      "title": "Bank Id",
      "required": true,
      "description": "Account's Bank Id",
      "template": null
    }
  ]
  ...
}

The columns renamed

846

You can easily script the transformation from the excel into the json

{
  "connectorId": 40002,
  "bankSettingsCode": "BoA",
  "userContext": "{...}",
  ...
  "accountsAccessRequest": {
  "flowId": "987-ABC-789",
  "accounts": [
    {
      "iban": "ZZABC123456789",
      "additionalProperties": {
        "accountId": "XY1234",
        "bankId": "0987"
      }
    },
    {
      "iban": "ZZBCD132456789",
      "additionalProperties": {
        "accountId": "XY2345",
        "bankId": "0678"
      }
    },
    {
      "iban": "ZZCDE123456789",
      "additionalProperties": {
        "accountId": "XY3456",
        "bankId": "0678"
      }
    }
  ]
}
}

POSTing to /pb/ais/access

You can use it in the body for POST /pb/ais/access which will return (partial):

{
  "resultStatus": 1,
  "dataString": "",
  "options": null,
  "flowContext": "{\"Id\":...,\"RedirectUrl\":null}",
  "userContext": null,
  "rawResponse": null
}

where flowContext is a black box.

PUTing to /pb/ais/access

resultStatus is DONE(1), so you can call PUT /pb/ais/access with the flowContext and no dataString since we didn't went to the bank for validation

{
  "connectorId": 40002,
  "userContext": "{...}",
  "bankSettingsCode": "CITI",
  "flowContext": "{\"Id\":...,\"RedirectUrl\":null}",
  "dataString": ""
}

which returns the list of accounts with input data and account contexts' black boxes

{
  "accounts": [
    {
      "accountContext": "{\"accountId\":\"XY1234\",\"bankId\":\"0987\"}",
      "additionalProperties": {
        "accountId": "XY1234",
        "bankId": "0987"
      },
      "id": "XY1234",
      "currency": null,
      "iban": "ZZABC123456789",
      "description": null,
      "transactionsConsent": null,
      "balancesConsent": null
    },
    {
      "accountContext": "{\"accountId\":\"XY2345\",\"bankId\":\"0678\"}",
      "additionalProperties": {
        "accountId": "XY2345",
        "bankId": "0678"
      },
      "id": "XY2345",
      "currency": null,
      "iban": "ZZBCD132456789",
      "description": null,
      "transactionsConsent": null,
      "balancesConsent": null
    },
    {
      "accountContext": "{\"accountId\":\"XY3456\",\"bankId\":\"0678\"}",
      "additionalProperties": {
        "accountId": "XY3456",
        "bankId": "0678"
      },
      "id": "XY3456",
      "currency": null,
      "iban": "ZZCDE123456789",
      "description": null,
      "transactionsConsent": null,
      "balancesConsent": null
    }
  ],
  "resultStatus": 1,
  "dataString": null,
  "options": null,
  "flowContext": null,
  "userContext": null,
  "rawResponse": null
}

You can now store for later use the fields Id and accountContext of each bank account.