Skyscanner API does not return data for flight search - skyscanner

I am playing around with the Skyscanner API from their webpage in Postman (opens in a new tab, or in the Postman desktop app) and testing the endpoint for browsing flights. This is what the API says in their page:
And this is what I am trying - browsing for flights from Stockholm Arlanda Airport (ARN-sky) to Heathrow (LHR-sky), on the date 22nd July (around 4 days from now) for first leg, and 25th for return, but as you can see, I am not getting any result. The URL I am trying is this.
Any idea what am I doing wrong, and how to fix it?

Please, mind that you present an image regarding an endpoint to Browse Quotes, but you are trying to consume an endpoint to Browse Routes.
Assuming that you actually want to browse routes, I believe the problem may be this:
The endpoint is of the form:
GET /browseroutes/v1.0/{country}/{currency}/{locale}/{originPlace}/{destinationPlace}/{outboundPartialDate}/{inboundPartialDate}
You are writing a URL like:
.../browseroutes/v1.0/FR/eur/en-US/us/ARN-sky/LHR-sky/2021-07-22/2021-07-25?apikey=<api-key>
So it seems that you are actually specifying:
originPlace = us
destinationPlace = ARN-sky
But I think you wanted to define:
originPlace = ARN-sky
destinationPlace = LHR-sky
To solve this, you may remove the /us member, thus writing: http://partners.api.skyscanner.net/apiservices/browseroutes/v1.0/FR/eur/en-US/ARN-sky/LHR-sky/2021-07-22/2021-07-25?apikey=api-key
(Please, replace the api-key value by an actual API key)
This URL already returns a valid 200 OK result :)

Related

Avoid Areas not working in Here Fleet Telematics

Im using the "avoidareas" parameter to remove some points from the initial trip. This method worked a couple of months ago, but now it returns the same route as the initial trip, ignoring the "avoidareas" parameter.
Here is the exemple im working with:
"https://fleet.ls.hereapi.com/2/calculateroute.json?apiKey={YOUR API KEY}&mode=fastest;truck;traffic:enabled;&currency=EUR&restTimes=EU&traverseGates=true&tollVehicleType=3&trailerType=2&trailersCount=1&length=13.6&width=2.4m&height=3m&limitedWeight=24000kg&legAttributes=li,-mn,sh&linkAttributes=wn,le,sh,-fc&mapMatchRadius=5000&ignoreWaypointVehicleRestriction=5000;0;all&departure=2022-09-08T16:00:00&waypoint0=40.613223,-3.2451044&waypoint1=39.919898,-8.634333&avoidareas41.6419,-5.16831;41.541900000000005,-5.06831"
Am i doing something wrong? Has something been updated?
The 'avoidAreas' feature works, but the request needs to be verified for the following:
the parameter name is in camelCase, so it should be 'avoidAreas', you are missing "=" sign right after avoidareas in your request url,
avoid area rectangle should be specified by latMax,lonMin;latMin,lonMax
A sample request looks like https://fleet.api.here.com/2/calculateroute.json?waypoint0=50.112698,8.675777&waypoint1=48.544180,9.662530&mode=fastest;truck;traffic:enabled&departure=2022-08-09T13:12:35&alternatives=0&weightPerAxle=3.25t&limitedWeight=7.5t&height=3.4m&width=2.5m&length=7.2m&trailersCount=1&avoidAreas=48.988757459020015,8.436328214242295;48.94714399157084,8.493687099461848
Thanks
/MS

LinkedIn Share API Response is returning an updateUrl which when visited goes to a page not found

I have an application which is successfully sharing to LinkedIn as per the official documentation here:
https://developer.linkedin.com/docs/share-on-linkedin
When I get a 201 created response the content is being shared to LinkedIn which is great...but in the response under the updateUrl property the URL I always get is bringing back a page not found URL, for example:
https://www.linkedin.com/company/3728030/comments?topic=6368780249068507136&type=U&scope=3728030&stype=C&a=_YH0
When I visit the actual post on LinkedIn and get the post URL it gets this: https://www.linkedin.com/feed/update/urn:li:activity:6368780249068507136
and this URL actually works. In the documentation it says:
The updateURL value is a direct link to the newly shared content on LinkedIn.com that you can direct the user's web browser to.
I have tried this on multiple LinkedIn accounts and I am getting the same issue. I could parse my updateUrl property and transform it into a working URL but as per the documentation I shouldn't have to do this and it seems like a bug...
The same thing applies to newly created company shares: https://developer.linkedin.com/docs/company-pages#company_share
The returned value is e.g.
{
"updateKey": "UPDATE-c111111-11111111",
"updateUrl": "https://www.linkedin.com/company/111111/comments?topic=11111111&type=U&scope=18464510&stype=C&a=ls_e"
}
That URL directs you to a non-existing page. For proper use, the "updateKey" needs to be parsed and the link manually created e.g. "https://www.linkedin.com/feed/update/urn:li:activity:11111111"
Note, the URLs and keys are changed.
I'm also wondering the purpose of the "updateUrl", since its undocumented on company shares, and seemingly misleading on shares documentation.
Thanks :)

