Getting the error "ApiKey invalid" for hotel live prices - skyscanner

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

Related

Skyscanner API does not return data for flight search

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 :)

Here SDK flutter does not show places image. Always returns no data for images

I am new to "Here" and I am using Here SDK Flutter 4.3.3.0. I want to fetch/search for places and get the Place's Photos/Image and or Place's Logo if the place is a business/company.
The place images place.details.internalimages are always empty when I search for any place. I tried for different countries like "Chipotle" a restaurant near Las Vegas, a restaurant in Canda, and a Shopping mall in India. All of these return 0 (zero) images. Does, Here API support to get places photos like Google Places or TomTom API?
Looks like this API has a method to get WebImage List but does not contain any data at all. Please advise, If I need to use any other method to get Place's photos.
Another question is, is there a way to get a company logo, if the place I am searching for is a business/company like Restaurant, Store, etc.
Below is the code, I use in my Flutter application. Note, I am able to get other field values like title, address, etc.
TextQuery textQuery = TextQuery.withAreaCenterInCountries('some partial place name', geoCoordinates, countryCodes);
searchEngine.suggest(textQuery, searchOptions, onHereSearchSuggestionCompleted);
In onHereSearchSuggestionCompleted functions, I have the following code:
if(suggestions.length > 0){
print('explore - onHereSearchSuggestionCompleted - suggestions count > 0');
for (Suggestion suggestion in suggestions) {
print('onHereSearchSuggestionCompleted - current count = ${(suggestions.indexOf(suggestion) + 1)}');
print('onHereSearchSuggestionCompleted - suggestion title = ${suggestion.title}');
print('onHereSearchSuggestionCompleted - place id = ${suggestion.place.id}');
print('onHereSearchSuggestionCompleted - place title = ${suggestion.place.title}');
print('onHereSearchSuggestionCompleted - place address = ${suggestion.place.address.addressText}');
print('onHereSearchSuggestionCompleted - place img length = ${suggestion.place.details.internalimages.length}');
}
}
Please note, you have been able to see this functionality being exposed in flutter SDK due to a bug exposing internal methods in flutter. In general this functionality is not yet public (not in native android and iOS).
We plan to expose this functionality soon, however even when we do, only certain eligible customers would have access to the image content. There should be contractual agreement to be able to see this functionality

How to Integrate Apple Pay with Stripe in Xamarin.forms?

i'm following that blog entrance, https://agileapp.co/Stripe-and-ApplePay-with-Xamarin-Forms/, that tells us how to integrate Stripe with Apple Pay using Xamarin Forms.
I follow all code, and the only thing I changed is in PaymentButtonRenderer, CountryCode and CurrencyCode properties of PKPaymentRequest, set for use in Spain (ES and EUR), and of course, MerchantIdentifier as I set in apple developer portal.
All things I have to do in Stripe are already done.
As you can see in the images below, payment is not finished, and I don't know why. I don't know where I have to set the pay using Stripe (var myCharge = new ChargeCreateOptions()....), maybe in PCL ViewModel, in PaymentWillAuthorize or PaymentDidAuthorize... but I have two breakpoints and PaymentDidAuthorize never breaks, only PaymentWillAuthorize , but I don't know how I have to code in these methods.
Another extrange thing, is that if I use MerchantCapabilities as PKMerchantCapability.ThreeDS, I have an error message that tells that "Apple Pay is not available in my App", but if I change it to PKMerchantCapability.Debit, then the payment not finish.
Could you tell me what is wrong??
Thanks
Everything works fine, I just only create apple merchant certificate again, and code does what it have to do.
Problem solved, thanks #karllekko

Paypal Processing - Need to grab TransactionId, CorrelationId and TimeStamp

