Flight Rate APIs
Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.
This API provides the pricing data for the flight fares.
Parameter | Definition |
Authentication | Gaining access to the API. |
Entity | Search the entity. |
Flightrates | Rates of flight fares and has five operations |
Schedules | Set schedule of flight rates |
Hooks | Providing data as per endpoint |
Shops | Create shops |
Authorization
Every request sent to the Flightrates API must be authenticated with an access token. You can obtain an access token when you log-in using the credentials provided to you in your ReputationAPI packet. An access token is valid only for 24 hours from the time it is generated.
The access token must be appended to the ‘Authorization Header’ as depicted in the example below: If ‘A90324XXZUZUgpO0dd6npHcM83CJ…’ is your access token, every request must contain the following header:
Base URLs:
Request and Response Parameters
Common Request Header / Body / Query Parameters
The Request Header parameters is applicable to all other field attributes and features
Name | Requirement (True or False) |
Data Type | Description |
---|---|---|---|
Authorization | Required | String | The JWT Token in format "Bearer xxxx.yyyy.zzzz" |
The Request Body / Query parameters is applicable to all other field attributes and features.
Name | In | Requirement (True or False) | Data Type | Description |
---|---|---|---|---|
page | query | Optional/False | Integer / Number | Enter the page number with default value as 1 |
size | query | Optional/False | Number/ integer | Enter the size of data with the default value as 10 |
Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.
Authentication
Auth & User Management
Auth is handled using the usual JWT bearer tokens with a configurable default expiry (usually 24 hours).
- There is a POST /auth route, where the user provides the username and password, and gets back a valid JWT on a successful authentication. This JWT must be supplied in the header for all subsequent calls to the API.
- As our generic APIs may need to be accessed programmatically from other backend servers, can additionally provide certain users with a secure API Key (with a rotation/regeneration functionality) with an IP whitelisting for the accessing server(s).
Base URLs:
Web: Aggregate Intelligence Inc.
Get User Login Authentication by Email and Password
User login
Code samples
# You can also use wget
curl -X POST https://flightrates-api-stg.aggregateintelligence.com/api/v1/login \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
POST https://flightrates-api-stg.aggregateintelligence.com/api/v1/login HTTP/1.1
Host: flightrates-api-stg.aggregateintelligence.com
Content-Type: application/json
Accept: application/json
const inputBody = '{
"handle": "rishi",
"password": "rishi"
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('https://flightrates-api-stg.aggregateintelligence.com/api/v1/login',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.post 'https://flightrates-api-stg.aggregateintelligence.com/api/v1/login',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.post('https://flightrates-api-stg.aggregateintelligence.com/api/v1/login', headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('POST','https://flightrates-api-stg.aggregateintelligence.com/api/v1/login', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://flightrates-api-stg.aggregateintelligence.com/api/v1/login");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://flightrates-api-stg.aggregateintelligence.com/api/v1/login", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
This POST method searches for the matching user login credentials to authenticate / validate the credentials, based on the provided search key and the respective values passed, with Permission as PUBLIC.
POST /login
This call authenticates the validity of a handle/password combination. If the authentication is successful, a valid access token is issued.
Input Method - Resource URL
Base URLs
Request Query Parameters
Name | In | Data Type | Requirement (True or False) | Description |
---|---|---|---|---|
body | body | userreq | true | None |
Sample Request (JSON Code Format Snippet)
{
"handle": "myEmail@ggregateintelligence.in",
"password": "myNewPassword"
}
Request Body
Parameter Name | Type | Description | Requirement (Optional or Mandatory) |
---|---|---|---|
handle | String | Enter a username only | Required / Mandatory |
password | String | Enter a password | Required / Mandatory |
Sample Response (JSON Code Format Snippet)
200 Response
{
"error": "false",
"handle": "myEmail@ggregateintelligence.in"
"token": "authToken.abc.xyz"
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | success | userResp |
401 | Unauthorized | Authentication Failed! | None |
404 | Not Found | User Not Found | None |
Entity
Code samples
# You can also use wget
curl -X POST https://flightrates-api-stg.aggregateintelligence.com/api/v1/entity/sources/search \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
POST https://flightrates-api-stg.aggregateintelligence.com/api/v1/entity/sources/search HTTP/1.1
Host: flightrates-api-stg.aggregateintelligence.com
Content-Type: application/json
Accept: application/json
const inputBody = '{
"searchTerm": "Test1 Airline",
"channel": "Direct"
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('https://flightrates-api-stg.aggregateintelligence.com/api/v1/entity/sources/search',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.post 'https://flightrates-api-stg.aggregateintelligence.com/api/v1/entity/sources/search',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.post('https://flightrates-api-stg.aggregateintelligence.com/api/v1/entity/sources/search', headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('POST','https://flightrates-api-stg.aggregateintelligence.com/api/v1/entity/sources/search', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://flightrates-api-stg.aggregateintelligence.com/api/v1/entity/sources/search");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://flightrates-api-stg.aggregateintelligence.com/api/v1/entity/sources/search", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
This module allows the API customer to check the availability of specific brands and Online Travel Agency (OTA) in the system allows the customer to request inclusion of new sources.
Search
This GET method searches for the matching user login credentials to authenticate / validate the credentials, based on the provided search key and the respective values passed, with permission as USER.
Search the entity information according to the search items.
POST
Request URL Parameters
POST /entity/sources/search
The user requests the list of available OTAs and Brands.com and the input parameter is the Airline name & OTA name, which is basically a contained search
Sample Request (JSON Code Format Snippet)
{
"searchTerm": "Test1 Airline",
"channel": "Direct"
}
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | entityReq | true | none |
Example responses
200 Response
{
"searchTerm": "Test1 Airline",
"matchingSources": [
{
"_id": "63da12eabc77a3a8ef7f1765",
"source": "Test1 Airline",
"code": 40,
"isActiveStatus": true,
"channel": "Direct",
"_t": "flights",
"createdAt": "2023-02-01T07:21:14.073Z",
"updatedAt": "2023-02-01T07:21:14.073Z",
"__v": 0,
"id": "63da12eabc77a3a8ef7f1765"
}
],
"channel": "Direct"
}
Request Header Parameters
The user requests the list of available OTAs and Brands.com and the input parameter is the Airline name & OTA name, which is basically a contained search.
Request Query Parameters
The user requests the list of available OTAs and Brands.com and the input parameter is the Airline name & OTA name, which is basically a contained search.
Name | Data Type | Requirement (True or False) | Description |
---|---|---|---|
SearchTerm | String | Required | Enter the airline name to search |
Channel | String | Optional | Enter the name of the channel directly or the OTA |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Success | entityResp |
401 | Unauthorized | Authentication Failed | None |
404 | Not Found | User Not Found | None |
POST /entity/sources/addrequest
Request: The user would provide the name (ideally unique, and non-existing) and channel type (OTA/Brand/Meta) to add. The DA team would evaluate the addition request internally and respond accordingly at the earliest.
Response: HTTP Status 202 Accepted
Flight Rates
To get the list of flight travel rate details.
This GET method searches for the matching user flight rates and prices from sources /sites to authenticate / validate the credentials, based on the provided search key and the respective values passed, with Permission as USER.
GET /flightrates/{fsid} -> /flightrates/:id
Code samples
# You can also use wget
curl -X GET https://flightrates-api-stg.aggregateintelligence.com/api/v1/flightrates/{fsid} \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
GET https://flightrates-api-stg.aggregateintelligence.com/api/v1/flightrates/{fsid} HTTP/1.1
Host: flightrates-api-stg.aggregateintelligence.com
Accept: application/json
const headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('https://flightrates-api-stg.aggregateintelligence.com/api/v1/flightrates/{fsid}',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.get 'https://flightrates-api-stg.aggregateintelligence.com/api/v1/flightrates/{fsid}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.get('https://flightrates-api-stg.aggregateintelligence.com/api/v1/flightrates/{fsid}', headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','https://flightrates-api-stg.aggregateintelligence.com/api/v1/flightrates/{fsid}', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://flightrates-api-stg.aggregateintelligence.com/api/v1/flightrates/{fsid}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://flightrates-api-stg.aggregateintelligence.com/api/v1/flightrates/{fsid}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
The general workflow for retrieving the collected flight rates data for an end user is as follows:
1. User defines one or more Flight Shops
2. User defines a schedule to fetch & update data pertaining to the flight shop.
3. In the backend, the harvesting of (as per DAv2 processes) & delivering (writing to Mongo DB as per the processes of the Ingestion Strategies) the required data according to the schedules.
4. User hits an endpoint GET /flightrates/{fsid} at any point of time to retrieve the latest harvested data for the given shop id. The responses are structured as an array of data points (fetched from Mongo DB), each element being similar in structure to our defined Schema. As huge volumes of data are involved, ample implementation of effective pagination to be provided for assorted filtering.
Request Body Parameters
Name | In | Requirement (True or False) | Data Type | Description |
---|---|---|---|---|
fsid | path | Required / True | Objectid - String | Enter flightshop objectId, - which must be the shop reference |
page | query | Optional/False | Integer / Number | Enter the page number with default value as 1 |
size | query | Optional/False | Number/ integer | Enter the size of data with the default value as 10 |
Sample Request (JSON Code Format Snippet)
"error": false,
{
"Flightrates": [
{
"travellers": {
"adults": 1,
"infants": 0
},
"_id": "63a59bf4533a40315c201e5f",
"outbound": {
"price": 171,
"baseFare": 0,
"feesAndOthers": 0,
"description": "",
"numOfStops": 1,
"metaProviderName": "",
"layover": "08:21",
"flightStatusCode": 1,
"departureDate": "2022-08-17T00:00:00.000Z",
"departureTime": "12:45",
"arrivalDate": "2022-08-18T00:00:00.000Z",
"arrivalTime": 2,
"totalDuration": "12:38",
"flightTime": "04:17",
"actualPrice": 0,
"actualBaseFare": 0,
"actualFeeAndOthers": 0,
"_priceClass": {
"_id": "6135b5e611fa4d03dceeef07",
"channel": "OTA",
"source": "Airpaz",
"id": "6135b5e611fa4d03dceeef07"
},
"priceClassName": "Standard",
"legs": [
{
"_id": "6404c871a152811058394add",
"origin": "CUN",
"destination": "FLL",
"description": "",
"distance": "0,",
"fbc": "",
"seatCount": "null,",
"departureDate": "2022-08-17T00:00:00.000Z",
"departureTime": "12:45",
"arrivalDate": "2022-08-17T00:00:00.000Z",
"arrivalTime": "15:38",
"airlineShortCode": "NK",
"flightNumber": "NK-528",
"flightTime": "01:53",
"waitTime": "08:21",
"operatedBy": "",
"_airline": {
"_id": "601bb896f764ad17a4b71e66",
"displayName": "Air Arabia",
"id": "601bb896f764ad17a4b71e66"
},
"airlineName": "Air Arabia",
"airlineCode": 1,
"_aircraft": {
"_id": "601bb919f764ad17a4b71e7f",
"displayName": "Boeing 737",
"id": "601bb919f764ad17a4b71e7f"
},
"aircraftName": "B-737"
}
],
"baggageDetails": "",
"promoCode": "",
"discounts": "",
"taxStatus": 12,
"_id": "6404c871a152811058394adf",
"allFlightNumbers": [
"NK-528, NK-844"
],
"allStopOverAirports": [
"CUN, FLL, SDQ"
],
"allAirlineCodes": [
"1, 1"
],
"id": "6404c871a152811058394adf"
},
"flyFrom": "CUN",
"flyTo": "SDQ",
"isRoundTrip": "false,",
"departDate": "2022-08-17T00:00:00.000Z",
"returnDate": "2022-08-18T00:00:00.000Z",
"channelName": "Spirit",
"channelType": "brand",
"airlineCode": 35,
"totalPrice": 171,
"isRatePerPerson": false,
"previousPrice": "",
"isMultipleAirline": "false,",
"collectedAt": "2022-07-16T18:52:57.214Z",
"statusCode": "200,",
"batchInsertionId": "example23",
"_user": {
"name": {
"first": "Rishi",
"last": "Mishra",
"full": "Rishi Mishra"
},
"_id": "63e21a0d479b25321e6b4a2c"
},
"userName": "rishi@aggregateintelligence.com",
"flightTripHash": "",
"_flightShop": {
"pax": {
"adults": 1,
"infants": 0
},
"_id": "63fdd677a631b4a452c34b24",
"shopName": "Achintya flightshop",
"_user": "63fda531bde67155fc46fb41",
"userName": "achintya",
"carriers": [
"23, 32"
],
"deliveryMode": [
"db"
],
"_sources": [
"61515e4eb77f75890e8acba7"
],
"isRoundTrip": "false,",
"_cabinClasses": [
"6013a6abf553c71d4dfbe92c"
],
"rtType": "0,",
"los": [
1
],
"_pos": "63f8a8b99087c44991cc31e3",
"_currency": "63fc92a45b8a5318729d9aa3",
"currencyName": "EUR",
"horizonDays": "30,",
"horizonOffSetDays": "0,",
"vertical": "flightrates",
"isDeleted": false,
"isActiveStatus": "true,",
"isCustomerCreated": "true,",
"createdAt": "2023-02-28T10:24:55.155Z",
"updatedAt": "2023-02-28T10:24:55.155Z",
"id": "63fdd677a631b4a452c34b24"
},
"flightShopName": "Test Jetblue_copaair",
"_source": {
"_id": "5f8999c220506157701f23aa",
"source": "Biman Bangladesh Airlines",
"channel": "OTA",
"id": "5f8999c220506157701f23aa"
},
"sourceName": "Biman Bangladesh Airlines",
"sourceId": 1,
"_pos": {
"_id": "62a2e3ca581567e3cd67cddc",
"posCode": 1,
"code": "My Code",
"id": "62a2e3ca581567e3cd67cddc"
},
"_cabinClass": {
"_id": "6013a6abf553c71d4dfbe92b",
"name": "Economy",
"id": "6013a6abf553c71d4dfbe92b"
},
"_currency": "5fa104806304832acf9c67e9",
"currencyName": "AED",
"updatedAt": "2022-12-28T05:48:30.669Z",
"_flyFrom": {
"_id": "5ec38d7afee3472b729b77a6",
"airportName": "Campbell River Airport",
"id": "5ec38d7afee3472b729b77a6"
},
"_flyTo": {
"_id": "5ec38d7afee3472b729b778c",
"airportName": "Nadzab Airport",
"id": "5ec38d7afee3472b729b778c"
},
"rowHash": "xyz",
"id": "63a59bf4533a40315c201e5f"
}
],
"totalData": 1
"totalPages: "1,"
"page": "1,"
"size": 10
}
Sample Response (JSON Code Format Snippet)
{
"Flightrates": [
{
"travellers": {
"adults": 1,
"infants": 0
},
"_id": "63a59bf4533a40315c201e5f",
"outbound": {
"price": 171,
"baseFare": 0,
"feesAndOthers": 0,
"description": "",
"numOfStops": 1,
"metaProviderName": "",
"layover": "08:21",
"flightStatusCode": 1,
"departureDate": "2022-08-17T00:00:00.000Z",
"departureTime": "12:45",
"arrivalDate": "2022-08-18T00:00:00.000Z",
"arrivalTime": 2,
"totalDuration": "12:38",
"flightTime": "04:17",
"actualPrice": 0,
"actualBaseFare": 0,
"actualFeeAndOthers": 0,
"_priceClass": {
"_id": "6135b5e611fa4d03dceeef07",
"channel": "OTA",
"source": "Airpaz",
"id": "6135b5e611fa4d03dceeef07"
},
"priceClassName": "Standard",
"legs": [
{
"_id": "6404c871a152811058394add",
"origin": "CUN",
"destination": "FLL",
"description": "",
"distance": "0,",
"fbc": "",
"seatCount": "null,",
"departureDate": "2022-08-17T00:00:00.000Z",
"departureTime": "12:45",
"arrivalDate": "2022-08-17T00:00:00.000Z",
"arrivalTime": "15:38",
"airlineShortCode": "NK",
"flightNumber": "NK-528",
"flightTime": "01:53",
"waitTime": "08:21",
"operatedBy": "",
"_airline": {
"_id": "601bb896f764ad17a4b71e66",
"displayName": "Air Arabia",
"id": "601bb896f764ad17a4b71e66"
},
"airlineName": "Air Arabia",
"airlineCode": 1,
"_aircraft": {
"_id": "601bb919f764ad17a4b71e7f",
"displayName": "Boeing 737",
"id": "601bb919f764ad17a4b71e7f"
},
"aircraftName": "B-737"
}
],
"baggageDetails": "",
"promoCode": "",
"discounts": "",
"taxStatus": 12,
"_id": "6404c871a152811058394adf",
"allFlightNumbers": [
"NK-528, NK-844"
],
"allStopOverAirports": [
"CUN, FLL, SDQ"
],
"allAirlineCodes": [
"1, 1"
],
"id": "6404c871a152811058394adf"
},
"flyFrom": "CUN",
"flyTo": "SDQ",
"isRoundTrip": "false,",
"departDate": "2022-08-17T00:00:00.000Z",
"returnDate": "2022-08-18T00:00:00.000Z",
"channelName": "Spirit",
"channelType": "brand",
"airlineCode": 35,
"totalPrice": 171,
"isRatePerPerson": false,
"previousPrice": "",
"isMultipleAirline": "false,",
"collectedAt": "2022-07-16T18:52:57.214Z",
"statusCode": "200,",
"batchInsertionId": "example23",
"_user": {
"name": {
"first": "Rishi",
"last": "Mishra",
"full": "Rishi Mishra"
},
"_id": "63e21a0d479b25321e6b4a2c"
},
"userName": "rishi@aggregateintelligence.com",
"flightTripHash": "",
"_flightShop": {
"pax": {
"adults": 1,
"infants": 0
},
"_id": "63fdd677a631b4a452c34b24",
"shopName": "Achintya flightshop",
"_user": "63fda531bde67155fc46fb41",
"userName": "achintya",
"carriers": [
"23, 32"
],
"deliveryMode": [
"db"
],
"_sources": [
"61515e4eb77f75890e8acba7"
],
"isRoundTrip": "false,",
"_cabinClasses": [
"6013a6abf553c71d4dfbe92c"
],
"rtType": "0,",
"los": [
1
],
"_pos": "63f8a8b99087c44991cc31e3",
"_currency": "63fc92a45b8a5318729d9aa3",
"currencyName": "EUR",
"horizonDays": "30,",
"horizonOffSetDays": "0,",
"vertical": "flightrates",
"isDeleted": false,
"isActiveStatus": "true,",
"isCustomerCreated": "true,",
"createdAt": "2023-02-28T10:24:55.155Z",
"updatedAt": "2023-02-28T10:24:55.155Z",
"id": "63fdd677a631b4a452c34b24"
},
"flightShopName": "Test Jetblue_copaair",
"_source": {
"_id": "5f8999c220506157701f23aa",
"source": "Biman Bangladesh Airlines",
"channel": "OTA",
"id": "5f8999c220506157701f23aa"
},
"sourceName": "Biman Bangladesh Airlines",
"sourceId": 1,
"_pos": {
"_id": "62a2e3ca581567e3cd67cddc",
"posCode": 1,
"code": "My Code",
"id": "62a2e3ca581567e3cd67cddc"
},
"_cabinClass": {
"_id": "6013a6abf553c71d4dfbe92b",
"name": "Economy",
"id": "6013a6abf553c71d4dfbe92b"
},
"_currency": "5fa104806304832acf9c67e9",
"currencyName": "AED",
"updatedAt": "2022-12-28T05:48:30.669Z",
"_flyFrom": {
"_id": "5ec38d7afee3472b729b77a6",
"airportName": "Campbell River Airport",
"id": "5ec38d7afee3472b729b77a6"
},
"_flyTo": {
"_id": "5ec38d7afee3472b729b778c",
"airportName": "Nadzab Airport",
"id": "5ec38d7afee3472b729b778c"
},
"rowHash": "xyz",
"id": "63a59bf4533a40315c201e5f"
}
]
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | success | flightratesResp |
401 | Unauthorized | Authorization Failed | None |
Hooks
Code samples
# You can also use wget
curl -X GET https://flightrates-api-stg.aggregateintelligence.com/api/v1/hooks \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
GET https://flightrates-api-stg.aggregateintelligence.com/api/v1/hooks HTTP/1.1
Host: flightrates-api-stg.aggregateintelligence.com
Accept: application/json
const headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('https://flightrates-api-stg.aggregateintelligence.com/api/v1/hooks',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.get 'https://flightrates-api-stg.aggregateintelligence.com/api/v1/hooks',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.get('https://flightrates-api-stg.aggregateintelligence.com/api/v1/hooks', headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','https://flightrates-api-stg.aggregateintelligence.com/api/v1/hooks', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://flightrates-api-stg.aggregateintelligence.com/api/v1/hooks");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://flightrates-api-stg.aggregateintelligence.com/api/v1/hooks", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
To get the list of defined hooks. Defined hooks for a direct data delivery, as streaming data.
API hooking is a technique by which can instrument and modify the behaviour and flow of API calls. API hooking can be done using various methods.
POST /hook : Takes as input a fsid, along with other parameters like webhook URL, auth un/pw if required, and so on. Returns the _id of the newly defined hook (hookId).
● GET /hook/list: Returns a list of all defined webhooks, optionally filtered
by shops id-s
● DEL /hook/{hookId}
Add New Hook
This POST method searches for adding the hooks, with permission as user.
hooks
Sample Request (JSON Code Format Snippet)
{
"endPoint": "/api/v1/my-hook",
"authType": "jwt",
"userId": "63fda531bde67155fc46fb4",
"pwdTxt": "/api/v1/my-hook",
"authType": "jwt",
"userId": "63fda531bde67155fc46fb4",
"pwdTxt": "test",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6I",
"hookType": "db",
"isActiveStatus": true,
"_shop": "63fdc414cccc3592d31b3ac8",
}
Sample Response (JSON Code Format Snippet)
{
"error": "false",
"hook": {
"_user": "63fda531bde67155fc46fb41",
"userName": "achintya",
"endPoint": "/api/v1/my-hook",
"authType": "jwt",
"userId": "63fda531bde67155fc46fb4",
"pwdTxt": "test",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6I",
"hookType": "db",
"isActiveStatus": true,
"_shop": "63fdc414cccc3592d31b3ac8",
"vertical": "flightrates",
"_id": "6401860c71ee7d2de1f25f43",
"isCustomerCreated": true,
"createdAt": "2023-03-03T05:30:52.662Z",
"updatedAt": "2023-03-03T05:30:52.662Z",
"_v": "0",
"id": "6401860c71ee7d2de1f25f43",
}
Request Body Parameters
Name | Requirement (True or False) | Data Type | Description |
---|---|---|---|
endpoint | required | string | Enter web hook URL as a string |
Authtype | optional | string | Enter proxy authentication type is a string type |
Userid | optional | string | Enter proxy user id is a string type |
pwdtxt | optional | string | Enter proxy password is a string type |
token | optional | string | Enter proxy token is a string type |
hookType | required | string | Enter hooktype is a string type |
_shop | required | string | Enter hooktype is a string type |
isActiveStatus | required | Boolean | Enter active status is a boolean value true or false Default value is true |
Success Response is 200
Delete Hook
Code samples
# You can also use wget
curl -X GET https://flightrates-api-stg.aggregateintelligence.com/api/v1/hook/{hooksId} \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
GET https://flightrates-api-stg.aggregateintelligence.com/api/v1/hook/{hooksId} HTTP/1.1
Host: flightrates-api-stg.aggregateintelligence.com
Accept: application/json
const headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('https://flightrates-api-stg.aggregateintelligence.com/api/v1/hook/{hooksId}',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.get 'https://flightrates-api-stg.aggregateintelligence.com/api/v1/hook/{hooksId}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.get('https://flightrates-api-stg.aggregateintelligence.com/api/v1/hook/{hooksId}', headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','https://flightrates-api-stg.aggregateintelligence.com/api/v1/hook/{hooksId}', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://flightrates-api-stg.aggregateintelligence.com/api/v1/hook/{hooksId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://flightrates-api-stg.aggregateintelligence.com/api/v1/hook/{hooksId}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
This DELETE method searches to delete the hooks, with permission as user.
/hook/:id
Request Query Parameters
Name | Requirement (True or False) | Data Type | Description |
---|---|---|---|
_id | Required / True | Objectid - String | Enter hook objectId, This must be a hook reference |
Name | in | Requirement (True or False) | Data Type | Description |
---|---|---|---|---|
body | boy | Required / True | hooksPostReq - String | None |
Sample Request (JSON Code Format Snippet)
{
"123endPoint": "/api/v1/my-hook",
"authType": "jwt",
"userId": "63fda531bde67155fc46fb4",
"pwdTxt": "demo1",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6I",
"hookType": "dbs",
"isActiveStatus": true,
"_shop": "63fdc414cccc3592d31b3ac8"
}
Sample Request (JSON Code Format Snippet)
{
"error": "false,
}
{
"_user": "63fda531bde67155fc46fb41",
"userName": "achintya",
"endPoint": "/api/v1/my-hook",
"authType": "jwt",
"userId": "63fda531bde67155fc46fb4",
"pwdTxt": "demo1",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6I",
"hookType": "dbs",
"isActiveStatus": true,
"_shop": "63fdc414cccc3592d31b3ac8",
"vertical": "flightrates",
"isCustomerCreated": "true,",
"createdAt": "2023-03-01T10:09:51.960Z",
"updatedAt": "2023-03-01T10:28:26.580",
"id": "63ff246fb2482db1c660e310"
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | success | hooksGetResp |
401 | Unauthorized | Authorization Failed | None |
Details Hook
Code samples
# You can also use wget
curl -X PUT https://flightrates-api-stg.aggregateintelligence.com/api/v1/hook/{hooksId} \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
PUT https://flightrates-api-stg.aggregateintelligence.com/api/v1/hook/{hooksId} HTTP/1.1
Host: flightrates-api-stg.aggregateintelligence.com
Content-Type: application/json
Accept: application/json
const inputBody = '{
"endPoint": "/api/v1/my-hook",
"authType": "jwt",
"userId": "63fda531bde67155fc46fb4",
"pwdTxt": "demo1",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6I",
"hookType": "dbs",
"isActiveStatus": true
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('https://flightrates-api-stg.aggregateintelligence.com/api/v1/hook/{hooksId}',
{
method: 'PUT',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.put 'https://flightrates-api-stg.aggregateintelligence.com/api/v1/hook/{hooksId}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.put('https://flightrates-api-stg.aggregateintelligence.com/api/v1/hook/{hooksId}', headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('PUT','https://flightrates-api-stg.aggregateintelligence.com/api/v1/hook/{hooksId}', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://flightrates-api-stg.aggregateintelligence.com/api/v1/hook/{hooksId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("PUT");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("PUT", "https://flightrates-api-stg.aggregateintelligence.com/api/v1/hook/{hooksId}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
With the GET method and permission as User, the details of the hook - single hook and multiple hooks are used to collect the data with details.
/hooks/:idhook
Request Parameters
Name | In | Requirement (True or False) | Data Type | Description |
---|---|---|---|---|
hooksId | path | Required / True | String (String) | None |
Sample Response (JSON Code Format Snippet)
{
"error": "false,
{
"_id": "63ff246fb2482db1c660e310",
"_user": "63fda531bde67155fc46fb41",
"userName": "achintya",
"endPoint": "/api/v1/my-hook",
"authType": "jwt",
"userId": "63fda531bde67155fc46fb4",
"pwdTxt": "test",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6I",
"hookType": "db",
"isActiveStatus": false,
"_shop": "63fdc414cccc3592d31b3ac8",
"vertical": "flightrates",
"isCustomerCreated": "true,",
"createdAt": "2023-03-01T10:09:51.960Z",
"updatedAt": "2023-03-01T10:28:26.580",
"_v": 0,
"id": "63ff246fb2482db1c660e310"
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Success | hooksGetResp |
401 | Unauthorized | Authorization Failed | None |
List Hooks
Code samples
# You can also use wget
curl -X DELETE https://flightrates-api-stg.aggregateintelligence.com/api/v1/hook/{hooksId} \
-H 'Authorization: Bearer {access-token}'
DELETE https://flightrates-api-stg.aggregateintelligence.com/api/v1/hook/{hooksId} HTTP/1.1
Host: flightrates-api-stg.aggregateintelligence.com
const headers = {
'Authorization':'Bearer {access-token}'
};
fetch('https://flightrates-api-stg.aggregateintelligence.com/api/v1/hook/{hooksId}',
{
method: 'DELETE',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.delete 'https://flightrates-api-stg.aggregateintelligence.com/api/v1/hook/{hooksId}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Authorization': 'Bearer {access-token}'
}
r = requests.delete('https://flightrates-api-stg.aggregateintelligence.com/api/v1/hook/{hooksId}', headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Authorization' => 'Bearer {access-token}',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('DELETE','https://flightrates-api-stg.aggregateintelligence.com/api/v1/hook/{hooksId}', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://flightrates-api-stg.aggregateintelligence.com/api/v1/hook/{hooksId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("DELETE", "https://flightrates-api-stg.aggregateintelligence.com/api/v1/hook/{hooksId}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
The GET method is used to get the list with the permission as a user.
/hook
Sample Response (JSON Code Format Snippet)
{
"hooks": [
{
"_id": "63ff246fb2482db1c660e310",
"_user": "63fda531bde67155fc46fb41",
"userName": "achintya",
"endPoint": "/api/v1/my-hook",
"authType": "jwt",
"userId": "63fda531bde67155fc46fb4",
"pwdTxt": "demo1",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6I",
"hookType": "dbs",
"isActiveStatus": true,
"_shop": "63fdc414cccc3592d31b3ac8",
"vertical": "flightrates",
"isCustomerCreated": "true,",
"createdAt": "2023-03-01T10:09:51.960Z",
"updatedAt": "2023-03-01T10:28:26.580",
"_v": 0,
"id": "63ff246fb2482db1c660e310"
}
],
"totalData": 4,
"totalPages": 4,
"page": "1",
"size": "1"
}
Responses
Success Response - 200
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Success | hooksFindResp |
401 | Unauthorized | Authentication Failed | None |
Reference
Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.
This section mostly includes the endpoints to fetch all static data available in our DB. The info these endpoints provide (specifically, the _id fields) are used with the other endpoints as input parameters.
- GET /references/airlines → aggregate & merge “spelling variations”
- GET /references/airports (for OD and Stops)
- GET /references/currencies
- GET /references/pos
- GET /references/timezones
- GET /references/cabinclasses
Common Header / Query Parameters
Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.
Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.
The Request Header parameters is applicable to all other field attributes and features.
Name | Requirement (True or False) | Data Type | Description |
---|---|---|---|
Authorization | Required | String | The JWT Token in format "Bearer xxxx.yyyy.zzzz" |
The Request Body / Query parameters is applicable to all other field attributes and features
Name | Requirement (True or False) | Data Type | Description |
---|---|---|---|
id | Required | objectId | Enter schedule objectId, which must be the schedule reference ID |
The Request Query parameters is applicable to all other field attributes and features.
List Aircrafts
Code samples
# You can also use wget
curl -X GET https://flightrates-api-stg.aggregateintelligence.com/api/v1/airports \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
GET https://flightrates-api-stg.aggregateintelligence.com/api/v1/airports HTTP/1.1
Host: flightrates-api-stg.aggregateintelligence.com
Accept: application/json
const headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('https://flightrates-api-stg.aggregateintelligence.com/api/v1/airports',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.get 'https://flightrates-api-stg.aggregateintelligence.com/api/v1/airports',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.get('https://flightrates-api-stg.aggregateintelligence.com/api/v1/airports', headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','https://flightrates-api-stg.aggregateintelligence.com/api/v1/airports', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://flightrates-api-stg.aggregateintelligence.com/api/v1/airports");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://flightrates-api-stg.aggregateintelligence.com/api/v1/airports", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
To get the list of airlines /aircrafts. Get Method is used to retrieve information of aircrafts with permission as user.
GET /references/aircrafts
Success Response - 200
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Success | airlinesResp |
401 | Unauthorized | Authentication Failed | None |
Sample Response (JSON Code Format Snippet)
{
"aircrafts": [
{
"_id": "63ff432ce2276fc08e64f794",
"sourceName": "qqqq",
"displayName": "qqq",
"code": 12,
"isActiveStatus": true,
"_createdBy": "63e5dc53e2a9529922d61349",
"_updatedBy": null,
"createdAt": "2023-03-01T12:21:00.540Z",
"updatedAt": "2023-03-01T12:21:00.540Z",
"__v": 0,
"id": "640aca5b56f99935b4c9deb2"
}
],
"totalData": "1287,",
"totalPages": "1287,",
"page": 1,
"size": 1
}
List Airlines
To get the airline details using the GET - retrieving method and the permission as user.
GET /references/airlines
Code samples
# You can also use wget
curl -X GET https://flightrates-api-stg.aggregateintelligence.com/api/v1/airlines \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
GET https://flightrates-api-stg.aggregateintelligence.com/api/v1/airlines HTTP/1.1
Host: flightrates-api-stg.aggregateintelligence.com
Accept: application/json
const headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('https://flightrates-api-stg.aggregateintelligence.com/api/v1/airlines',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.get 'https://flightrates-api-stg.aggregateintelligence.com/api/v1/airlines',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.get('https://flightrates-api-stg.aggregateintelligence.com/api/v1/airlines', headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','https://flightrates-api-stg.aggregateintelligence.com/api/v1/airlines', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://flightrates-api-stg.aggregateintelligence.com/api/v1/airlines");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://flightrates-api-stg.aggregateintelligence.com/api/v1/airlines", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
Success Response - 200
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Success | airlinesResp |
401 | Unauthorized | Authentication Failed | None |
Sample Response (JSON Code Format Snippet)
{
"airlines": [
{
"_id": "63ff432ce2276fc08e64f794",
"sourceName": "AirIndia",
"displayName": "AirIndia",
"code": 11,
"isActiveStatus": true,
"_createdBy": "63e5dc53e2a9529922d61349",
"_updatedBy": null,
"createdAt": "2023-03-01T12:21:00.540Z",
"updatedAt": "2023-03-01T12:21:00.540Z",
"__v": 0,
"id": "640aca5b56f99935b4c9deb2"
}
],
"totalData": "1287,",
"totalPages": "1287,",
"page": 1,
"size": 1
}
List Airports
Code samples
# You can also use wget
curl -X GET https://flightrates-api-stg.aggregateintelligence.com/api/v1/airports \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
GET https://flightrates-api-stg.aggregateintelligence.com/api/v1/airports HTTP/1.1
Host: flightrates-api-stg.aggregateintelligence.com
Accept: application/json
const headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('https://flightrates-api-stg.aggregateintelligence.com/api/v1/airports',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.get 'https://flightrates-api-stg.aggregateintelligence.com/api/v1/airports',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.get('https://flightrates-api-stg.aggregateintelligence.com/api/v1/airports', headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','https://flightrates-api-stg.aggregateintelligence.com/api/v1/airports', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://flightrates-api-stg.aggregateintelligence.com/api/v1/airports");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://flightrates-api-stg.aggregateintelligence.com/api/v1/airports", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
To get the list of airports with the details, permission as user using the GET method.
GET /references/airports
Example responses
200 Response
{
"airports": [
{
"_id": "63ff49df7c005fdef82e4535",
"airportName": "Ind",
"city": "KOl",
"countryCode": "12",
"countryName": "India",
"isActiveStatus": true,
"_createdBy": "63e5dc53e2a9529922d61349",
"_updatedBy": "63e5dc53e2a9529922d61349",
"createdAt": "2023-03-01T12:21:00.540Z",
"updatedAt": "2023-03-01T12:21:00.540Z",
"__v": 0,
"id": "63ff49df7c005fdef82e4535"
}
],
"totalData": "7703,",
"totalPages": "7703,",
"page": 1,
"size": 1
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | success | airportsResp |
401 | Unauthorized | Authorization Failed | None |
List Cabin Class
Code samples
# You can also use wget
curl -X GET https://flightrates-api-stg.aggregateintelligence.com/api/v1/airports \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
GET https://flightrates-api-stg.aggregateintelligence.com/api/v1/airports HTTP/1.1
Host: flightrates-api-stg.aggregateintelligence.com
Accept: application/json
const headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('https://flightrates-api-stg.aggregateintelligence.com/api/v1/airports',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.get 'https://flightrates-api-stg.aggregateintelligence.com/api/v1/airports',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.get('https://flightrates-api-stg.aggregateintelligence.com/api/v1/airports', headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','https://flightrates-api-stg.aggregateintelligence.com/api/v1/airports', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://flightrates-api-stg.aggregateintelligence.com/api/v1/airports");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://flightrates-api-stg.aggregateintelligence.com/api/v1/airports", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
To list the cabin class details using the GET method and permission as user.
GET /references/cabinclass
Sample Response (JSON Code Format Snippet)
Success Response - 200
{
"cabinclasses": [
{
"_id": "63ff55ba455a5c3849f17b69",
"code": 124,
"name": "qqq",
"isActiveStatus": true,
"_createdBy": "63e5dc53e2a9529922d61349",
""_updatedBy": "63e5dc53e2a9529922d61349",
"createdAt": "2023-03-01T13:40:10.738Z"
"updatedAt": "2023-03-01T13:46:28.474Z",
"id": "63ff55ba455a5c3849f17b69",
"__v": 0,
}
],
"totalData": 6,
"totalPages": 6,
"page": "1",
"size": "1"
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | success | cabinclassesResp |
401 | Unauthorized | Authorization Failed | None |
List Currency
Code samples
# You can also use wget
curl -X GET https://flightrates-api-stg.aggregateintelligence.com/api/v1/airports \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
GET https://flightrates-api-stg.aggregateintelligence.com/api/v1/airports HTTP/1.1
Host: flightrates-api-stg.aggregateintelligence.com
Accept: application/json
const headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('https://flightrates-api-stg.aggregateintelligence.com/api/v1/airports',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.get 'https://flightrates-api-stg.aggregateintelligence.com/api/v1/airports',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.get('https://flightrates-api-stg.aggregateintelligence.com/api/v1/airports', headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','https://flightrates-api-stg.aggregateintelligence.com/api/v1/airports', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://flightrates-api-stg.aggregateintelligence.com/api/v1/airports");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://flightrates-api-stg.aggregateintelligence.com/api/v1/airports", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
To list the currency details using the GET method to retrieve the information and with permission as user.
GET /references/currency
Sample Response (JSON Code Format Snippet)
Success Response - 200
{
"currencies": [
{
"_id": "64005f0c220f47200956a248",
"iso": "BOB",
"symbol": "Bs",
"isActiveStatus": true,
"_createdBy": "63e5dc53e2a9529922d61349",
""_updatedBy": null,,
"createdAt": "2023-03-02T08:32:12.340Z",
"updatedAt": "2023-03-02T08:32:12.340Z",,
"_v": 0,
"id": "64005f0c220f47200956a248",
}
],
"totalData": 170,,
"totalPages": 170,,
"page": "1",
"size": "1"
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | success | CurrenciesResp |
401 | Unauthorized | Authorization Failed | None |
List POS
Code samples
# You can also use wget
curl -X GET https://flightrates-api-stg.aggregateintelligence.com/api/v1/airports \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
GET https://flightrates-api-stg.aggregateintelligence.com/api/v1/airports HTTP/1.1
Host: flightrates-api-stg.aggregateintelligence.com
Accept: application/json
const headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('https://flightrates-api-stg.aggregateintelligence.com/api/v1/airports',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.get 'https://flightrates-api-stg.aggregateintelligence.com/api/v1/airports',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.get('https://flightrates-api-stg.aggregateintelligence.com/api/v1/airports', headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','https://flightrates-api-stg.aggregateintelligence.com/api/v1/airports', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://flightrates-api-stg.aggregateintelligence.com/api/v1/airports");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://flightrates-api-stg.aggregateintelligence.com/api/v1/airports", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
To list the POS details using the GET method to retrieve the details with permission as user.
GET /references/pos
Sample Response (JSON Code Format Snippet)
Success Response - 200
{
"poses": [
{
"_id": "64007076257289970c6db570",
"posCode": 10,
"code": "Ind10",
"region": Eastern,
"countryCode": "Ind",
"countryName": "India",
"isActiveStatus": true,
"_createdBy": "63e5dc53e2a9529922d61349",
"_updatedBy": "63e5dc53e2a9529922d61349",
"createdAt": "2023-03-02T09:46:30.392Z",
"updatedAt": "2023-03-02T09:55:59.306Z",
"_v": "0",
"id": "64007076257289970c6db570",
}
],
"totalData": 176,,
"totalPages": 176,,
"page": "1",
"size": "1"
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | success | PosesResp |
401 | Unauthorized | Authorization Failed | None |
List Price Class
Code samples
# You can also use wget
curl -X GET https://flightrates-api-stg.aggregateintelligence.com/api/v1/airports \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
GET https://flightrates-api-stg.aggregateintelligence.com/api/v1/airports HTTP/1.1
Host: flightrates-api-stg.aggregateintelligence.com
Accept: application/json
const headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('https://flightrates-api-stg.aggregateintelligence.com/api/v1/airports',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.get 'https://flightrates-api-stg.aggregateintelligence.com/api/v1/airports',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.get('https://flightrates-api-stg.aggregateintelligence.com/api/v1/airports', headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','https://flightrates-api-stg.aggregateintelligence.com/api/v1/airports', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://flightrates-api-stg.aggregateintelligence.com/api/v1/airports");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://flightrates-api-stg.aggregateintelligence.com/api/v1/airports", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
To get the price class details using the GET method with permission as user.
GET /references/priceclass
Sample Response (JSON Code Format Snippet)
Success Response - 200
{
"priceclasses": [
{
"_id": "64008080445b0080d580295f",
"channel": "qqq",
"source": "qqq",
"_airline": "601bb896f764ad17a4b71e66",
"priceClass": "Business",
"isActiveStatus": true,
"sourceCode": 12,
"_createdBy": "63e5dc53e2a9529922d61349",
""_updatedBy": "63e5dc53e2a9529922d61349",
"createdAt": "2023-03-02T10:54:56.795Z"
"updatedAt": "2023-03-02T11:03:16.202Z",
"id": "64008080445b0080d580295f",
"__v": 0,
}
],
"totalData": 6,
"totalPages": 6,
"page": "1",
"size": "1"
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | success | priceclassesResp |
401 | Unauthorized | Authorization Failed | None |
List Timezones
Code samples
# You can also use wget
curl -X GET https://flightrates-api-stg.aggregateintelligence.com/api/v1/priceclass \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
GET https://flightrates-api-stg.aggregateintelligence.com/api/v1/priceclass HTTP/1.1
Host: flightrates-api-stg.aggregateintelligence.com
Accept: application/json
const headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('https://flightrates-api-stg.aggregateintelligence.com/api/v1/priceclass',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.get 'https://flightrates-api-stg.aggregateintelligence.com/api/v1/priceclass',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.get('https://flightrates-api-stg.aggregateintelligence.com/api/v1/priceclass', headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','https://flightrates-api-stg.aggregateintelligence.com/api/v1/priceclass', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://flightrates-api-stg.aggregateintelligence.com/api/v1/priceclass");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://flightrates-api-stg.aggregateintelligence.com/api/v1/priceclass", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
To get the time zone details using the GET method with permission as user.
GET/references/timezones
Example responses
200 Response
{
"timezones": [
{
"_id": "6400865f91a167d23ea612a3",
"timezone": "India",
"countryCode": "Ind",
"gmtOffSet": "4.00",
"abbr": "IN",
"isActiveStatus": true,
"_createdBy": "63e5dc53e2a9529922d61349",
""_updatedBy": "63e5dc53e2a9529922d61349",
"createdAt": "2023-03-02T11:19:59.964Z"
"updatedAt": "2023-03-02T11:51:46.522Z",
"id": "6400865f91a167d23ea612a3",
"__v": 0,
}
],
"totalData": 432,
"totalPages": 432,
"page": "1",
"size": "1"
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Success | timezonesResp |
401 | Unauthorized | Authorization Failed | None |
Schedules
Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.
FlightShops, Schedules, and Web Hooks
This section is mostly about the CRUD routes for each of the above feature attributes.
Centralized Shops and Schedules (Micro) service:
There are plans to develop a standalone microservice to handle the creation of Shops and Schedules across all verticals/domains in a centralized fashion. This will make it simpler for both the DAv2 process & the DevOps team to build the input URLs for scraping and to run the scripts at specified schedules, as all have to read a single central DB for the required parameters irrespective of the domain.
In this case, the Flight Shops & Schedules CRUD routes depicted internally & additionally need to interact with the centralized microservice as a side effect.
Based upon the current requirements, can set up an endpoint for creating many shops at once by uploading a CSV / Excel file in a predefined format.
● POST /schedule/now - Run a defined flightshop IMMEDIATELY. This method is useful for triggering off the DA backend process for harvesting data on demand instead of at a later, scheduled time. Takes as input the fsid and returns HTTP status 202 Accepted. Usage of this endpoint shall be restricted by imposing some sort of daily quota as well as throttling, beyond which it shall respond with a 429 Too Many Requests error.
● POST /schedules - Set up a routine to run a defined FlightShop. This API call creates a timetable for running a specific FlightShop at a predetermined date and time on a set schedule. Refer to Rates API for input/output params formats
● POST /schedules/list - List out all schedules defined for the current user. Filterable by fsid
● GET /schedules/{scheduleId} - Fetch details of a single defined schedule
● PUT /schedules/{scheduleId} - Edit details of a single defined schedule
● DEL /schedules/{scheduleId} - Delete a single defined schedule
Common Header / Query Parameters
The Request Header parameters is applicable to all other field attributes and features.
Name | Requirement (True or False) | Data Type | Description |
---|---|---|---|
Authorization | Required | String | The JWT Token in format "Bearer xxxx.yyyy.zzzz" |
The Request Body parameters is applicable to all other field attributes and features.
Name | Requirement (True or False) | Data Type | Description |
---|---|---|---|
_id | Required | objectId | Enter schedule objectId, which must be the schedule reference ID |
The Request Body / Query parameters is applicable to all other field attributes and features
Name | In | Requirement (True or False) | Data Type | Description |
---|---|---|---|---|
page | query | Optional/False | Integer / Number | Enter the page number with default value as 1 |
size | query | Optional/False | Number/ integer | Enter the size of data with the default value as 10 |
Add New Schedule
Code samples
# You can also use wget
curl -X GET https://flightrates-api-stg.aggregateintelligence.com/api/v1/schedules \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
GET https://flightrates-api-stg.aggregateintelligence.com/api/v1/schedules HTTP/1.1
Host: flightrates-api-stg.aggregateintelligence.com
Accept: application/json
const headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('https://flightrates-api-stg.aggregateintelligence.com/api/v1/schedules',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.get 'https://flightrates-api-stg.aggregateintelligence.com/api/v1/schedules',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.get('https://flightrates-api-stg.aggregateintelligence.com/api/v1/schedules', headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','https://flightrates-api-stg.aggregateintelligence.com/api/v1/schedules', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://flightrates-api-stg.aggregateintelligence.com/api/v1/schedules");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://flightrates-api-stg.aggregateintelligence.com/api/v1/schedules", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
To add a new schedule using the POST method, with permission as a user.
POST /schedules
API - Schedule - Common Header / Query Parameters
"error": false,
"shop" : {
"_OD"" : [
{
"_flyFrom": "62b943e4dd59913b61a6b15b",
"_flyTo": "62b943e4dd59913b61a6b15c",
"_id": "640ace815353bdb6454e191c",
},
{
"_flyFrom": "62b943e4dd59913b61a6b15b",
"_flyTo": "62b943e4dd59913b61a6b15e",
"_id": "640ace815353bdb6454e191d",
}
],
"_OD"" : [
"AAAAAB",
"AAAAAE"
],
"_sources": : [
"6239aec26c3c588d8f64ecfc"
],
"_alternateSources": : [
"61515e50b77f75890e8acbaf"
],
"isRoundTrip": false,
"los": 1,
"_cabinClasses" : [
"6013a6abf553c71d4dfbe92d"
],
"pax" : {
"adults": 1,
"infants": 0,
},
"horizon" : {
"start": 1,
"end": 7,
},
"pos": "62a2e3ca581567e3cd67ce1a",
"_currency": "5fa104806304832acf9c67f5",
"noOfStops": 0,
"shopName": "Rishi Mishra Shop",
"_user": "63fda531bde67155fc46fb41",
"userName": "achintya",
"currQueue": 0,
"prevQueue": 0,
"lastRun": "20102020",
"nextRun": "20102020",
"deliveryMode": [
"db"
],
"isActiveStatus": true,
"_createdBy": "63fda531bde67155fc46fb41",
"_updatedBy": null,
"_id": "640ace815353bdb6454e191b",
"isCustomerCreated": true,
"createdAt": "2023-03-10T06:30:25.288Z",
"updatedAt": "2023-03-10T06:30:25.288Z",
"_v": 0,
"id": "640ace815353bdb6454e191b"
}
}
Request Body Parameters
Name | Requirement (True or False) | Data Type | Description |
---|---|---|---|
scheduleName | required | string | Enter the name as a string type |
_shop | required | ObjectId | Enter the shop object ID, it is the shop reference ID. |
_timeZone | required | ObjectId | Enter_time zone object Id, it must be the time zone reference ID |
Year | required | string | Enter the year as a string type |
Month | required | string | Enter the year as a string type |
Dayofweek | required | string | Enter the days as string type |
Hour | required | string | Enter the hour as string type |
Minute | required | string | Enter the minute as string type |
Second | required | string | Enter the second as string type |
Startdate | required | string | Enter the start date as string type |
Enddate | required | string | Enter the end date as string type |
IsActiveStatus | required | string | Enter the is active status as a Boolean type with default value as true. |
Sample Request (JSON Code Format Snippet)
{
"scheduleName": "Achintya flightrates",
"_shop": "63fdd677a631b4a452c34b24",
"_timezone": "5facd6d4f5a1aa1f60dd2a55",
"year": "2022",
"year": "2022",
"month": "jan",
"dayOfWeek": "6",
"days": "12",
"hour": "11",
"minute": "24",
"second": "12,",
"isActiveStatus": "true",
"startDate": "2022-10-24"",
"endDate": "2022-10-24",
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | success | schedulesFindResp |
401 | Unauthorized | Authorization Failed | None |
Delete Schedule
Code samples
# You can also use wget
curl -X GET https://flightrates-api-stg.aggregateintelligence.com/api/v1/schedule/{scheduleId} \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
GET https://flightrates-api-stg.aggregateintelligence.com/api/v1/schedule/{scheduleId} HTTP/1.1
Host: flightrates-api-stg.aggregateintelligence.com
Accept: application/json
const headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('https://flightrates-api-stg.aggregateintelligence.com/api/v1/schedule/{scheduleId}',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.get 'https://flightrates-api-stg.aggregateintelligence.com/api/v1/schedule/{scheduleId}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.get('https://flightrates-api-stg.aggregateintelligence.com/api/v1/schedule/{scheduleId}', headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','https://flightrates-api-stg.aggregateintelligence.com/api/v1/schedule/{scheduleId}', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://flightrates-api-stg.aggregateintelligence.com/api/v1/schedule/{scheduleId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://flightrates-api-stg.aggregateintelligence.com/api/v1/schedule/{scheduleId}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
Delete Method with permission as user; to delete the schedule.
DEL /schedule/:id
Success Response code is 200
Name | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK Data Deleted | none |
401 | Unauthorized | Authentication Failed | none |
Sample Response (JSON Code Format Snippet)
{
"error": false,
}
Details Schedule
Code samples
# You can also use wget
curl -X PUT https://flightrates-api-stg.aggregateintelligence.com/api/v1/schedule/{scheduleId} \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
PUT https://flightrates-api-stg.aggregateintelligence.com/api/v1/schedule/{scheduleId} HTTP/1.1
Host: flightrates-api-stg.aggregateintelligence.com
Content-Type: application/json
Accept: application/json
const inputBody = '{
"endPoint": "/api/v1/my-hook",
"authType": "jwt",
"userId": "63fda531bde67155fc46fb4",
"pwdTxt": "demo1",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6I",
"hookType": "dbs",
"isActiveStatus": true
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('https://flightrates-api-stg.aggregateintelligence.com/api/v1/schedule/{scheduleId}',
{
method: 'PUT',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.put 'https://flightrates-api-stg.aggregateintelligence.com/api/v1/schedule/{scheduleId}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.put('https://flightrates-api-stg.aggregateintelligence.com/api/v1/schedule/{scheduleId}', headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('PUT','https://flightrates-api-stg.aggregateintelligence.com/api/v1/schedule/{scheduleId}', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://flightrates-api-stg.aggregateintelligence.com/api/v1/schedule/{scheduleId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("PUT");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("PUT", "https://flightrates-api-stg.aggregateintelligence.com/api/v1/schedule/{scheduleId}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
To use the GET method and with permission as user; to get all the schedule details.
GET /schedule/:id
Success Response code is 200
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK Data Deleted | none |
401 | Unauthorized | Authentication Failed | none |
List Schedules
To use the GET method and with permission as user; to get all the schedule details.
POST /schedule
Success Response code is 200
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | OK Data Deleted | none |
401 | Unauthorized | Authentication Failed | none |
Sample Response (JSON Code Format Snippet)
{
"error": false,
"schedule": {
"_id": "63ff1e0bb2482db1c660e306",
"scheduleName": "Achintya flightrates",
"_shop": "63fdd677a631b4a452c34b24",
"_timezone": "5facd6d4f5a1aa1f60dd2999",
"timezoneName": "America/Pangnirtung",
"year": "2022",
"month": "jan",
"dayOfWeek": "6",
"days": 12,
"hour": "11",
"minute": "24",
"second": "12",
"isActiveStatus": true,
"startDate": "2022-10-24",
"endDate": "2022-10-24"
"_user": "63fda531bde67155fc46fb41",
"userName": "achintya",
"vertical": "flightrates",
"isCustomerCreated": true,
"createdAt": "2023-03-01T09:42:35.372Z",
"updatedAt": "63fda531bde67155fc46fb41",
"__v": 0,
"id": "63ff1e0bb2482db1c660e306",
}
Update Schedule
Code samples
# You can also use wget
curl -X DELETE https://flightrates-api-stg.aggregateintelligence.com/api/v1/schedule/{scheduleId} \
-H 'Authorization: Bearer {access-token}'
DELETE https://flightrates-api-stg.aggregateintelligence.com/api/v1/schedule/{scheduleId} HTTP/1.1
Host: flightrates-api-stg.aggregateintelligence.com
const headers = {
'Authorization':'Bearer {access-token}'
};
fetch('https://flightrates-api-stg.aggregateintelligence.com/api/v1/schedule/{scheduleId}',
{
method: 'DELETE',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.delete 'https://flightrates-api-stg.aggregateintelligence.com/api/v1/schedule/{scheduleId}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Authorization': 'Bearer {access-token}'
}
r = requests.delete('https://flightrates-api-stg.aggregateintelligence.com/api/v1/schedule/{scheduleId}', headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Authorization' => 'Bearer {access-token}',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('DELETE','https://flightrates-api-stg.aggregateintelligence.com/api/v1/schedule/{scheduleId}', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://flightrates-api-stg.aggregateintelligence.com/api/v1/schedule/{scheduleId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("DELETE", "https://flightrates-api-stg.aggregateintelligence.com/api/v1/schedule/{scheduleId}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
To use the PUT method with permission as user; this is to update the schedule
SampleResponse (JSON Code Format Snippet)
{
"scheduleName": "Achintya flightrates",
"_timezone": "5facd6d4f5a1aa1f60dd2999",
"year": "2023",
"month": "march",
"dayOfWeek": "6",
"days": "28",
"hour": "11",
"minute": "20",
"second": "12",
"isActiveStatus": true,
"startDate": "2022-10-24",
"endDate": "2023-10-24"
}
SampleResponse (JSON Code Format Snippet)
{
"error": "false,
"scheduleName": {
"_id": "63ff1e0bb2482db1c660e306",
"scheduleName": "Achintya flightrates",
"_shop": "63fdd677a631b4a452c34b24",
"_timezone": "5facd6d4f5a1aa1f60dd2999",
"timezoneName": "America/Pangnirtung",
"year": "2023",
"month": "march",
"dayOfWeek": "6",
"days": "28",
"hour": "11",
"minute": "20",
"second": "12",
"isActiveStatus": true,
"startDate": "2022-10-24",
"endDate": "2023-10-24",
"user": "63fda531bde67155fc46fb41",
"vertical": "flightrates",
"isCustomerCreated": true,
"createdAt": "2023-03-01T09:51:13.111Z",
"updatedAt": "2023-03-01T09:51:13.111Z",
"_v": 0,
"id": 63ff1e0bb2482db1c660e306,
}
Request Body Parameters
Name | Requirement (True or False) Data Type | Data Type | Description |
---|---|---|---|
scheduleName | required | string | Enter the name as a string type |
_shop | required | ObjectId | Enter the shop object ID, it is the shop reference ID. |
_timeZone | required | ObjectId | Enter _time zone object Id, it must be the time zone reference ID |
Year | required | string | Enter the year as a string type |
Month | required | string | Enter the month as a string type |
Dayofweek | required | string | Enter the day of the week as a string type |
Days | required | string | Enter the days as string type |
Hour | required | string | Enter the hour as a string type |
Minute | required | string | Enter the minute as a string type |
Second | required | string | Enter the second as a string type |
Startdate | required | string | Enter the Start date as a string type |
Enddate | required | string | Enter the end date as a string type |
IsActiveStatus | required | Boolean | Enter the is active status as a Boolean type with default value as true. |
Success Response code is 200
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Ok, data deleted | None |
401 | Unauthorized | Authorization Failed | None |
Flight Shop
Code samples
# You can also use wget
curl -X POST https://flightrates-api-stg.aggregateintelligence.com/api/v1/schedule \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
POST https://flightrates-api-stg.aggregateintelligence.com/api/v1/schedule HTTP/1.1
Host: flightrates-api-stg.aggregateintelligence.com
Content-Type: application/json
Accept: application/json
const inputBody = '{
"scheduleName": "Achintya flightrates",
"_shop": "63fdd677a631b4a452c34b24",
"timezone": "63fdd677a631b4a452c34b22",
"year": 2023,
"month": "march",
"dayOfWeek": "6,",
"days": "30,",
"hour": "11,",
"minute": "20,",
"second": "12,",
"isActiveStatus": "true,",
"startDate": "2022-10-24",
"endDate": "2023-10-24"
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('https://flightrates-api-stg.aggregateintelligence.com/api/v1/schedule',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.post 'https://flightrates-api-stg.aggregateintelligence.com/api/v1/schedule',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.post('https://flightrates-api-stg.aggregateintelligence.com/api/v1/schedule', headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('POST','https://flightrates-api-stg.aggregateintelligence.com/api/v1/schedule', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://flightrates-api-stg.aggregateintelligence.com/api/v1/schedule");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://flightrates-api-stg.aggregateintelligence.com/api/v1/schedule", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
● POST /flightshop
Request: The user is able to create the flight shop by using the following parameters (subject to change, especially, if the Centralized Microservice gets built):
- Origin - Airport Code (string)
- Destination - Airport Code (string
- Source Codes - (Array of Refs
- Route Type - isRoundTrip (Bool)
- Cabin Class - e.g. Economy/Business/First Class (Ref)
- PAX
- Adults - Number
- Infant - Number (default 0)
- POS - Country (Ref)
- Currency - (Ref)
- Horizon - Number field from 1 - 180 and this can be referenced as a range. Example: 30 Means 30 Days out data from the start date. Example: 7 - 14 this means from the start date the user needs the data for the 7th - 14th date.
- Start Date - YYYY-MM-DD
- End Date - YYYY-MM-DD
Response: The flight shop is created to return the _id of the shop (fsid) (flight shop Id) in the response.
● GET /flightshop/list To list out all defined flight shops for current user. Pagination is used.
● GET /flightshop/{fsid} To get the details of a particular flight shop
● PUT /flightshop/{fsid} To edit the details of a particular flight shop
● DEL /flightshop/{fsid} To delete a particular flight shop
Add New Shop
Sample Request (JSON Code Format Snippet)
{
"_OD": [
{
"_flyFrom": "62b943e4dd59913b61a6b15b",
"_flyTo": "62b943e4dd59913b61a6b15c",
},
{
"_flyFrom": "62b943e4dd59913b61a6b15b",
"_flyTo": "62b943e4dd59913b61a6b15c",
}
],
"_source": [
"6239aec26c3c588d8f64ecfc"
],
"_alternateSources": [
"61515e50b77f75890e8acbaf"
],
"_cabinClasses": [
"6013a6abf553c71d4dfbe92d"
],
"isRoundTrip": false,
"los": 1,
"pax": {
"adults": 1,
"infants": 0
},
"horizon": {
"start": 1,
"end": 7
},
"noOfStops": 1,
"duration": 60,
"fareType": regular,
"startDate": 2022-11-07,
"_pos": 62a2e3ca581567e3cd67ce1a,
"_currency": 5fa104806304832acf9c67f5,
"shopName": Rishi Mishra Shop,
"currQueue": 0,
"prevQueue": 0,
"nextRun": 20102020,
"lastRun": 20102020,
"deliveryMode": [
"db"
],
"isActiveStatus": true
}
Sample Response (JSON Code Format Snippet)
{
"error": false,
"shop": {
"_OD": [
{
"_flyFrom": "62b943e4dd59913b61a6b15b",
"_flyTo": "62b943e4dd59913b61a6b15c",
"_id": "640ace815353bdb6454e191c",
},
{
"_flyFrom": "62b943e4dd59913b61a6b15b",
"_flyTo": "62b943e4dd59913b61a6b15c",
"_id": "640ace815353bdb6454e191d",
}
],
"OD": [
"AAAAAB"
"AAAAAE"
],
"_source": [
"6239aec26c3c588d8f64ecfc"
],
"_alternateSources": [
"61515e50b77f75890e8acbaf"
],
"_cabinClasses": [
"6013a6abf553c71d4dfbe92d"
],
"isRoundTrip": false,
"los": 1,
"cabinClasses": [
"6013a6abf553c71d4dfbe92d"
], "pax": {
"adults": 1,
"infants": 0
},
"horizon": {
"start": 1,
"end": 7
},
"_pos": "62a2e3ca581567e3cd67ce1a" ,
"_currency": "5fa104806304832acf9c67f5" ,
"noOfStops": 0,
"shopName": "Rishi Mishra Shop",
"_user": "63fda531bde67155fc46fb41",
"userName": "achintya",
"currQueue": 0,
"prevQueue": 0,
"lastRun": 20102020,
"nextRun": 20102020,
"deliveryMode": [
"db"
],
"isActiveStatus": true ,
"lastRun": 20102020,
"deliveryMode": [
"db"
],
"isActiveStatus": true
"_createdBy": "63fda531bde67155fc46fb41" ,
"_updatedBy": "null" ,
"_id": "640ace815353bdb6454e191b" ,
"isCustomerCreated": true ,
"createdAt": "2023-03-10T06:30:25.288Z" ,
"updatedAt": "2023-03-10T06:30:25.288Z" ,
"__v": "0" ,
"id": "640ace815353bdb6454e191b" ,
}
The POST method is used with permission as user; to add a new shop.
/shop
Request Body Parameters
Parameter Name | Requirement (Optional or Mandatory) | Type | Description |
---|---|---|---|
_OD | Required / Mandatory | _OD[ObjectId] | Enter _OD is an array type |
_flyFrom | Required / Mandatory | ObjectId | Enter airport ObjectId, this is an airport reference |
_flyTo | Required / Mandatory | ObjectId | Enter airport ObjectId, This is an airport reference |
_sources | Required / Mandatory | sources[ObjectId] | Enter sources objectId is an array type, this is a source reference |
_alternateSources | Required / Mandatory | _alternateSources[ObjectId] | Enter alternate sources objectId is an array type, this is a source reference |
_cabinClasses | Required / Mandatory | _cabinClasses[ObjectId] | Enter cabin class objectId is an array type, This is a cabin class reference |
isRoundTrip | Required / Mandatory | Boolean | Enter isRoundTrip is a boolean type With Default value: false |
Los | Required / Mandatory | Number | Enter los in array is a number type |
Pax | Required / Mandatory | Object | Enter pax is a object type |
Adults | Required / Mandatory | Number | Enter adults is a number type |
Infant | Optional | Number | Enter infant is a number type With Default value: 0 |
Horizon | Required / Mandatory | Object | Enter horizon is a object type |
Start | Required / Mandatory | Number | Enter start is a number type With Default value: 0 |
End | Required / Mandatory | Number | Enter end is a number type |
_pos | Required / Mandatory | Number | Enter pos objectId, It's must be pos reference |
_currency | Required / Mandatory | ObjectId | Enter currency objectId, It's must be currency reference |
shopName | Required / Mandatory | String | Enter name is a string type |
currQueue | Optional | Number | Enter currQueue is a number type |
prevQueue | Optional | String | Enter lastRun is a string type |
nextRun | Optional | String | Enter nextRun is a string type |
noOfStops | Required / Mandatory | Number | Enter noOfStops is a number With Default value: 0 |
Duration | Required / Mandatory | String | Enter fare type is a string type |
startDate | Required / Mandatory | Date | Enter start date is a string date type |
deliveryMode | Required / Mandatory | [ENUM] | Enter delivery mode values are db or webhook, It's array type. |
isActiveStatus | Required / Mandatory | Boolean | Enter active status is a boolean type. With Default value: True |
Success Response code is 200
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Success | FlightratesResp |
401 | Unauthorized | Authentication Failed | none |
Delete Shop
To use the Delete Method, to delete the shop details.
/shop/:id
Sample Response (JSON Code Format Snippet)
{
"error": "false"
}
Details Shop
To use the GET Method with permission as user to retrieve the shop details.
/shop/:id
Success Response is 200
{
"error": "false",
"shop":{
"isRoundTrip": false ,
"los": 1 ,
"pax":{
"adults": 1 ,
"infants": 0 ,
},
"_id": "640ace815353bdb6454e191b" ,
"_OD": [
{
"_flyFrom": "62b943e4dd59913b61a6b15b" ,
"_flyTo": "62b943e4dd59913b61a6b15c" ,
"_id": "640ace815353bdb6454e191c" ,
} ,
{
"_flyFrom": "62b943e4dd59913b61a6b15b" ,
"_flyTo": "62b943e4dd59913b61a6b15e" ,
"_id": "640ace815353bdb6454e191d" ,
}
],
"OD": [
"AAAAAB",
"AAAAAE",
],
"_sources": [
"6239aec26c3c588d8f64ecfc",
],
"_alternateSources": [
"61515e50b77f75890e8acbaf",
],
"_cabinClasses": [
"6013a6abf553c71d4dfbe92d",
],
"horizon": {
"start": 1" ,
"end": 7 ,
"_pos": "62a2e3ca581567e3cd67ce1a" ,
"_currency": "5fa104806304832acf9c67f5" ,
"noOfStops": 0 ,
"shopName": "Rishi New Shop" ,
"_user": "63fda531bde67155fc46fb41" ,
"userName": "achintya" ,
"currQueue": 0 ,
"prevQueue": 0 ,
"lastRun": "20102020" ,
"nextRun": "20102020" ,
"deliveryMode": [
"db"
],
"isActiveStatus": true ,
"_createdBy": "63fda531bde67155fc46fb41" ,
"_updatedBy: Null ,
"isCustomerCreated": true ,
"createdAt": "2023-03-10T06:30:25.288Z" ,
"updatedAt": "2023-03-10T06:44:06.576Z" ,
"__v": ": 0 ,
"__schedules": [] ,
"_hooks": "[]" ,
"_id": "640ace815353bdb6454e191b" ,
}
}
List Shops
To use the GET Method with permission as user to retrieve the shop details.
/shops
Sample Response (JSON Code Format Snippet)
{
"error": "false",
"shop":{
"isRoundTrip": false ,
"los": 1 ,
"pax":{
"adults": 1 ,
"infants": 0 ,
}, "horizon":{
"start": 0 ,
"end": 7 ,
},
"_id": "64119e4d8508ae35cea55181" ,
"_OD": [
{
"_flyFrom": "62b943e4dd59913b61a6b15b" ,
"_flyTo": "62b943e4dd59913b61a6b15c" ,
"_id": "64119e4d8508ae35cea55182" ,
} ,
{
"_flyFrom": "62b943e4dd59913b61a6b15b" ,
"_flyTo": "62b943e4dd59913b61a6b15e" ,
"_id": "64119e4d8508ae35cea55183" ,
}
],
"OD": [
"AAAAAB",
"AAAAAE",
],
"_sources": [
"6405ceb16ab2dd69bfec0001",
],
"_alternateSources": [
"61515e50b77f75890e8acbaf",
],
"_cabinClasses": [
"63ff55ba455a5c3849f17b69",
],
"_pos": "64007076257289970c6db570" ,
"posName": "Ind10" ,
"_currency": "64005f0c220f47200956a248" ,
"currencyName": "BOB" ,
"noOfStops": 0 ,
"shopName": "achintya_shop" ,
"_user": "6411b27b79d2c995fc689c4b" ,
"userName": "rishi" ,
"currQueue": 0 ,
"prevQueue": 0 ,
"lastRun": "20102020" ,
"nextRun": "20102020" ,
"deliveryMode": [
"db"
],
"isActiveStatus": true ,
"_createdBy": "63e5dc53e2a9529922d61349" ,
"_updatedBy: "63e5dc53e2a9529922d61349" ,
"isCustomerCreated": true ,
"createdAt": "2023-03-10T06:30:25.288Z" ,
"updatedAt": "2023-03-10T06:44:06.576Z" ,
"__v": ": 0 ,
,
"_id": "640ace815353bdb6454e191b" ,
}
],
"totalData": 1 ,
"totalPages": 1,
"page": 1 ,
"size": 1,
}
Update Shop
To use the PUT method, to update the shop details.
/shop/:id
Sample Request JSON snippet
{
"shopName": "Myshop Rishi",
"isActiveStatus": true
}
Sample Response JSON snippet
{
"error": "false",
"shop":{
"isRoundTrip": false ,
"los": 1 ,
"pax":{
"adults": 1 ,
"infants": 0 ,
},
"_id": "6409bfa6047734e75c4d716d" ,
"_OD": [
{
"_flyFrom": "62b943e4dd59913b61a6b15b" ,
"_flyTo": "62b943e4dd59913b61a6b15c" ,
"_id": "6409bfa6047734e75c4d716e" ,
} ,
{
"_flyFrom": "62b943e4dd59913b61a6b15b" ,
"_flyTo": "62b943e4dd59913b61a6b15e" ,
"_id": "6409bfa6047734e75c4d716f" ,
}
],
"OD": [
"AAAAAB",
"AAAAAE",
],
"_sources": [
"63e620eb6ea615b4c4f06dfe",
],
"_alternateSources": [
"63e620eb6ea615b4c4f06dfe",
],
"_cabinClasses": [
"63e5f82a72d990148447f9c5",
],
"horizon": {
"start": 1 ,
"end": 7 ,
},
"_pos": "64007076257289970c6db570" ,
"__currency": "63e5f9fd6666634d1533149e" ,
"noOfStops": 0 ,
"shopName": "Myshop Rishi" ,
"_user": "64003965e75f00657b7dd49d" ,
"userName": "rishitest1" ,
"currQueue": 0 ,
"prevQueue": 0 ,
"lastRun": "20102020" ,
"nextRun": "20102020" ,
"deliveryMode": [
"db"
],
"isActiveStatus": true ,
"_createdBy": "63e5e73154efb25e54806112" ,
"_updatedBy: "63e5e73154efb25e54806112" ,
"isCustomerCreated": true ,
"createdAt": "2023-03-10T06:30:25.288Z" ,
"updatedAt": "2023-03-10T06:44:06.576Z" ,
"__v": 0 ,
"_id": "6409bfa6047734e75c4d716d" ,
}
}
Request Body Parameters
Parameter Name | Requirement (Optional or Mandatory) | Type | Description |
---|---|---|---|
shopNamer | Required | String | Enter name is a string type |
isActiveStatusrequired | Required | Boolean | Enter active status is a boolean type. With Default value as true |
User
Details User
To use the GET Method with permission as user to retrieve the user details.
/user
{
"error": false,
"user": {
"name": {
"first": "rishi xx",
"last": "rishi xx",
"full": "rishi xx rishi xx"
},
"_id": "63e21a0d479b25321e6b4a2c",
"userName": "rishi",
"email": "rishi@gmail.com",
"phoneNumber": "7788447744",
"isActiveStatus": "true",
"_createdBy": "63e1e646e6629599054eefe2",
"_updatedBy": "null",
"vertical": "flightrates",
"createdAt": "2023-02-07T09:29:49.267Z",
"updatedAt": "2023-03-10T09:02:06.067Z",
"__v": "1",
"customerType": "demo",
"expiryDate": "2022-12-31T00:00:00.000Z",
"_primaryAirline": "63ff432ce2276fc08e64f794",
"id": "63e21a0d479b25321e6b4a2c",
}
}
{
"handle": "rishi",
"password": "rishi"
}
Edit User Details
To use the PUT Method with permission as user to update the user details.
/user
Request Body Parameters
Sample Request (JSON Code Format Snippet)
{
"phoneNumber": 9614450410,
"password": "mynameachintya",
"name": {
"first": "Achintya",
"last": "Mondal"
},
"email": "test@gmail.com"
}
Sample Response (JSON Code ddddFormat Snippet)
{
"error": false,
"user": {
"name": {
"first": "rishi xx",
"last": "Mishra",
"full": "rishi xx Mishra"
},
"_id": "63e21a0d479b25321e6b4a2c",
"userName": "rishi",
"email": "rishi@gmail.com",
"phoneNumber": "7788447744",
"isActiveStatus": "true",
"_createdBy": "63e1e646e6629599054eefe2",
"_updatedBy": "null",
"vertical": "flightrates",
"createdAt": "2023-02-07T09:29:49.267Z",
"updatedAt": "2023-03-10T08:29:36.162Z",
"__v": "1",
"customerType": "demo",
"expiryDate": "2022-12-31T00:00:00.000Z",
"_primaryAirline": "63ff432ce2276fc08e64f794",
"id": "63e21a0d479b25321e6b4a2c",
}
}
Parameter Name | Requirement (Optional or Mandatory) | Type | Description |
---|---|---|---|
Required | String | Enter email is a string type | |
phoneNumber | Required | String | Enter phone number is a string type |
password | Required | String | Enter password is a string type |
name | Required | String | Enter name is a object type |
first | Required | String | Enter first is a string type |
last | Required | String | Enter last is a string type |
Success Response code is 200
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Success | edituserdetailsResp |
401 | Unauthorized | Authentication Failed | None |