I'm implementing a simple API flow which involves acting as a gateway to multiple upstream APIs.
Basically, a client provides a token to this endpoint, the server makes multiple sequential calls to APIs, gathers a bunch of information from the final call and returns it.
We receive a token, and go to Upstream API 1
, receiving back a bunch of Objects
associated with that token. There can be a theoretically unlimited amount of Objects
returned.
We then comma separate the IDs of each Object
, and go to Upstream API 2
with those comma separated ObjectIDs
to receive further MetaInformation
on all of the Objects
.
This MetaInformation
may not be unique to each Object
, so we can receive anywhere between 1 and the number of Objects
MetaInformation
back.
The intention is then for us to go to a third API with the comma separated MetaInformationIDs
, but this upstream API can only take 10 unique MetaInformationIDs
, meaning that we wouldn't be able to collect the information the client is expecting. We therefore are able to throw a failure case at this point without making the failing upstream request, but what HTTP status is appropriate to use?
It doesn't seem like the client has made a bad request, as they would have no way of knowing the amount of unique MetaInformationIds
at that point, but we would receive a 400
status were we to make a request with >10 MetaInformationIds
.
Any ideas?
EDIT: I forgot to mention for context that the upstream API is intending to upgrade in the future to support >10 unique IDs, hence it has been decided that for now, a multi-request solution to that API is not worth it. I wholeheartedly agree that it is a sub-optimal solution.