Hello,
I’ve been reading up on the discussions about posting bulk data or a collection of entities on both the forum and the git repo and haven’t reached at any useful conclusion, therefore, I decided to write a question of my own here with a clear example and hopefully reach a conclusion about it.
My case is creating a reservation. The reservation in itself doesn’t hold much data, but is composed of other components such as reservation_flight, reservation_accommodation, reservation_passenger.
How does one go about creating such a reservation where all the subcomponents are new (not already existent like the example in the specs)?
Client side generated ids is a no go for us and I believe it shouldn’t even be discussed whether its a good a idea or not, the receiver’s server should handle any such operations.
How would you format the following POST request body to be in accordance with json api’s specs?
{
"customer": {
"first_name": "Sean",
"last_name": "Donnel",
"address": "address"
},
"passengers": [
{
"first_name": "Sean",
"last_name": "Donnel",
"gender": "M",
"birth_date": "1980-01-01"
},
{
"first_name": "Alice",
"last_name": "Donnel",
"gender": "F",
"birth_date": "1980-01-01"
}
],
"accommodations": [
{
"accommodation_code": 38,
"check_in": "2020-11-20"
}
],
"flights": [
{
"flight_code": "FL-123131"
},
{
"flight_code": "FL-123131"
}
]
}