Steps to reproduce the bug
Try to build a client that interfaces with the described API
Realise the documentation is incomplete
Expected behaviour:
I expect the API documentation to accurately reflect the API's behaviour.
Actual behaviour:
The example requests suggest using a Basic auth header, though Bearer <token> also works.
The response-type information provided by the documentation is incomplete.
More information
The response schema for http://api.investec.com/za/bb/v1/accounts, as far as I can determine with the CIB accounts I have access to can be represented as follows:
(note: in order to figure out what is actually returned I'm validating the responses with Joi)
const investecCIBAccountsResponseSchema = Joi.object({
data: Joi.object({
accounts: Joi.array().items(
Joi.object({
AccountFormat: Joi.allow('99'), // TODO: some enum?
AccountFullName: Joi.string().allow(''),
AccountHolderAddress: Joi.object({
AddressLine1: Joi.string().allow(''),
AddressLine2: Joi.string().allow(''),
City: Joi.string().allow(''),
Country: Joi.string().allow(''),
CountryCode: Joi.string().allow(''),
}), // TODO: investigate
AccountId: Joi.string(),
AccountName: Joi.string(),
AccountNumber: Joi.string(),
AccountOpenDate: Joi.string().isoDate(),
AccountType: Joi.string(),
AccountTypeId: Joi.string(),
ActiveFlag: Joi.string().allow('Y', 'N'), // TODO: some enum?
AlternativeAccNo: Joi.string().allow(''),
AutomaticPaymentOrder: Joi.string(),
BackOfficeCustomerCode: Joi.string(),
BackOfficeType: Joi.string().allow(''), // TODO: some enum?
Balances: Joi.object({
CapitalBalance: Joi.number(),
AvailableBalance: Joi.number(),
PrincipalAmount: Joi.number(),
ValueDate: Joi.string().isoDate(),
ClosingBalance: Joi.number(),
PendingCardBalance: Joi.number(),
// TODO: more properties? nullable?
}),
BankAccountProductType: Joi.string().allow(''),
Banks: Joi.object({
Branch: Joi.array().items(Joi.object({ Number: Joi.string().allow('') })),
ChipsUID: Joi.string().allow(''),
Name: Joi.string(),
PostalAddress: Joi.object({
AddressLine1: Joi.string().allow(''),
AddressLine2: Joi.string().allow(''),
City: Joi.string().allow(''),
Country: Joi.string().allow(null),
// TODO: more properties? nullable?
}),
// TODO: more properties? nullable?
}),
Category: Joi.string().allow('Invest'), // TODO: some enum?
CreatedDate: Joi.string().isoDate(),
CreditLastCycleToNextBusinessDate: Joi.string().isoDate(),
CreditLimit: Joi.number(),
CumulativeNoticesAmount: Joi.number(),
Currencies: Joi.object({
CurrencyCode: Joi.string().allow('ZAR'), // TODO: which currency codes are supported
// TODO: more properties? nullable?
}),
CustomerAccountType: Joi.string().allow(''),
DealReference: Joi.string().allow(''),
DebitAccountBankName: Joi.string().allow(''),
DebitAccountNumber: Joi.string().allow(''),
DebitLastCycleToNextBusinessDate: Joi.string().isoDate(),
Description: Joi.string(),
DueDateOfPayment: Joi.string().isoDate(),
ElectronicAccountNumber: Joi.string().allow(''),
EmailAddress: Joi.string().allow(''),
InstantAvailableNoticeBalance: Joi.number(),
InterestDistribution: Joi.string().allow(''), // TODO: some enum?
Interests: Joi.object({
Amount: Joi.number(),
Rate: Joi.number(),
RateMaturity: Joi.number(),
RateCredit: Joi.number(),
RateDebit: Joi.number(),
AccruedCreditInterest: Joi.number(),
AccruedDebitInterest: Joi.number(),
// TODO: more properties? nullable?
}),
LinkedAccount: Joi.string().allow(''), // TODO: what does this mean?
loggedOnUser: Joi.object({
UserFirstName: Joi.string(),
UserLastName: Joi.string(),
UserCompany: Joi.string(),
// TODO: more properties? nullable?
}),
MaturityAmount: Joi.number(),
MinimimAmountLimit: Joi.number(), // TODO: spelling?
MinimumAmountLimit: Joi.number(),
ModifiedDate: Joi.string().isoDate(),
NickName: Joi.string(),
NoticeInterestAccount: Joi.string().allow(''),
noticeInterestAccountName: Joi.string().allow(''),
NoticeInterestBank: Joi.string().allow(''),
NoticeInterestNominated: Joi.number(),
NoticesBalance: Joi.number(),
NumberOfCardHolders: Joi.number(),
OwnerType: Joi.string(), // TODO: some enum?
PendingTransactions: Joi.number(),
PreviousStatementPeriod: Joi.string().isoDate(),
Products: Joi.object({
StartDate: Joi.string().isoDate(),
EndDate: Joi.string().isoDate(),
OverdraftLimit: Joi.number(),
MaxTransferLimit: Joi.number(),
// TODO: more properties? nullable?
}),
RoutingBIC: Joi.string().allow(''),
StatementDay: Joi.string(), // TODO: probably numeric?
StatementFrequency: Joi.string().allow(''),
StatementMonth: Joi.string().allow(''),
StatementNumber: Joi.string().allow(''),
})
),
}),
meta: Joi.object({
totalPages: Joi.number(),
}),
links: Joi.object({
self: Joi.string().allow(null),
}),
});