Sand AISand AI MAGI-2MAGI-2 hiện đã có trên SandBase: video 1080p với âm thanh gốcDùng thử ngay

Tripadvisor Search

Tài liệu API
https://api.sandbase.ai/v1/api/tripadvisor/search

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

Giá
$0.00015USD / lượt gọi
Phương thức
POST
Phản hồi
JSON
Tham số
1 bắt buộc · 9 tùy chọn

Phòng thử nghiệm

Đầu vào
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
Đầu raSẵn sàng

Đầu ra của bạn sẽ xuất hiện ở đây

Hoàn tất đầu vào, rồi nhấp Run.

README API

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.

Khám phá thêm

APIs liên quan

Tất cả APIs
APIGiáPhản hồi
Tripadvisor$0.00015 mỗi lần gọiJSON
Tripadvisor$0.00015 mỗi lần gọiJSON bất đồng bộ
Tripadvisor$0.00015 mỗi lần gọiJSON

Câu hỏi

FAQ

Làm thế nào để dùng API Tripadvisor Search?

Gửi yêu cầu POST đến https://api.sandbase.ai/v1/api/tripadvisor/search với khóa API SandBase của bạn trong tiêu đề Authorization (Bearer) và các tham số trong phần thân JSON. Bạn cũng có thể thử trực tiếp trong Playground trên trang này mà không cần viết code.

API Tripadvisor Search có giá bao nhiêu?

$0.00015 mỗi lần gọi, được tính từ số dư SandBase của bạn. Bạn chỉ bị tính phí cho các lần gọi bạn thực hiện; không có gói đăng ký.

API Tripadvisor Search chấp nhận những tham số nào?

Bắt buộc: q (string). Tùy chọn: tripadvisor_domain (string), locale (string), geo_id (integer), lat (number), lon (number) và place_type (một trong số all, accommodation, attraction, attraction_product, eatery, geo) và 3 mục khác. Bảng Parameters và Playground trên trang này liệt kê mọi trường.

API Tripadvisor Search trả về gì?

Phản hồi JSON được trả về trong cùng một yêu cầu HTTP (đồng bộ). README trên trang này có ví dụ phản hồi.

Tôi có cần tài khoản nhà phát triển hoặc API key của Tripadvisor không?

Không. Tripadvisor Search chạy thông qua SandBase, nên chỉ cần một API key SandBase là đủ cho endpoint này và mọi API cùng model khác trong danh mục. Bạn không cần đăng ký riêng để có quyền truy cập API của Tripadvisor.