POST api/Flights

Creates a new flight and automatically generates tickets for each seat in the associated airplane.

Request Information

URI Parameters

None.

Body Parameters

The flight object to be created.

Flight
NameDescriptionTypeAdditional information
Id

integer

None.

FlightNumber

string

None.

AirplaneId

integer

None.

OriginAirportId

integer

None.

DestinationAirportId

integer

None.

DepartureDate

date

None.

DepartureTime

time interval

None.

Duration

time interval

None.

ExecutivePrice

decimal number

None.

EconomicPrice

decimal number

None.

Request Formats

application/json, text/json

Sample:
{
  "Id": 1,
  "FlightNumber": "sample string 2",
  "AirplaneId": 1,
  "OriginAirportId": 1,
  "DestinationAirportId": 1,
  "DepartureDate": "2025-06-16T12:21:43.4830846Z",
  "DepartureTime": "00:00:00.1234567",
  "Duration": "00:00:00.1234567",
  "ExecutivePrice": 9.0,
  "EconomicPrice": 10.0
}

application/x-www-form-urlencoded

Sample:

Sample not available.

Response Information

Resource Description

A 201 Created response with the created flight if successful; otherwise, a 400 Bad Request or 500 Internal Server Error response.

IHttpActionResult

None.

Response Formats

application/json, text/json

Sample:

Sample not available.