Getting the error "ApiKey invalid" for hotel live prices

I'm trying to get the a list of current hotel prices but I can't get my API Key to work. I've had it for a couple days so I know it isn't too new. I even tried the example in the docs (after fixing the dates):
http://partners.api.skyscanner.net/apiservices/hotels/liveprices/v2/UK/EUR/en-GB/27539733/2016-12-04/2016-12-10/2/1?apiKey=myKey
While it worked for the demo key it wouldn't work for mine. I also tried it on the ec2 micro I'm using for testing with Python and get a response with u'{"errors":["ApiKey invalid"]}':
SKY_SCAN_URL = "http://partners.api.skyscanner.net/apiservices/hotels/liveprices/v2/"
sky_key = get_sky_scan_key()
def get_hotels(request):
entityid = request.GET['entityid']
checkindate = date_formatter(request.GET['start'])
checkoutdate = date_formatter(request.GET['end'])
rooms = request.GET['rooms']
guests = request.GET['guests']
FINAL_SKY_URL = "%s/%s/%s/%s/%s/%s/%s/%s/%s/?apiKey=%s" % (
SKY_SCAN_URL, 'US', 'USD', 'en-US', entityid, checkindate, checkoutdate, guests, rooms, sky_key)
sky_response = requests.get(FINAL_SKY_URL)
This function outputs a get request with a URL like this:
http://partners.api.skyscanner.net/apiservices/hotels/liveprices/v2//US/USD/en-US/20.7983626,-156.3319253-latlong/2016-09-07/2016-09-14/1/1/?apiKey=myKey
Any advice on what the possible issue could be would be awesome, thanks!
Edit:
To be more specific I'm looking for reasons why my API Key is invalid. I'm not familiar with skyscan and while I've added an app from the skyscanner dashboard by clicking the travel api and copied the key into my project and directly into a valid url my key is showing as bad. Are there any additional steps or things that I need to take into account?
I don't know about how you're creating the URL but it seems like it shouldn't be built that way. (most likely due to their misleading documentation)
This:
http://partners.api.skyscanner.net/apiservices/hotels/liveprices/v3/?apiKey=myKey&checkoutdate=2016-09-14&checkindate=2016-09-07&currency=USD&rooms=1&entityid=20.7983626%2C-156.3319253-latlong&local=en-US&market=US&guests=1
Should be:
http://partners.api.skyscanner.net/apiservices/hotels/liveprices/v3/US/USD/en-US/20.7983626,-156.3319253-latlong/2016-09-07/2016-09-14/1/1/?apiKey=myKey
Your code should be something like:
SKY_SCAN_URL = "http://partners.api.skyscanner.net/apiservices/hotels/liveprices/v3/"
FINAL_URL = "%s/%s/%s/%s/%s/%s/%s/%s/%s/?apiKey=%s" % (SKY_SCAN_URL, market, currency, locale, entityid, checkindate, checkoutdate, guests, rooms, apiKey)
sky_response = requests.get(FINAL_URL)
I also suggest you do some tests here.
From their help site as of 17 days ago -
https://support.business.skyscanner.net/hc/en-us/articles/209452689-Why-is-my-API-key-returning-no-results-for-hotels-
"Our Hotels API is currently being reworked, and access is not available at present. Apologies for any inconvenience, when the new API is ready for use we will update the Skyscanner for Business site, so please check back there for updates."
Unclear when this changes.
Since April 2017, skyScanner started re-working their Hotels API, thus stopping all ongoing API calls to LIVE Pricing APIs:
https://support.business.skyscanner.net/hc/en-us/articles/209452689-Why-is-my-API-key-returning-no-results-for-hotels-
Hotels and Flights Cached Pricing and Browse services still working, though I am not sure if it is enough for your business case.
It seems that Skyscanner has updated their Hotels API recently and the documentation can be found here: https://skyscanner.github.io/slate/#hotels-live-prices

