What we have done and why
To showcase Moneyhub’s APIs we created a mobile app and documented our journey.

This process was intended to highlight areas that we think require consideration which at first might not be apparent.

The development and documentation will focus on looking at making real use of Moneyhub’s APIs through the lens of a mobile app and the considerations specific to the mobile platform.

Building an SDK client library

The first thing we did was to define all the interfaces and models used by Moneyhub’s data and identity APIs, and wrap them into a simple .NET SDK client library, so that accessing the APIs would be easy and simple.

The SDK client library used with a technology such as ReactiveUI.Refit means that users can get access to the APIs with just a few lines of code, and they don’t have to worry about creating all of the time-consuming definitions.

In the future we hope to extend this library to handle common use cases such as token management, retries, etc, as well as create versions in other languages such as in Kotlin.

Below is a short video that discusses the library and its use, the video transcript is also available below if you prefer to read than watch.
Moneyhub .Net API Client Video

The code can be found in the GitHub repo

Video transcript

This video covers an API client library that we’ve created in .NET, in order to access Moneyhub’s open banking APIs. Moneyhub ia a platform that allows access to the open banking ecosystem, allowing businesses to have access to open banking features without having to deal with the complexities of open banking implementation, or the legislation.

What we’ve done is create the interface definitions and all the models in .Net that can be used in conjunction with ReactiveUI Refit, to allow access to these APIs, removing the need to do a whole bunch of boilerplate code and hopefully making getting up and running with these APIs a lot faster.

If we take a look at Moneyhub’s APIs, this is their Swagger UI definitions. They have two main APIs; their identity API and their data API. We won’t cover the relationship between the two in this video. Obviously, it has its own security considerations and things like that, but we won’t go into that in this video.

Moneyhub’s documentation on this is really good and they’ll be linked in the description below.

Just in the identity API there’s quite a few functions and in the data one there’s even more allowing a whole raft of access to different data points. What we’ve created is definitions that sit over both of these services and hopefully it allows you to get up and running and accessing this good stuff much, much faster.

If we take a look, all the library defines is the APIs such as these in the two different areas, identity and data, and their associated models. Both requests and responses and any data models. Again, this is to help remove any boilerplate code you’d need to do and hopefully get you up and running faster. But by using refit trying not to be too prescriptive and allow you to sort of configure the HTTP client exactly as best suits your project.

We have created a sample project just to demonstrate how you can get up and running. And obviously there’s not much code in order to get access to these.

The one thing before this will work is there is some setup required in Moneyhub’s admin portal, so you’ll need to register with Moneyhub and create a client. The client defines your application or service that will use their APIs. When you do that, you’ll get a client ID and the client secret, they’re used in conjunction with the identity service in order to generate tokens of various scopes, which then in turn can be used to access their data API.

We won’t go into detail as to the relationship and the security model with these APIs, but it is important you need to consider where the client ID and secrets are kept, and that relationship.

Again, Moneyhub’s documentation is really good on this and that will be linked below.

Just to go over registering two different interfaces. This is registering the access token interface, which is the service that can be used to create tokens of various scopes which can then be used to access different data.

In order to make this work, all you’d need to do is configure the base address to the identity API endpoint. We then also provided a utility class here that you can just give your client ID and your client secret. It will then produce your authentication token in the right format. Allowing this to work and generate tokens of different scope.

For the data interfaces it’s slightly easier. All we need to do is provide the base address of Moneyhub’s data API. The tokens will be passed into each subsequent call because obviously the tokens need to be generated with the correct scope before that can be done.

To show devices access token and the accounts. And then here we’re making a call to get access token obviously there are some parameters, the grant type, the scope as I mentioned before, and the sub is a user that I pre created in Moneyhub’s backend that already has some data and banks authorised with it so we can get some some good data back.

Once we get that back, we’ll get a token back with the right scope to allow us to pass to the data API accounts getall, which will then hopefully pull back some useful data. So we just run that so we can inspect the difference. Again, the detail about how the scopes and how they all hang together, it’s not something we’ll cover, but it is important, and again Moneyhub’s documentation on this is pretty fantastic.

So as we can see here, the response we got back from the access token has given us a bearer token, which we can then pass into the getall accounts here, which then the response from this, we have some data and that is our bank data that we have set up in the back end of Moneyhub.

So that is basically it, again it’s a library to hopefully save you some time.

For any more information do see Monehub’s documentation, it’s pretty fantastic. All of this will be available on GitHub, we should also be detailed below and yeah, hopefully this will save you some time in your development.

You can read about the next stage of the project where we explore Identity Server to access Moneyhub’s API here.

If you are developing a mobile app using Open Banking and would like to discuss how we could support you on the project please get in touch.

Richard Woollcott

Author Richard Woollcott

More posts by Richard Woollcott