简体   繁体   English

如何将TripAdvisor与IOS APP集成?

[英]How to integrate TripAdvisor with IOS APP?

In my app i need to integrate it with TripAdvisor API. 在我的应用程序中,我需要将其与TripAdvisor API集成。 i searched a lot about it, i found this in there website: https://developer-tripadvisor.com/content-api/ it's actually un useful!. 我搜索了很多东西,我在那里的网站上找到了这个东西: https : //developer-tripadvisor.com/content-api/这实际上是没有用的! I didn't find any example or demo for this integration! 我没有找到有关此集成的任何示例或演示! Anyone knows how to integrate with TripAdvisor in IOS? 有谁知道如何在iOS中与TripAdvisor集成? Or have any example about it? 或有任何例子吗? thanks 谢谢

Well, just like most APIs, you first have to get your API key from TripAdvisor. 好吧,就像大多数API一样,您首先必须从TripAdvisor那里获取API密钥。 So go to the Request API Access form and fill that out (You have to sign up for Trip Advisor first, or sign in with a Facebook or Google account). 因此,请转到“ 请求API访问”表单并填写该表单(您必须先注册Trip Advisor,或者使用Facebook或Google帐户登录)。 They will then contact you with your API key and info. 然后,他们将与您联系并提供您的API密钥和信息。

Now that you have the key, the more interesting part takes place. 有了密钥,就可以进行更有趣的部分了。 You can use the app in HTTP requests in your app ( Example Here ) with the URL of the request you want to make. 您可以在应用程序中的HTTP请求( 此处为示例 )中使用该应用程序,并带有要发出的请求的URL。 For example, if I wanted to get results for hotels with my coordinates, I would use this URL: 例如,如果要获取具有坐标的酒店的结果,则可以使用以下URL:

http://api.tripadvisor.com/api/partner/2.0/map/42.33141,-71.099396/hotels?key=<YOUR KEY HERE>

The response would be some JSON code which you can parse with Swift's built-in JSON parser, NSJSONSerialization . 响应将是一些JSON代码,您可以使用Swift的内置JSON解析器NSJSONSerialization对其进行解析 With this data, you can now store and make use of what you needed from their API. 有了这些数据,您现在可以存储和利用其API中的需求。

To see the full API documentation of all the requests you can do and their details, just visit the TripAdvisor API Documentation . 要查看您可以执行的所有请求的完整API文档及其详细信息,只需访问TripAdvisor API文档

Hope this helps, 希望这可以帮助,

Gabriel 加布里埃尔

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM