Now that the collections are downloaded, the integration is set up and the access token is acquired, it is time to use the API to send your flight data. This endpoint supports two formats: Comma-Separated Values and JSON Lines. Dates should be formatted in the ISO-8601 format. The following table details the flight data structure and all the available fields.

Comma-Separated Values

To upload flights in CSV format, select "Upload Flights from a CSV File" from the flights collection.

The format of the csv is strict and should look like the csv example below. When one or more parameters are not available, just leave them empty but don’t change the structure of the file.

YD,AMS,BCN,2017-12-17 14:06:40,1101,22,144,15,146,167255.90
YD,AMS,BER,2017-12-17 14:06:40,1102,17,147,4,148,195783.88
YD,BER,AMS,2017-12-17 14:06:40,1103,88,108,43,109,184722.29

When you are not using the collections, you can send the CSV by specifying the following:

PUT /api/projects/<project-id>/flights/upload
Host: https://<your_account>.yieldr.com
Authorization: Bearer <access_token>
Content-Type: text/csv

YD,AMS,BCN,2017-12-17 14:06:40,1101,22,144,15,146,167255.90
YD,AMS,BER,2017-12-17 14:06:40,1102,17,147,4,148,195783.88
YD,BER,AMS,2017-12-17 14:06:40,1103,88,108,43,109,184722.29

JSON Lines

To upload flights in CSV format, select "Upload Flights from a JSON File" from the flights collection. 

The format of the JSON is strict and should look like the example below. When one or more parameters are not available, just leave them empty but don’t change the structure of the file.

{"carrier":"YD","origin":"AMS","destination":"BCN","date_departure":"2016-05-05 13:27:44","flight_number":"1101","weight":"90","seats_sold":120,"seats_available":128,"projected_seats_sold":"130","revenue":101333.72}
{"carrier":"YD","origin":"AMS","destination":"BCN","date_departure":"2016-05-05 13:17:44","flight_number":"1101","weight":"17","seats_sold":147,"seats_available":4,"projected_seats_sold":"148","revenue":74178.00}
{"carrier":"YD","origin":"AMS","destination":"BCN","date_departure":"2016-05-05 13:07:44","flight_number":"1101","weight":"88","seats_sold":108,"seats_available":43,"projected_seats_sold":"109","revenue":122873.63}

When you are not using the collections, you can send the JSON by specifying the following.

PUT /api/projects/<project-id>/flights/upload
Host: https://<your_account>.yieldr.com
Authorization: Bearer <access_token>
Content-Type: application/x-jsonlines

{"carrier":"YD","origin":"AMS","destination":"BCN","date_departure":"2016-05-05 13:27:44","flight_number":"1101","weight":"90","seats_sold":120,"seats_available":128,"projected_seats_sold":"130","revenue":101333.72}
{"carrier":"YD","origin":"AMS","destination":"BCN","date_departure":"2016-05-05 13:17:44","flight_number":"1101","weight":"17","seats_sold":147,"seats_available":4,"projected_seats_sold":"148","revenue":74178.00}
{"carrier":"YD","origin":"AMS","destination":"BCN","date_departure":"2016-05-05 13:07:44","flight_number":"1101","weight":"88","seats_sold":108,"seats_available":43,"projected_seats_sold":"109","revenue":122873.63}
Did this answer your question?