Current Project:
ASP.NET 4.5.2
MVC 5
PayPal API
I am using this example to build myself a PayPal transaction (and yes, my code is virtually identical), as I do not know of any other method that will return the three values in the title.
My main problem is that, the example I am utilizing is much more concise and compact than the one I used for a much older Web Forms application, and as such, I am unsure as to where or even how to grab the three values I need.
My initial thought was to do so right after the ACK, and indeed I was able to obtain the CorrelationId as well as the TimeStamp, but because this was prior to the user being carted off to PayPal’s site (sandbox in this case -- see the return new PayPalRedirect contained within the if), the TransactionId was blank. And in this example, PayPal explicitly redirects the user to a Success page without returning to the Action that sent the user to PayPal in the first place, and I am not seeing any GET values in the URL at all aside from the Token and the PayerId, much less ones that could provide me with the TransactionId.
Suggestions?
I have also looked at the following examples:
For ASP.NET Core, was unsure how to adapt to my current project particularly due to appsettings.json, but it looked quite well done. I really liked how the values were rolled up in lists.
For MVC 4, but I couldn’t find where ACK was being used to determine success or successwithwarning so I couldn’t hook into that.
I have also found the PayPal content to be like trying to drink from a fire hose at full blast -- not only was the content was hopelessly outdated (Web Forms code, FTW!) but there was also so many different examples it would have taken me days to determine which one was most appropriate to use.
Any assistance would be greatly appreciated.
Edit: my initial attempt at modifying the linked code has this portion:
values = Submit(values);
var ack = values["ACK"].ToLower();
if(ack == "success" || ack == "successwithwarning") {
using(_db = new ApplicationDbContext()) {
var updateOrder = await _db.Orders.FirstOrDefaultAsync(x => x.OrderId == order.OrderId);
if(updateOrder != null) {
updateOrder.OrderProcessed = false;
updateOrder.PayPalCorrelationId = values["CORRELATIONID"];
updateOrder.PayPalTransactionId = values["TRANSACTIONID"];
updateOrder.PayPalTimeStamp = values["TIMESTAMP"];
updateOrder.IPAddress = HttpContext.Current.Request.UserHostAddress;
_db.Entry(updateOrder).State = EntityState.Modified;
await _db.SaveChangesAsync();
}
}
return new PayPalRedirect {
Token = values["TOKEN"],
Url = $"https://{PayPalSettings.CgiDomain}/cgi-bin/webscr?cmd=_express-checkout&token={values["TOKEN"]}"
};
}
Everything within and including the using() is my added content. As I mentioned, the CorrelationId and the TimeStamp come through just fine, but I have yet to successfully obtain the TransactionId.
Edit 2:
More problems -- the transactions that are “successful” through the sandbox site (the ReturnUrl is getting called) aren’t reflecting properly on my Facilitator and Buyer accounts, even when I do payments straight from the buyer’s PayPal account (not using the Credit Card). I know I am supposed to see transactions in the Buyer’s account, either through the overall Dev account (Accounts -> Profile -> balance or Accounts -> Notifications) or through the Buyer’s account in the sandbox front end. And yet -- multiple transactions returning me to the ReturnUrl path, and yet no transactions in either.
Edit 3:
Okay, this is really, really weird. I have gone over all settings with a fine-toothed comb, and intentionally introduced errors to see where things should crap out. It turns out that the entire process goes swimmingly - except nothing shows up in my notifications and no amounts get moved between my different accounts (Facilitator and Buyer). It’s like all my transactions are going into /dev/null, yet the process is successful.
Edit 4: A hint!
In the sandbox, where Buyer accepts the transaction, there is a small note, “You will be able to review the transaction before completing it” or something like that -- suggesting that an additional page is not coming up and that the user is being uncerimoniously dumped back to the success page. Why the success page? No clue. But it’s happening.
It sounds like you are only doing the first part of the process.
Express Checkout consists of 3 API calls:
SetExpressCheckout
GetExpressCheckoutDetails
DoExpressCheckoutPayment
SEC generates a token, and then you redirect to PayPal where the user signs in and reviews the transactions before agreeing to pay.
They are then sent to the ReturnURL included in your SEC request, and this is where you'll call GECD in order to obtain all the buyer details that are now available since they signed in.
Using that data you can complete the final DECP request, which is what finalizes the procedure. No money is actually processed until this final call is completed successfully.

Linkedin - Get companies updates queries

I'm trying to create an app to read company updates, but I have a few queries. Please help...
I'm using LinkedIn api via Oauth authentication in R
Is there anyway to fetch more updates than the restriction (only allow fetch up to 250 updates or updates in the last 20 days whichever comes first) ?
Example code
https://api.linkedin.com/v1/companies/270126/updates?event-type=status-update&count=100&start=0 &oauth2_access_token={access_token}
Once I got the updateKey, I'm trying to fetch the comments and likes but it's returning NO return
Example code
https://api.linkedin.com/v1/companies/270126/updates/key=UPDATE-c270126-5951438751136768000/update-comments?event-type=status-update&oauth2_access_token={access_token}
https://api.linkedin.com/v1/companies/270126/updates/key=UPDATE-c270126-5951438751136768000/likes?event-type=status-update&oauth2_access_token={access_token}
From the company status-update, it's returning FALSE for is-commentable and is-likable? Is that why there are no result from Query 2. If so, is there anyway to change that setting?
'is-commentable' false '/is-commentable'
'is-likable' false '/is-likable'
Any help would be greatly appreciated!!!!
Linkedin developer - Reading Company Shares link
https://developer.linkedin.com/reading-company-shares
Try using the Share and Social Stream end point instead of the Companies end point like this:
https://api.linkedin.com/v1/people/~/network/updates/key=UPDATE-c270126-5951438751136768000/update-comments?oauth2_access_token={access_token}
The documentation is here:
https://developer.linkedin.com/documents/commenting-reading-comments-and-likes-network-updates
Also you can test different Linkedin API calls here:
https://apigee.com/console/linkedin

Resources