I have a rails platform that I maintain. It has a lot of different web applications built on top of it. However now a client is asking for an API so that they can keep users on their site, but take advantage of some of the automated tasks we have.
The platform is used to build insurance applications and allows for their purchase online, as well as providing ways to download documentation related to your policy.
So my question when building the API is this:
When I have to do a lot of things, like validate
, create a user
, user profile
, and policy
, pretty much at the same time. Should I make 4 separate API calls, and make the client build 4 calls on their side. OR should I have one call that excepts a lot of parameters, that validates the client and creates all 3 of those things at the same time, simplifying things for the client?
The client, in this case, gets all of the required information at the same time, so its not like there is a natural flow in their application where it pauses and they can make an API call to my platform.
Having been on the client side using many API's before, my gut is to make it as simple for the client as possible and have them make just one call. However this is leading to rather large functions
in the API, which I'm not a fan of either.
How do you suggest I tackle this?
As a note, I am not very confident in the clients ability to implement a complicated API on their side.