What is wrong with this call to Google Analytics __utm.gif?

I am trying to use PHP to fire hits at Google to track newsletter opens and clickthroughs. I want to use the same technique for both clickthroughs and opens since the clickthroughs will go to sites outside of my own control - I want to be able to report on the clickthrough rates of the newsletters regardless of where the clicks go to. I was thinking of trying code.google.com/p/php-ga/ but there is little in the way of example code/support docs to start with so I am hesitant.
Here is my url to __utm.gif broken up over the lines for clarity:
utm.gif?utmac=MO-xxx31982-1">http://www.google-analytics.com/_utm.gif?utmac=MO-xxx31982-1
&utmhn=myfake.com
&utmcc=_utma%3D7042858245.1436153422.1214501708.1340117181.1340117181.1%3B%2B_utmz%3D1.1340117181.1.1.utmcsr%3D%28direct%29%7Cutmccn%3D%28direct%29%7Cutmcmd%3D%28none%29%3B
&utmwv=1
&utmr=click
&utm_source=Emails
&utm_medium=Newsletter
&utm_campaign=tet+2012-06-19+10%3A41%3A30
&utmp=%2FMYZZ%2FNEWSLETTERS
&uservar=16430
Does the utmhn need to be a legit URL or one associated with the account? What about utmr? I was using that to contain 'click' or 'open' so I could differentiate.
When I click a link in the newsletter I get the expected pixel image returned so Google is getting something anyway even if ignoring my querystring. In my Google Analytics account where should I see the data relating the the __utm.gif hits? So far I see none when using this technique.
P.S. I got this technique from here
Follow up:
I changed a few things and my url now looks like so:
utm.gif?utmwv=1">http://www.google-analytics.com/_utm.gif?utmwv=1
&utmn=8391432847
&utmsr=click
&utmsc=-
&utmul=-
&utmje=0
&utmfl=-
&utmdt=-
&utmhn=myfake.com
&utm_source=my_newsletter
&utm_medium=Emails
&utm_campaign=tet 2012-06-19 10:41:30
&utmr=my_newsletter
&utmp=images/google/click
&utmac=MO-xxx31982-1
&utmcc=_utma%3D24820632.1925394567.1340121629.1340121629.1340121629.2%3B%2B_utmb%3D24820632%3B%2B_utmc%3D24820632%3B%2B_utmz%3D24820632.1340121629.2.2.utmccn%3D(direct)%7Cutmcsr%3D(direct)%7Cutmcmd%3D(none)%3B%2B__utmv%3D24820632.6430%3B
and nothing happens except when I paste that link into my browser then Google gets it, so why does it not work when called from the PHP line $handle = fopen ($urchinUrl1, "r");?
ok, nevermind. I changed my app around so the utm.gif is just included in the email and in a redirect page rather than called from the script. Should have done it that way but got caught up in the fancier idea of calling the url from php.
Even though this question is over a year old...the GA measurement protocol can be used to send hits back to GA for newsletter opens and clickthroughs.
To answer your initial question, it looks like you're missing the utmhid and utmn parameters.

trouble with example google maps code

executing this:
$curl "http://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&sensor=false"
returns this:
{
"results" : [],
"status" : "ZERO_RESULTS"
}
Why doesn't it work?
Cheers!
Not sure, but I get the same results when I hit that URL directly in the browser. It may have something to do with that being the sample address that is shown in Geocoding Responses section of the Google Maps API Web Services Dev Guide. Maybe they turned it off because it was getting overloaded?
I even tried a version of that address that has been URL encoded:
http://maps.googleapis.com/maps/api/geocode/json?address=1600%20Amphitheatre%20Parkway%2C%20Mountain%20View%2C%20CA&sensor=false
but get the same result as the original attempt.
I can tell you that if you go directly to http://maps.google.com/maps and key in: 1600 Amphitheatre Parkway, Mountain View, CA, you do get results.
At any rate, your URL is basically formatted correctly and should work. Try a different address, formatted the same way, and you will get results. This worked fine for me:
http://maps.googleapis.com/maps/api/geocode/json?address=Wrigley+Field&sensor=false
Some follow up, I'm not sure where you were trying to run your code, but if it was in a jsFiddle, you may be interested in this question: JQuery won't get json?

Resources