Google maps hide smaller cities (localites) - api

I am using map styler and I am trying to hide the label of all small cities. the problem is that they are all listed as localities. so if I turn off the "featureType": "locality" it turns off even big cities.
Please have a look at the location on this google maps link, you will see when you zoom out bigger cities as for example 'Brasilia' and 'Goiania' have a bigger and bolder label. While the other smaller cities around have smaller font size label.
So obviously google maps by default is styling different sizes cities differently.
https://www.google.com.au/maps/place/Faina,+State+of+Goi%C3%A1s,+Brazil/#-15.4463132,-50.4081042,8z/data=!4m2!3m1!1s0x9367dd6707a3d11d:0xd225bdabe7eabd49
how could I create my own style for those smaller cities labels?
I tried "featureType": "locality.sub_locality" but it hides all localities including the big cities.

One option would be to hid all the localities ("locality.sub_locality"), then add your own labels for the big cities that you want visible.
proof of concept fiddle using a small sample of cities from geonames.org
code snippet:
function initialize() {
var map = new google.maps.Map(document.getElementById('map-canvas'), {
styles: [{
"featureType": "administrative.locality",
"elementType": "labels",
"stylers": [{
"visibility": "off"
}]
}]
});
google.maps.event.addListener(map, 'zoom_changed', function() {
for (var i = 0; i < mapLabels.length; i++) {
if (map.getZoom() > 5) {
mapLabels[i].setVisible(true);
} else {
mapLabels[i].setVisible(false);
}
}
});
google.maps.event.addListener(map, 'bounds_changed', function() {
document.getElementById('bounds').innerHTML = map.getBounds().toUrlValue(6);
});
var bounds = new google.maps.LatLngBounds();
var mapLabels = [];
for (var i = 0; i < citiesJSON.geonames.length; i++) {
var marker = new google.maps.Marker({
position: {
lat: citiesJSON.geonames[i].lat,
lng: citiesJSON.geonames[i].lng
},
// map:map,
title: citiesJSON.geonames[i].name
});
bounds.extend(marker.getPosition());
var myOptions = {
content: citiesJSON.geonames[i].name,
boxStyle: {
border: "none",
textAlign: "center",
fontSize: "8pt",
width: "100px"
},
disableAutoPan: true,
pixelOffset: new google.maps.Size(-50, 0),
position: new google.maps.LatLng(citiesJSON.geonames[i].lat,
citiesJSON.geonames[i].lng),
closeBoxURL: "",
isHidden: false,
pane: "mapPane",
enableEventPropagation: true
};
var ibLabel = new InfoBox(myOptions);
ibLabel.open(map);
mapLabels.push(ibLabel);
}
map.fitBounds(bounds);
}
google.maps.event.addDomListener(window, "load", initialize);
var citiesJSON = {
"geonames": [{
"lng": -47.92972,
"geonameId": 3469058,
"countrycode": "BR",
"name": "Brasília",
"fclName": "city, village,...",
"toponymName": "Brasília",
"fcodeName": "capital of a political entity",
"wikipedia": "en.wikipedia.org/wiki/Bras%C3%ADlia",
"lat": -15.77972,
"fcl": "P",
"population": 2207718,
"fcode": "PPLC"
}, {
"lng": -49.25388889,
"geonameId": 3462377,
"countrycode": "BR",
"name": "Goiânia",
"fclName": "city, village,...",
"toponymName": "Goiânia",
"fcodeName": "seat of a first-order administrative division",
"wikipedia": "en.wikipedia.org/wiki/Goi%C3%A2nia",
"lat": -16.67861111,
"fcl": "P",
"population": 1171195,
"fcode": "PPLA"
}, {
"lng": -47.81027778,
"geonameId": 3451328,
"countrycode": "BR",
"name": "Ribeirão Preto",
"fclName": "city, village,...",
"toponymName": "Ribeirão Preto",
"fcodeName": "seat of a second-order administrative division",
"wikipedia": "en.wikipedia.org/wiki/Ribeir%C3%A3o_Preto",
"lat": -21.1775,
"fcl": "P",
"population": 619746,
"fcode": "PPLA2"
}, {
"lng": -48.27722222,
"geonameId": 3445831,
"countrycode": "BR",
"name": "Uberlândia",
"fclName": "city, village,...",
"toponymName": "Uberlândia",
"fcodeName": "populated place",
"wikipedia": "en.wikipedia.org/wiki/Uberl%C3%A2ndia",
"lat": -18.91861111,
"fcl": "P",
"population": 563536,
"fcode": "PPL"
}, {
"lng": -49.37944444,
"geonameId": 3448639,
"countrycode": "BR",
"name": "São José do Rio Preto",
"fclName": "city, village,...",
"toponymName": "São José do Rio Preto",
"fcodeName": "seat of a second-order administrative division",
"wikipedia": "en.wikipedia.org/wiki/S%C3%A3o_Jos%C3%A9_do_Rio_Preto",
"lat": -20.81972222,
"fcl": "P",
"population": 374699,
"fcode": "PPLA2"
}, {
"lng": -48.95277778,
"geonameId": 3472287,
"countrycode": "BR",
"name": "Anápolis",
"fclName": "city, village,...",
"toponymName": "Anápolis",
"fcodeName": "populated place",
"wikipedia": "en.wikipedia.org/wiki/An%C3%A1polis",
"lat": -16.32666667,
"fcl": "P",
"population": 319587,
"fcode": "PPL"
}, {
"lng": -47.40083333,
"geonameId": 3463011,
"countrycode": "BR",
"name": "Franca",
"fclName": "city, village,...",
"toponymName": "Franca",
"fcodeName": "seat of a second-order administrative division",
"wikipedia": "en.wikipedia.org/wiki/Franca",
"lat": -20.53861111,
"fcl": "P",
"population": 305041,
"fcode": "PPLA2"
}, {
"lng": -47.93194444,
"geonameId": 3445839,
"countrycode": "BR",
"name": "Uberaba",
"fclName": "city, village,...",
"toponymName": "Uberaba",
"fcodeName": "populated place",
"wikipedia": "en.wikipedia.org/wiki/Uberaba",
"lat": -19.74833333,
"fcl": "P",
"population": 260843,
"fcode": "PPL"
}, {
"lng": -47.95027778,
"geonameId": 3458329,
"countrycode": "BR",
"name": "Luziânia",
"fclName": "city, village,...",
"toponymName": "Luziânia",
"fcodeName": "populated place",
"wikipedia": "en.wikipedia.org/wiki/Luzi%C3%A2nia",
"lat": -16.2525,
"fcl": "P",
"population": 143601,
"fcode": "PPL"
}, {
"lng": -46.51805556,
"geonameId": 3454783,
"countrycode": "BR",
"name": "Patos de Minas",
"fclName": "city, village,...",
"toponymName": "Patos de Minas",
"fcodeName": "populated place",
"wikipedia": "en.wikipedia.org/wiki/Patos_de_Minas",
"lat": -18.57888889,
"fcl": "P",
"population": 126234,
"fcode": "PPL"
}]
};
html,
body,
#map-canvas {
height: 100%;
width: 100%;
margin: 0px;
padding: 0px
}
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCkUOdZ5y7hMm0yrcCQoCvLwzdM6M8s5qk"></script>
<script src="https://cdn.jsdelivr.net/npm/google-maps-utility-library-v3-infobox#1.1.14/dist/infobox.js"></script>
<div id="bounds"></div>
<div id="map-canvas" style="border: 2px solid #3872ac;"></div>

