Closed JayRSG closed 1 year ago
@tsolakoua @xianqiliu I will be glad if you kindly advise me a solution for this problem that I am facing right now! I have found out its the src/resources/Resource.php: fromArray(Response $response, string $class) method which is where the problem is originating.
The $response has got the complete response as of the Amadeus Self Service APi endpoint for FlightOffersSearch would return, but the implementation in the said method is not being able to handle the reponse properly and the resource object being returned is returning the data I have mentioned in my Issue #97
Eagerly waiting for your response. Thanks.
@tsolakoua @xianqiliu I will be glad if you kindly advise me a solution for this problem that I am facing right now! I have found out its the src/resources/Resource.php: fromArray(Response $response, string $class) method which is where the problem is originating.
The $response has got the complete response as of the Amadeus Self Service APi endpoint for FlightOffersSearch would return, but the implementation in the said method is not being able to handle the reponse properly and the resource object being returned is returning the data I have mentioned in my Issue #97
Eagerly waiting for your response. Thanks.
@JayRSG Hey, the reason why the returned data is incomplete may be that the sdk's FlightOffer
resource is not totally matching with the FlightOffer
object in Amadeus Flight offer search API response model
. And the way you use the sdk $flightOffers = $this->amadeus ->getShopping()->getFlightOffers()->get($data);
, which will only return row data matching in FlightOffer
resource in this sdk.
So if you want the full data, you can create a PR to update the "FlightOffer" resource in this sdk to exactly match the official Amadeus "FlightOffer" object in the API response. Or you can directly use this sdk to get data, as follows:
// Make a GET request only using path
$amadeus->getClient()->getWithOnlyPath("/v1/airport/direct-destinations?departureAirportCode=MAD");
// Make a GET request using path and passed parameters
$amadeus->getClient()->getWithArrayParams("/v1/airport/direct-destinations", ["departureAirportCode" => "MAD"]);
// Make a POST request using path and passed body
$amadeus->getClient()->postWithStringBody("/v1/shopping/availability/flight-availabilities", $body);
Since there is a working solution provided by @xianqiliu, closing this issue.
Calling the getFlightOffers endpoint through
$flightOffers = $this->amadeus->getShopping()->getFlightOffers()->get($data);
Steps to Reproduce
Expected Behavior: Expecting Amadeus FlightOffers data according to the API specification
Actual Behavior: Receiving partial data. { "data": [ { "lastTicketingDateTime": "2023-06-05" }, { "lastTicketingDateTime": "2023-05-31" }, { "lastTicketingDateTime": "2023-05-31" } ] }
Request payload: originLocationCode:SYD destinationLocationCode:BYK departureDate:2023-06-05 adults:1 max:10
Stable Behavior? It is consistently generating the same result every time
Versions
PHP version: 7.4.16 Laravel version: 8.75 postman: v10.14
Checklist
amadeus-php version: 0.3.0