Sand AISand AI MAGI-2MAGI-2 现已上线 SandBase:支持原生音频的 1080p 视频立即试用

Tripadvisor Search

API 文档
https://api.sandbase.ai/v1/api/tripadvisor/search

Search Tripadvisor hotels, restaurants, attractions and places by keyword.

价格
$0.00015美元 / 次调用
方法
POST
响应
JSON
参数
1 个必填 · 9 个可选

Playground

输入
Search text, 1 to 500 characters.
Supported first-party localized Tripadvisor hostname, such as www.tripadvisor.co.uk.
Lowercase language code with an optional uppercase country, such as en or en-US.
Tripadvisor geography ID to search within.
Search center latitude from -90 through 90. Requires lon.
Search center longitude from -180 through 180. Requires lat.
Restrict results to one entity type.
Result offset from 0 through 10,000. Offsets and positions count any leading exact match.
Maximum number of search_results, 1 through 30, including any leading exact match.
Optional budget for the entire request in seconds, measured from gateway receipt until the response is ready to send. Includes admission, queueing and settlement. Must be greater than 0 and at most 90. On expiry, the call is not billed and returns 503 request_deadline_exceeded with retryable=true an
输出就绪

您的输出将显示在这里

完成输入,然后点击运行。

API README

Tripadvisor Search API

Returns Tripadvisor search results for a keyword query, such as hotels, restaurants, attractions and places. The only required input is q. You can narrow results with geo_id, lat and lon, place_type or a localized Tripadvisor domain.

Use cases

  • Build a list of hotels in a city with ratings and review counts to compare them.
  • Find the Tripadvisor place_id and page link for a named business before looking up more detail.
  • Collect restaurants or attractions near a latitude and longitude using lat, lon and place_type.
  • Run the same query on a schedule to see how the review count and rating of a set of properties change.

Request

curl -X POST "https://api.sandbase.ai/v1/api/tripadvisor/search" \
  -H "Authorization: Bearer $SANDBASE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"q": "hotels in Austin Texas"}'

The result is returned in outputs[0].data.

Parameters

NameTypeRequiredDescription
qstringYesSearch text, 1 to 500 characters.
geo_idintegerNoTripadvisor geography ID to search within.
latnumberNoSearch center latitude from -90 through 90. Requires lon.
localestringNoLowercase language code with an optional uppercase country, such as en or en-US.
lonnumberNoSearch center longitude from -180 through 180. Requires lat.
numintegerNoMaximum number of search_results, 1 through 30, including any leading exact match.
place_typestringNoRestrict results to one entity type.
startintegerNoResult offset from 0 through 10,000. Offsets and positions count any leading exact match.
timeoutnumberNoOptional budget for the entire request in seconds, measured from gateway receipt until the response is ready to send. Includes admission, queueing and settlement. Must be greater than 0 and at most 90. On expiry, the cal
tripadvisor_domainstringNoSupported first-party localized Tripadvisor hostname, such as www.tripadvisor.co.uk.

Example response

Real response for the request above, trimmed: lists keep their first item and long strings are cut.

{
  "map_previews": [],
  "pagination": {},
  "search_information": {
    "results_on_page": 30,
    "total_results": 2000
  },
  "search_results": [
    {
      "description": "Located in Downtown Austin's vibrant Second Street District, Austin Proper Hotel…",
      "detail_type": "Hotel",
      "highlighted_spans": [
        {
          "length": 6,
          "offset": 3
        }
      ],
      "image": {
        "max_height": 2667,
        "max_width": 4000,
        "thumbnail": "https://dynamic-media-cdn.tripadvisor.com/media/photo-o/35/01/4d/b9/outdoor-pool…",
        "url_template": "https://dynamic-media-cdn.tripadvisor.com/media/photo-o/35/01/4d/b9/outdoor-pool…"
      },
      "link": "https://www.tripadvisor.com/Hotel_Review-g30196-d18941405-Reviews-Austin_Proper_…",
      "location": "Austin, Texas",
      "max_rating": 5,
      "mention_count": 16,
      "place_id": "18941405",
      "position": 1,
      "position_in_page": 1,
      "rating": 4.6
    }
  ]
}

Response fields

FieldMeaning
search_results[].titleName of the place, such as a hotel, restaurant or attraction.
search_results[].place_idTripadvisor ID of the place, given as a string. It matches the number after -d in the link URL.
search_results[].type / search_results[].detail_typeEntity type of the result. type is a code such as ACCOMMODATION and detail_type is a label such as Hotel.
search_results[].rating / search_results[].max_ratingAverage rating of the place and the top of the rating scale, which is 5 in this response.
search_results[].reviewsNumber of reviews for the place.
search_results[].linkFull Tripadvisor page URL for the place.
search_results[].locationCity or region text shown for the place, such as Austin, Texas.
search_results[].position / search_results[].position_in_pageRank of the result across the whole result set and within the current page.
search_results[].thumbnail / search_results[].image.url_templatePhoto URL for the result. In url_template, replace {width} and {height} to request a size.
search_information.total_results / search_information.results_on_pageTotal number of matches for the query and the number of results returned in this response.

Notes

  • Page through results with start (offset) and num (up to 30 results in one response).
  • Use place_type to limit results to one type: accommodation, attraction, attraction_product, eatery or geo.
  • place_id is a numeric string. The same value appears after -d in the link URL.
  • To read guest reviews for a result, use Tripadvisor Reviews next.

Pricing

$0.00015 per successful call. Failed calls are not charged. It is included in the daily free quota of each organization.

探索更多

相关 APIs

全部 APIs
API价格响应
Tripadvisor$0.00015 每次调用JSON
Tripadvisor$0.00015 每次调用异步 JSON
Tripadvisor$0.00015 每次调用JSON

问题

常见问题

如何使用 Tripadvisor Search API?

向 https://api.sandbase.ai/v1/api/tripadvisor/search 发送 POST 请求,在 Authorization 请求头中使用您的 SandBase API key(Bearer),并将参数作为 JSON 请求体传入。您也可以直接在本页的 Playground 中试用,无需编写代码。

Tripadvisor Search API 的价格是多少?

每次调用 $0.00015,从您的 SandBase 余额中扣费。您只需为实际调用付费;无需订阅。

Tripadvisor Search API 接受哪些参数?

必填:q (string)。 可选:tripadvisor_domain (string), locale (string), geo_id (integer), lat (number), lon (number) 和 place_type(all, accommodation, attraction, attraction_product, eatery, geo 之一) 以及另外 3 项。 Parameters 表和本页的 Playground 列出了每个字段。

Tripadvisor Search API 返回什么?

在同一个 HTTP 请求中返回的 JSON 响应(同步)。 本页的 README 包含一个示例响应。

我需要 Tripadvisor 开发者账户或 API key 吗?

不需要。Tripadvisor Search 通过 SandBase 运行,因此一个 SandBase API key 即可覆盖此端点以及目录中的其他所有 API 和模型。您无需单独申请 Tripadvisor API 访问权限。