Related

How To Filter Postman API Results

I am running this GET API query in Postman - https://[myDomain].atlassian.net/wiki/rest/api/space/ which returns the below results.
However, I'd like to filter out the results to display or return only some specific data, e.g. only the id, key, name, homepage and webui values. How can I achieve this in Postman?
{
"results": [
{
"id": 98430,
"key": "DOC",
"name": "Documents",
"type": "global",
"status": "current",
"_expandable": {
"settings": "/rest/api/space/DOC/settings",
"metadata": "",
"operations": "",
"lookAndFeel": "/rest/api/settings/lookandfeel?spaceKey=DOC",
"identifiers": "",
"permissions": "",
"icon": "",
"description": "",
"theme": "/rest/api/space/DOC/theme",
"history": "",
"homepage": "/rest/api/content/98633"
},
"_links": {
"webui": "/spaces/DOC",
"self": "https://xxxxxx.atlassian.net/wiki/rest/api/space/DOC"
}
},
{
"id": 425986,
"key": "~63be918f98bf50328c68aec2",
"name": "MyDocs",
"type": "personal",
"status": "current",
"_expandable": {
"settings": "/rest/api/space/~63be918f98bf50328c68aec2/settings",
"metadata": "",
"operations": "",
"lookAndFeel": "/rest/api/settings/lookandfeel?spaceKey=~63be918f98bf50328c68aec2",
"identifiers": "",
"permissions": "",
"icon": "",
"description": "",
"theme": "/rest/api/space/~63be918f98bf50328c68aec2/theme",
"history": "",
"homepage": "/rest/api/content/426171"
},
"_links": {
"webui": "/spaces/~63be918f98bf50328c68aec2",
"self": "https://xxxxxx.atlassian.net/wiki/rest/api/space/~63be918f98bf50328c68aec2"
}
},
{
"id": 2064386,
"key": "~5f7af04cb61f66006f28fafc",
"name": "Content Management",
"type": "personal",
"status": "current",
"_expandable": {
"settings": "/rest/api/space/~5f7af04cb61f66006f28fafc/settings",
"metadata": "",
"operations": "",
"lookAndFeel": "/rest/api/settings/lookandfeel?spaceKey=~5f7af04cb61f66006f28fafc",
"identifiers": "",
"permissions": "",
"icon": "",
"description": "",
"theme": "/rest/api/space/~5f7af04cb61f66006f28fafc/theme",
"history": "",
"homepage": "/rest/api/content/2064576"
},
"_links": {
"webui": "/spaces/~5f7af04cb61f66006f28fafc",
"self": "https://xxxxxx.atlassian.net/wiki/rest/api/space/~5f7af04cb61f66006f28fafc"
}
},
{
"id": 98306,
"key": "~5f7aef9c8d88b300751faba5",
"name": "AI Development",
"type": "personal",
"status": "current",
"_expandable": {
"settings": "/rest/api/space/~5f7aef9c8d88b300751faba5/settings",
"metadata": "",
"operations": "",
"lookAndFeel": "/rest/api/settings/lookandfeel?spaceKey=~5f7aef9c8d88b300751faba5",
"identifiers": "",
"permissions": "",
"icon": "",
"description": "",
"theme": "/rest/api/space/~5f7aef9c8d88b300751faba5/theme",
"history": "",
"homepage": "/rest/api/content/98389"
},
"_links": {
"webui": "/spaces/~5f7aef9c8d88b300751faba5",
"self": "https://xxxxxx.atlassian.net/wiki/rest/api/space/~5f7aef9c8d88b300751faba5"
}
},
{
"id": 229380,
"key": "SD",
"name": "Software Development",
"type": "global",
"status": "current",
"_expandable": {
"settings": "/rest/api/space/SD/settings",
"metadata": "",
"operations": "",
"lookAndFeel": "/rest/api/settings/lookandfeel?spaceKey=SD",
"identifiers": "",
"permissions": "",
"icon": "",
"description": "",
"theme": "/rest/api/space/SD/theme",
"history": "",
"homepage": "/rest/api/content/229464"
},
"_links": {
"webui": "/spaces/SD",
"self": "https://xxxxxx.atlassian.net/wiki/rest/api/space/SD"
}
}
],
"start": 0,
"limit": 25,
"size": 5,
"_links": {
"base": "https://xxxxxx.atlassian.net/wiki",
"context": "/wiki",
"self": "https://xxxxxx.atlassian.net/wiki/rest/api/space/"
}
}
IMO, you can't directly filter results to show in postman response tab.
However, you can achieve your goals by 2 work-arounds.
Use visualization function:
Put this code to your Tests tab
var template = `
<table bgcolor="#FFFFFF">
<tr>
<th>id</th>
<th>key</th>
<th>name</th>
<th>homepage</th>
<th>webui</th>
</tr>
{{#each response}}
<tr>
<td>{{id}}</td>
<td>{{key}}</td>
<td>{{name}}</td>
<td>{{_expandable.homepage}}</td>
<td>{{_links.webui}}</td>
</tr>
{{/each}}
</table>
`;
pm.visualizer.set(template, {
response: pm.response.json().results
});
Use logging function:
Put this code to your Tests tab
const res = pm.response.json().results;
res.forEach(e => {
let x = {
"id": e.id,
"key": e.key,
"name": e.name,
"homepage": e._expandable.homepage,
"webuid": e._links.webui
}
console.log(x)
})

