qstring必填
Search text, 1 to 500 characters.
https://api.sandbase.ai/v1/api/tripadvisor/searchSearch Tripadvisor hotels, restaurants, attractions and places by keyword.
您的輸出會顯示在這裡
完成輸入後,點擊執行。
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.
place_id and page link for a named business before looking up more detail.lat, lon and place_type.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.
| Name | Type | Required | Description |
|---|---|---|---|
q | string | Yes | Search text, 1 to 500 characters. |
geo_id | integer | No | Tripadvisor geography ID to search within. |
lat | number | No | Search center latitude from -90 through 90. Requires lon. |
locale | string | No | Lowercase language code with an optional uppercase country, such as en or en-US. |
lon | number | No | Search center longitude from -180 through 180. Requires lat. |
num | integer | No | Maximum number of search_results, 1 through 30, including any leading exact match. |
place_type | string | No | Restrict results to one entity type. |
start | integer | No | Result offset from 0 through 10,000. Offsets and positions count any leading exact match. |
timeout | number | No | 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 cal |
tripadvisor_domain | string | No | Supported first-party localized Tripadvisor hostname, such as www.tripadvisor.co.uk. |
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
}
]
}
| Field | Meaning |
|---|---|
search_results[].title | Name of the place, such as a hotel, restaurant or attraction. |
search_results[].place_id | Tripadvisor ID of the place, given as a string. It matches the number after -d in the link URL. |
search_results[].type / search_results[].detail_type | Entity 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_rating | Average rating of the place and the top of the rating scale, which is 5 in this response. |
search_results[].reviews | Number of reviews for the place. |
search_results[].link | Full Tripadvisor page URL for the place. |
search_results[].location | City or region text shown for the place, such as Austin, Texas. |
search_results[].position / search_results[].position_in_page | Rank of the result across the whole result set and within the current page. |
search_results[].thumbnail / search_results[].image.url_template | Photo URL for the result. In url_template, replace {width} and {height} to request a size. |
search_information.total_results / search_information.results_on_page | Total number of matches for the query and the number of results returned in this response. |
start (offset) and num (up to 30 results in one response).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.$0.00015 per successful call. Failed calls are not charged. It is included in the daily free quota of each organization.
開始建置
具備統一驗證與用量追蹤的平台 API 端點。
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",
"num": 30,
"start": 0,
"locale": "en-US",
"place_type": "all"
}'請將您的 SandBase API 金鑰設定在伺服器環境中。請求使用 Bearer 驗證。
export SANDBASE_API_KEY="YOUR_API_KEY"請將金鑰保留在伺服器端,不要在瀏覽器程式碼中公開。
qstring必填Search text, 1 to 500 characters.
tripadvisor_domainstringSupported first-party localized Tripadvisor hostname, such as www.tripadvisor.co.uk.
localestringLowercase language code with an optional uppercase country, such as en or en-US.
預設:"en-US"
geo_idintegerTripadvisor geography ID to search within.
latnumberSearch center latitude from -90 through 90. Requires lon.
lonnumberSearch center longitude from -180 through 180. Requires lat.
place_typestringRestrict results to one entity type.
預設:"all"
可能值:all, accommodation, attraction, attraction_product, eatery, geo
startintegerResult offset from 0 through 10,000. Offsets and positions count any leading exact match.
預設:0
numintegerMaximum number of search_results, 1 through 30, including any leading exact match.
預設:30
timeoutnumberOptional 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 的已儲存範例回應;檢視時不會發出即時請求。
尚未發布已儲存回應。請在 Playground 中執行 API 以檢視其回應。
探索更多
| API | 價格 | 回應 |
|---|---|---|
Tripadvisor Search此 API Tripadvisor | 每次呼叫 $0.00015 | JSON |
Tripadvisor | 每次呼叫 $0.00015 | 非同步 JSON |
Tripadvisor | 每次呼叫 $0.00015 | JSON |
問題
使用 POST 請求將您的 SandBase API 金鑰放在 Authorization 標頭(Bearer)中,並以 JSON 主體傳入參數,即可呼叫 https://api.sandbase.ai/v1/api/tripadvisor/search。您也可以直接在本頁的 Playground 試用,不必撰寫程式碼。
每次 $0.00015,並從您的 SandBase 餘額中扣款。您只會為實際發出的呼叫付費;沒有訂閱方案。
必要: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 會列出每個欄位。
在同一個 HTTP 請求中回傳的 JSON 回應(同步)。 本頁的 README 包含範例回應。
不需要。Tripadvisor Search 是透過 SandBase 運作,因此一組 SandBase API 金鑰即可使用此端點以及目錄中的其他所有 API 和模型。您不需要另外申請 Tripadvisor API 存取權。