I have a question about following scenario I am trying to implement in Java JAX-RS REST:

  1. a client app sends request to my api, lets call it MY-API
  2. MY-API receives request, and sends it to vendor api (VENDOR-API)
  3. VENDOR-API replies back to MY-API
  4. MY-API replies back to the client

My questions is about point 2 and 3 above.

  • Is it possible to break up request coming from client app once it is received in MY-API so that MY-API sends multiple requests to VENDOR-API instead of one?
  • And then upon receiving the requests from VENDOR-API, combine them back into single response to client app?

I am thinking about something like this in pseudo code:

public class CarsController
     1. send request to /car-detail endpoint
     1.a. get response from /userDetails endpoint

     2. send request to /car-image endpoint
     2.a. get response from /userImages endpoint
     3. send request to /car-history endpoint
     3.a. get response from /userHistory endpoint

     5. Somehow build response for /cars from the
        3 requests above and send response back to client
New contributor
dbnex14 is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  • 1
    It's possible. There's nothing much special about it. Use an http/rest client library. or vendor's client library to make requests of the vendor. After they are done build and send a response to. your client. What's the obstacle? There are fine points and practical issues such as, how long does it take for vendor to respond? Is it too long for your client? Etc. – joshp yesterday
  • Thank you @joshp. I thought so, just not experienced in the area and never saw such scenario in many examples teaching REST. do you have any suggestion to look at? – dbnex14 16 hours ago

Your Answer

dbnex14 is a new contributor. Be nice, and check out our Code of Conduct.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.