Access the Deutsche Bank API from your go application. - by Lukas Malkmus
The Deutsche Bank API provides developers with plausible costumer and bank data to let them build great, highly connected apps.
This package is a small wrapper around the Deutsche Bank API. It aims to be always up-to-date and cover all available http endpoints.
- Covering all endpoints
- Accounts (
/cashAccounts
) - Addresses (
/addresses
) - Transactions (
/transactions
) - UserInfo (
/userInfo
)
- Accounts (
- Selectable API version
- Easy to use
- Basic test suit
- Implement
/processingOrders
endpoint - [ ] Replace/userInfo
with/partners
- [ ] Provide authentication?
Create an account on the Developer Portal and follow the instructions there. The common workflow is to create an application and at least one test user to get started.
Please use a dependency manager like glide to make sure you use a tagged release.
Install using go get
:
go get -u github.com/lukasmalkmus/dbapi
The Deutsche Bank API is secured by OAuth2 and you need an access token to
retrieve data from the endpoints. This package does not provide an OAuth2
client since there are many good implementations out there. To use the dbapi
client you need the Access Token
.
To retrieve data you need to create a new client:
import github.com/lukasmalkmus/dbapi
const AccessToken = "..."
api, err := dbapi.NewClient(
dbapi.SetToken(AccessToken),
)
if err != nil {
log.Fatalln(err)
}
Since the access token is bound to a specific user the client can only scrape data from exactly this user.
Please note that the user must grant the correct rights (scopes
) during the
authentication process or you might not be allowed to access the corresponding
api endpoints.
It is also possible to use a custom http client to make requests:
// Create your custom http client.
client := &http.Client{
Transport: &http.Transport{
Proxy: http.ProxyFromEnvironment,
Dial: (&net.Dialer{
Timeout: 3 * time.Second,
KeepAlive: 30 * time.Second,
}).Dial,
ExpectContinueTimeout: 1 * time.Second,
ResponseHeaderTimeout: 3 * time.Second,
TLSHandshakeTimeout: 3 * time.Second,
},
}
// Use your custom http client.
api, err := dbapi.NewClient(
dbapi.SetToken(AccessToken),
dbapi.SetClient(client),
)
// ...
Options can also be applied to a client instance if it has already been created:
api, err := dbapi.NewClient()
api.Options(
dbapi.SetToken(AccessToken),
)
Accessing the endpoints is easy. Since the API is in an early state there aren't many enpoints, yet. A list of available endpoints can be found on the Developer Portal > API Explorer. Or take a look at the swagger specification.
accounts, response, err := api.Accounts.GetAll()
if err != nil {
fmt.Println(response)
log.Fatalln(err)
}
fmt.Printf("%v", accounts)
Feel free to submit PRs or to fill Issues. Every kind of help is appreciated.
© Lukas Malkmus, 2017
Distributed under MIT License (The MIT License
).
See LICENSE for more information.