When using the Quickbooks API explorer, read a vendor endpoint returns additional fields. How do I get these fields in actual API results?

Response from API via API explorer(by Intuit)
{
"Vendor": {
"BillAddr": {
"Id": "9",
"Line1": "31/2-34/2B, G01, Ground Floor (P V Enclave, V-Step Road)",
"Line2": "Kempapura",
"City": "Bangalore",
"Country": "India",
"CountrySubDivisionCode": "karnataka",
"PostalCode": "560037"
},
"BusinessNumber": "ABPFA3772K",
"Balance": 12960,
"BillRate": 0,
"Vendor1099": false,
"CurrencyRef": {
"value": "INR",
"name": "Indian Rupee"
},
"TDSEnabled": true,
"TDSEntityTypeId": 2,
"TDSSectionTypeId": 20,
"TDSOverrideThreshold": false,
"GSTIN": "29ABPFA3772K1ZT",
"GSTRegistrationType": "GST_REG_REG",
"CostRate": 0,
"domain": "QBO",
"sparse": false,
"Id": "5",
"SyncToken": "3",
"MetaData": {
"CreateTime": "2021-11-29T04:13:02-08:00",
"LastUpdatedTime": "2022-06-19T11:18:01-07:00"
},
"CompanyName": "Asyncauto",
"DisplayName": "Asyncauto",
"PrintOnCheckName": "Asyncauto",
"Active": true,
"V4IDPseudonym": "002085e0c7fca007484293913d58943f84b215",
"PrimaryPhone": {
"FreeFormNumber": "1231231234"
},
"PrimaryEmailAddr": {
"Address": "123123#mralbert.in"
}
},
"time": "2022-06-19T19:00:23.349-07:00"
}
Response from the actual API endpoint (quickbooks.api.intuit.com)
{
"Vendor": {
"BillAddr": {
"Id": "9",
"Line1": "31/2-34/2B, G01, Ground Floor (P V Enclave, V-Step Road)",
"Line2": "Kempapura",
"City": "Bangalore",
"Country": "India",
"CountrySubDivisionCode": "karnataka",
"PostalCode": "560037"
},
"BusinessNumber": "ABPFA3772K",
"Balance": 12960.00,
"Vendor1099": false,
"CurrencyRef": {
"value": "INR",
"name": "Indian Rupee"
},
"domain": "QBO",
"sparse": false,
"Id": "5",
"SyncToken": "3",
"MetaData": {
"CreateTime": "2021-11-29T04:13:02-08:00",
"LastUpdatedTime": "2022-06-19T11:18:01-07:00"
},
"CompanyName": "Asyncauto",
"DisplayName": "Asyncauto",
"PrintOnCheckName": "Asyncauto",
"Active": true,
"PrimaryPhone": {
"FreeFormNumber": "1231231234"
},
"PrimaryEmailAddr": {
"Address": "123123#mralbert.in"
}
},
"time": "2022-06-19T19:04:59.703-07:00"
}
Notice that in the second case these fields - "TDSEnabled","TDSEntityTypeId","TDSSectionTypeId","TDSOverrideThreshold","GSTIN","GSTRegistrationType", are missing.
How do I get these fields in the regular production endpoint?
Try using Postman and see if issue persist then you need to talk with quickbooks support.
I have found that in indian edition of quickbooks still has many issue open.

