qstringจำเป็น
Search text, 1 to 500 characters.
https://api.sandbase.ai/v1/api/tripadvisor/searchSearch Tripadvisor hotels, restaurants, attractions and places by keyword.
เอาต์พุตของคุณจะแสดงที่นี่
กรอกอินพุตให้ครบ แล้วคลิก Run
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.
เริ่มสร้าง
เอ็นด์พอยต์ของ Platform 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 key ของคุณในสภาพแวดล้อมฝั่งเซิร์ฟเวอร์ คำขอจะใช้การยืนยันตัวตนแบบ Bearer
export SANDBASE_API_KEY="YOUR_API_KEY"เก็บ 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 นี้; จะไม่มีการส่งคำขอจริงเมื่อเปิดดู
ยังไม่มีการเผยแพร่การตอบกลับที่บันทึกไว้ ให้รัน API ใน Playground เพื่อดูการตอบกลับ
สำรวจเพิ่มเติม
| API | ราคา | การตอบกลับ |
|---|---|---|
Tripadvisor SearchAPI นี้ Tripadvisor | $0.00015 ต่อการเรียก | JSON |
Tripadvisor | $0.00015 ต่อการเรียก | Async JSON |
Tripadvisor | $0.00015 ต่อการเรียก | JSON |
คำถาม
ส่งคำขอ POST ไปที่ https://api.sandbase.ai/v1/api/tripadvisor/search โดยใส่ SandBase API key ของคุณใน Authorization header (Bearer) และส่งพารามิเตอร์เป็น JSON body คุณยังสามารถลองใช้ได้ใน 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 ในหน้านี้แสดงทุกฟิลด์
การตอบกลับ JSON ที่ส่งกลับในคำขอ HTTP เดียวกัน (แบบซิงโครนัส) README บนหน้านี้มีตัวอย่างการตอบกลับ
ไม่จำเป็น Tripadvisor Search ทำงานผ่าน SandBase ดังนั้น SandBase API key เดียวครอบคลุม endpoint นี้และทุก API กับโมเดลอื่นในแค็ตตาล็อก คุณไม่ต้องสมัครขอสิทธิ์เข้าถึง Tripadvisor API แยกต่างหาก