0

I have a Demand class which has a list of Contract When I get the Demand I receive both Demand and Contract in body response. This is my Json response when getting demand Object using this url

(http://localhost:8080/v1/demande/getDemande/1):

{
    "id": 1,
    "codeProduct": 14,
    "demandeType": "string",
    
    "contracts": [
        {
            "id": 2,
            "contractType": "string",
            "endDate": "2022-12-31T23:00:00.000+00:00",
            "startDate": "2022-12-31T23:00:00.000+00:00",
        }
    ]
}

and this is my Json object when trying to retrieve only Contract Object using this url (http://localhost:8080/v1/demande/getContrat/2)

{
    "id": 2,
    "contractType": "string",
    "endDate": "2022-12-31T23:00:00.000+00:00",
    "startDate": "2022-12-31T23:00:00.000+00:00",
}

My goal is that I want to send first request to get Demand Object because I need that contract id, and after I get the id of contract I have to send another request to get the Contract Object

Is there any example ? Thank you really appreciate your help.

BAKHALED Ibrahim
  • 473
  • 1
  • 7
  • 19
  • It just depends on your implementation. It is not framework specific problem. Did you debug your code? – Numichi Jun 25 '23 at 20:42
  • You could use a higher order mapping operator like `switchMap` to switch from one request to another. See [this](https://stackoverflow.com/a/63685990/6513921) post for more info. – ruth Jun 26 '23 at 08:27
  • Demand contains a list of Contracts. Which contract do you want to get? the first? – Zerotwelve Jun 26 '23 at 12:07

0 Answers0