I keep getting 400 error(travelerId not existing) on calling the CreateOrder API

I am on a test Account.
On printing the travelerPricings Object to console, I have this
[
{
travelerId: '1',
fareOption: 'STANDARD',
travelerType: 'ADULT',
price: {
currency: '',
total: '',
base: '',
taxes: [Array],
refundableTaxes: ''
},
fareDetailsBySegment: [ [Object], [Object], [Object], [Object] ]
},
{
travelerId: '2',
fareOption: 'STANDARD',
travelerType: 'CHILD',
price: {
currency: '',
total: '',
base: '',
taxes: [Array],
refundableTaxes: ''
},
fareDetailsBySegment: [ [Object], [Object], [Object], [Object] ]
}
]
Yet on the Api Response, I keep getting the error pointer as
/data/flightOffers[0]/travelerPricings[1]"
Which is not true. As seen in the log shared above,
travelerPricings[1].travelerId = '2'
Please Why could this error come up? Thanks
Based on the Request, Here is the sample payload
{"data":
{
"flightOffers": [
{
"type": "flight-offer",
"id": "1",
"source": "GDS",
"instantTicketingRequired": false,
"nonHomogeneous": false,
"paymentCardRequired": false,
"lastTicketingDate": "2022-08-01",
"itineraries": [
{
"segments": [
{
"departure": {
"iataCode": "SYD",
"terminal": "1",
"at": "2022-08-01T11:35:00"
},
"arrival": {
"iataCode": "MNL",
"terminal": "2",
"at": "2022-08-01T16:50:00"
},
"carrierCode": "PR",
"number": "212",
"aircraft": {
"code": "333"
},
"operating": {
"carrierCode": "PR"
},
"duration": "PT7H15M",
"id": "15",
"numberOfStops": 0,
"co2Emissions": [
{
"weight": 716,
"weightUnit": "KG",
"cabin": "BUSINESS"
}
]
},
{
"departure": {
"iataCode": "MNL",
"terminal": "1",
"at": "2022-08-01T19:20:00"
},
"arrival": {
"iataCode": "BKK",
"at": "2022-08-01T21:50:00"
},
"carrierCode": "PR",
"number": "732",
"aircraft": {
"code": "320"
},
"operating": {
"carrierCode": "PR"
},
"duration": "PT3H30M",
"id": "16",
"numberOfStops": 0,
"co2Emissions": [
{
"weight": 148,
"weightUnit": "KG",
"cabin": "BUSINESS"
}
]
}
]
},
{
"segments": [
{
"departure": {
"iataCode": "BKK",
"at": "2022-08-05T22:50:00"
},
"arrival": {
"iataCode": "MNL",
"terminal": "2",
"at": "2022-08-06T03:15:00"
},
"carrierCode": "PR",
"number": "733",
"aircraft": {
"code": "321"
},
"operating": {
"carrierCode": "PR"
},
"duration": "PT3H25M",
"id": "59",
"numberOfStops": 0,
"co2Emissions": [
{
"weight": 148,
"weightUnit": "KG",
"cabin": "ECONOMY"
}
]
},
{
"departure": {
"iataCode": "MNL",
"terminal": "1",
"at": "2022-08-06T22:10:00"
},
"arrival": {
"iataCode": "SYD",
"terminal": "1",
"at": "2022-08-07T09:45:00"
},
"carrierCode": "PR",
"number": "211",
"aircraft": {
"code": "333"
},
"operating": {
"carrierCode": "PR"
},
"duration": "PT9H35M",
"id": "60",
"numberOfStops": 0,
"co2Emissions": [
{
"weight": 358,
"weightUnit": "KG",
"cabin": "ECONOMY"
}
]
}
]
}
],
"price": {
"currency": "NGN",
"total": "1479460.00",
"base": "1298255.00",
"fees": [
{
"amount": "0.00",
"type": "SUPPLIER"
},
{
"amount": "0.00",
"type": "TICKETING"
},
{
"amount": "0.00",
"type": "FORM_OF_PAYMENT"
}
],
"grandTotal": "1479460.00",
"billingCurrency": "NGN"
},
"pricingOptions": {
"fareType": [
"PUBLISHED"
],
"includedCheckedBagsOnly": false
},
"validatingAirlineCodes": [
"PR"
],
"travelerPricings": [
{
"travelerId": "1",
"fareOption": "STANDARD",
"travelerType": "ADULT",
"price": {
"currency": "NGN",
"total": "840536",
"base": "740769",
"taxes": [
{
"amount": "384.00",
"code": "G8"
},
{
"amount": "19112.00",
"code": "WY"
},
{
"amount": "896.00",
"code": "E7"
},
{
"amount": "18329.00",
"code": "AU"
},
{
"amount": "42766.00",
"code": "YQ"
},
{
"amount": "9320.00",
"code": "LI"
},
{
"amount": "8960.00",
"code": "TS"
}
],
"refundableTaxes": "108123"
},
"fareDetailsBySegment": [
{
"segmentId": "15",
"cabin": "BUSINESS",
"fareBasis": "DBAU",
"class": "D",
"includedCheckedBags": {
"weight": 40,
"weightUnit": "KG"
}
},
{
"segmentId": "16",
"cabin": "BUSINESS",
"fareBasis": "DBAU",
"class": "D",
"includedCheckedBags": {
"weight": 40,
"weightUnit": "KG"
}
},
{
"segmentId": "59",
"cabin": "ECONOMY",
"fareBasis": "KBAU",
"class": "K",
"includedCheckedBags": {
"weight": 30,
"weightUnit": "KG"
}
},
{
"segmentId": "60",
"cabin": "ECONOMY",
"fareBasis": "KBAU",
"class": "K",
"includedCheckedBags": {
"weight": 30,
"weightUnit": "KG"
}
}
]
},
{
"travelerId": "2",
"fareOption": "STANDARD",
"travelerType": "CHILD",
"price": {
"currency": "NGN",
"total": "638924",
"base": "557486",
"taxes": [
{
"amount": "384.00",
"code": "G8"
},
{
"amount": "19112.00",
"code": "WY"
},
{
"amount": "896.00",
"code": "E7"
},
{
"amount": "42766.00",
"code": "YQ"
},
{
"amount": "9320.00",
"code": "LI"
},
{
"amount": "8960.00",
"code": "TS"
}
],
"refundableTaxes": "89794"
},
"fareDetailsBySegment": [
{
"segmentId": "15",
"cabin": "BUSINESS",
"fareBasis": "DBAU",
"class": "D",
"includedCheckedBags": {
"weight": 40,
"weightUnit": "KG"
}
},
{
"segmentId": "16",
"cabin": "BUSINESS",
"fareBasis": "DBAU",
"class": "D",
"includedCheckedBags": {
"weight": 40,
"weightUnit": "KG"
}
},
{
"segmentId": "59",
"cabin": "ECONOMY",
"fareBasis": "KBAU",
"class": "K",
"includedCheckedBags": {
"weight": 30,
"weightUnit": "KG"
}
},
{
"segmentId": "60",
"cabin": "ECONOMY",
"fareBasis": "KBAU",
"class": "K",
"includedCheckedBags": {
"weight": 30,
"weightUnit": "KG"
}
}
]
}
]
}
],
"travelers": [ {
"id": "1",
"dateOfBirth": "1982-01-16",
"name": {
"firstName": "JORGE",
"lastName": "GONZALES"
},
"gender": "MALE",
"contact": {
"emailAddress": "jorge.gonzales833#telefonica.es",
"phones": [ {
"deviceType": "MOBILE",
"countryCallingCode": "34",
"number": "480080076"
} ]
},
"documents": [ {
"documentType": "PASSPORT",
"birthPlace": "Madrid",
"issuanceLocation": "Madrid",
"issuanceDate": "2015-04-14",
"number": "00000000",
"expiryDate": "2025-04-14",
"issuanceCountry": "ES",
"validityCountry": "ES",
"nationality": "ES",
"holder": true
} ]
} ]
}
MY Request using the NodeSDK
const {data:{flightOffers}} = req.body;
const {result} = await Amadeus.booking.flightOrders.post(
JSON.stringify({
'data': {
'type': 'flight-order',
'flightOffers': [ flightOffers[ 0 ] ],
'travelers': travelers
}
})
);
This is quite lengthy, but I did this so it is easy to just re-create the exact Scenario in case the issue is somewhere in the payload I am sending.
When you request Flight Create Order API, you have only put 1 traveler's information at the end that's why the error comes. you are requesting for flight order for 2 persons (1 adult and 1 child) so both information should be attached at the end.
below is a node example for the entire flow from Flight offer search, pricing, and create order. you may get a different error if some segments are not available, but the issue that you faced regarding travelers is resolved.
amadeus.shopping.flightOffersSearch.get({
originLocationCode: 'SYD',
destinationLocationCode: 'BKK',
departureDate: '2022-08-01',
adults: '1',
children: '1'
}).then(function (flightOffersResponse) {
return amadeus.shopping.flightOffers.pricing.post(
JSON.stringify({
'data': {
'type': 'flight-offers-pricing',
'flightOffers': [flightOffersResponse.data[0]]
}
})
)
}).then(function (pricingResponse) {
return amadeus.booking.flightOrders.post(
JSON.stringify({
'data': {
'type': 'flight-order',
'flightOffers': [pricingResponse.data.flightOffers[0]],
'travelers': [{
"id": "1",
"dateOfBirth": "1982-01-16",
"name": {
"firstName": "JORGE",
"lastName": "GONZALES"
},
"gender": "MALE",
"contact": {
"emailAddress": "jorge.gonzales833#telefonica.es",
"phones": [{
"deviceType": "MOBILE",
"countryCallingCode": "34",
"number": "480080076"
}]
},
"documents": [{
"documentType": "PASSPORT",
"birthPlace": "Madrid",
"issuanceLocation": "Madrid",
"issuanceDate": "2015-04-14",
"number": "00000000",
"expiryDate": "2025-04-14",
"issuanceCountry": "ES",
"validityCountry": "ES",
"nationality": "ES",
"holder": true
}]
},
{
"id": "2",
"dateOfBirth": "2012-10-11",
"gender": "FEMALE",
"contact": {
"emailAddress": "jorge.gonzales833#telefonica.es",
"phones": [
{
"deviceType": "MOBILE",
"countryCallingCode": "34",
"number": "480080076"
}
]
},
"name": {
"firstName": "ADRIANA",
"lastName": "GONZALES"
}
}]
}
})
);
}).then(function (response) {
console.log(response);
}).catch(function (response) {
console.error(response);
});

HereMap Reverse Geocode Not getting District, Street data in Iran Geo coordinates

https://revgeocode.search.hereapi.com/v1/revgeocode?at=36.080001136883894,51.43679934714218&lang=en-US&apiKey={APIKEY}&mode=retrieveAddresses&show=streetInfo
getting this response
{
"items": [
{
"title": "Iran, Iran",
"id": "here:cm:namedplace:22928285",
"resultType": "locality",
"localityType": "city",
"address": {
"label": "Iran, Iran",
"countryCode": "IRN",
"countryName": "Iran",
"county": "Iran",
"city": "Iran"
},
"position": {
"lat": 35.68877,
"lng": 51.41503
},
"distance": 0,
"mapView": {
"west": 44.03222,
"south": 25.05911,
"east": 63.333,
"north": 39.78253
}
}
]
}

Make the difference between the outbound flight and the return flight using Amadeus Flight Offer API

I'm using the flight offers API with PHP to get some flight offers with stopovers
This is what i get for the first flight offer
"duration": "PT16H",
"segments": [
{
"departure": {
"iataCode": "SYD",
"terminal": "1",
"at": "2021-11-04T22:15:00"
},
"arrival": {
"iataCode": "KUL",
"terminal": "M",
"at": "2021-11-05T03:50:00"
},
"carrierCode": "MH",
"number": "140",
"aircraft": {
"code": "333"
},
"operating": {
"carrierCode": "MH"
},
"duration": "PT8H35M",
"id": "1",
"numberOfStops": 0,
"blacklistedInEU": false
},
{
"departure": {
"iataCode": "KUL",
"terminal": "M",
"at": "2021-11-05T09:00:00"
},
"arrival": {
"iataCode": "BKK",
"at": "2021-11-05T10:15:00"
},
"carrierCode": "MH",
"number": "784",
"aircraft": {
"code": "738"
},
"operating": {
"carrierCode": "MH"
},
"duration": "PT2H15M",
"id": "2",
"numberOfStops": 0,
"blacklistedInEU": false
}
]
},
{
"duration": "PT20H25M",
"segments": [
{
"departure": {
"iataCode": "BKK",
"at": "2021-11-10T20:05:00"
},
"arrival": {
"iataCode": "KUL",
"terminal": "M",
"at": "2021-11-10T23:20:00"
},
"carrierCode": "MH",
"number": "781",
"aircraft": {
"code": "738"
},
"operating": {
"carrierCode": "MH"
},
"duration": "PT2H15M",
"id": "5",
"numberOfStops": 0,
"blacklistedInEU": false
},
{
"departure": {
"iataCode": "KUL",
"terminal": "M",
"at": "2021-11-11T09:10:00"
},
"arrival": {
"iataCode": "SYD",
"terminal": "1",
"at": "2021-11-11T20:30:00"
},
"carrierCode": "MH",
"number": "141",
"aircraft": {
"code": "333"
},
"operating": {
"carrierCode": "MH"
},
"duration": "PT8H20M",
"id": "6",
"numberOfStops": 0,
"blacklistedInEU": false
}
]
}
As you can see,
the outbound flight is from SYD to KUL and then from KUL to BKK
the return flight is from BKK to KUL and then from KUL to SYD
My question is : does the API have a tag to differentiate between the outbound and the return flight ?
I want to loop through the body result and return only the outbound flight and display it on my page.
This is what i've done so far but it just prints everything
$response_body = callAmadeusAPI($endpoint,$travel_data,$access_token);
//echo '<pre>', json_encode($response_body->data, JSON_PRETTY_PRINT), '</pre>';
//echo $response_body['data'];
foreach($response_body->data as $data)
{
foreach($data->itineraries as $itineraries)
{
foreach($itineraries->segments as $segments )
{
//echo '<br>'.$itineraries->duration.'</br>';
var_dump($segments);
}
}
//var_dump($data->itineraries);
}
Can you help me ?
Thank you in advance
bounds: Bound[]
Each bound corresponds to a group of flights. A one way trip contains one single bound. A round trip or open jaw trip contains two bounds (outbound and inbound)