API Hop

Tài liệu

Tài liệu API Hop

Tham chiếu Google Hotels

Tìm khách sạn, gợi ý, ảnh và đánh giá trên Google Hotels.

Giới hạn đồng thời

AI và Data mỗi loại dùng chung một nhóm lượt đồng thời trên toàn tài khoản: mặc định 5 AI / 2 Data, tùy theo gói đăng ký. Giới hạn riêng của endpoint vẫn chịu giới hạn tổng của loại API. Khi đạt bất kỳ giới hạn nào, API trả về HTTP 429. Tác vụ bất đồng bộ giữ chỗ đến khi thực thi kết thúc.

GET /v1/google-hotels/search
Giới hạn mặc định: 2
GET /v1/google-hotels/autocomplete
Giới hạn mặc định: 2
GET /v1/google-hotels/photos
Giới hạn mặc định: 2
GET /v1/google-hotels/reviews
Giới hạn mặc định: 2

Tìm khách sạn, gợi ý, ảnh và đánh giá trên Google Hotels.

Xác thực và phí

Giá mặc định là $0.0003 (300 credits) cho mỗi yêu cầu thành công. Dùng khóa API API Hop. Quyền truy cập phụ thuộc cổng đang bật và quyền khóa. Xem danh mục và tài khoản để biết giá mỗi yêu cầu thành công; ưu tiên giá tài khoản. Kết quả rỗng thành công vẫn tính phí. Lỗi giải phóng khoản giữ trước. Hết hạn sau 60 giây, không tự thử lại hay phân trang. Lỗi quyết toán không gọi lại nhà cung cấp.

http
Authorization: Bearer YOUR_API_KEY

Google Hotels: Tìm khách sạn

GET https://api.apihop.ai/v1/google-hotels/search

Tham số

TrườngKiểuGiới hạnVí dụ
querystringTừ khóa tìm kiếm; query: optionalhotels in New York
next_page_tokenstringMã trang tiếp theo; next_page_token: optional; UTF-8 bytes: 24576-
currencystringMã tiền tệ (currency); currency: optional; ALL, DZD, ARS, AMD, AWG, AUD, AZN, BSD, BHD, BYN, BMD, BAM, BRL, GBP, BGN, XPF, CAD, CLP, CNY, COP, CRC, CUP, CZK, DKK, DOP, EGP, EUR, GEL, HKD, HUF, ISK, INR, IDR, IRR, ILS, JMD, JPY, JOD, KZT, KWD, LBP, MKD, MYR, MXN, MDL, MAD, TWD, NZD, NOK, OMR, PKR, PAB, PEN, PHP, PLN, QAR, RON, RUB, SAR, RSD, SGD, ZAR, KRW, SEK, CHF, THB, TRY, USD, UAH, AED, VND; ^[A-Z]{3}$USD
countrystringMã quốc gia hoặc cửa hàng (country); country: optional; ^[A-Za-z]{2}$-
languagestringNgôn ngữ; language: optional-
limitintegerGiới hạn kết quả; limit: optional; min: 1; max: 1001
devicestringThiết bị; device: optional; desktop, mobile, tabletdesktop
zero_tracebooleanKhông lưu trữ phản hồi; zero_trace: optionaltrue
check_in_datestringNgày đi (YYYY-MM-DD) hoặc khoảng ngày được hỗ trợ (check_in_date); check_in_date: optional; ^[0-9]{4}-[0-9]{2}-[0-9]{2}$-
check_out_datestringNgày đi (YYYY-MM-DD) hoặc khoảng ngày được hỗ trợ (check_out_date); check_out_date: optional; ^[0-9]{4}-[0-9]{2}-[0-9]{2}$-
adultsintegerSố người lớn (adults); adults: optional; min: 1; max: 1001
childrenintegerSố trẻ em (children); children: optional; min: 0; max: 990
children_agesstringDanh sách tuổi trẻ em (children_ages); Mặc định: 12; children_ages: optional; UTF-8 bytes: 296; ^(?:[1-9]|1[0-7])(?:,(?:[1-9]|1[0-7])){0,98}$-
sort_bystringSắp xếp; sort_by: optional; relevance, lowest_price, highest_rating, most_reviewedrelevance
min_priceintegerGiá tối thiểu (min_price); min_price: optional; min: 0; max: 21474836470
max_priceintegerGiá tối đa (max_price); max_price: optional; min: 1; max: 21474836471
ratingintegerSố sao, phân cách bằng dấu phẩy; 7 → 3.5+, 8 → 4.0+, 9 → 4.5+; rating: optional; 7, 8, 97
hotel_classstringBộ lọc chỗ ở (hotel_class); hotel_class: optional; UTF-8 bytes: 7-
amenitiesstringBộ lọc chỗ ở (amenities); amenities: optional; UTF-8 bytes: 300; ^[1-9][0-9]*(?:,[1-9][0-9]*)*$-
free_cancellationbooleanBộ lọc chỗ ở (free_cancellation); free_cancellation: optionaltrue
special_offersbooleanBộ lọc chỗ ở (special_offers); special_offers: optionaltrue
eco_certifiedbooleanBộ lọc chỗ ở (eco_certified); eco_certified: optionaltrue
property_typesstringBộ lọc chỗ ở (property_types); property_types: optional; UTF-8 bytes: 100; ^[1-9][0-9]*(?:,[1-9][0-9]*)*$-
brandsstringBộ lọc chỗ ở (brands); brands: optional; UTF-8 bytes: 300; ^[1-9][0-9]{0,5}(?:,[1-9][0-9]{0,5})*$-
vacation_rentalsbooleanBộ lọc chỗ ở (vacation_rentals); vacation_rentals: optionaltrue
bedroomsintegerSố phòng ngủ hoặc giường tối thiểu (bedrooms); bedrooms: optional; min: 0; max: 21474836470
bathroomsintegerSố phòng tắm tối thiểu (bathrooms); bathrooms: optional; min: 0; max: 21474836470
property_tokenstringMã lựa chọn từ phản hồi mới nhất (property_token); property_token: optional; UTF-8 bytes: 256; ^[A-Za-z0-9_-]{16,256}$-

Kiểm tra

Chỉ nhận tham số truy vấn, không có phần thân. Từ chối giá trị lạ, trùng lặp, trống hoặc không hợp lệ. Chỉ hỗ trợ JSON; không tự phân trang hay thử lại. Quy tắc: AND = cả hai, OR = hoặc, XOR = đúng một, NOT = loại trừ, => = yêu cầu.

  • GET query only; body = null; response = JSON; html, output, json_restrictor, no_cache: NOT supported
  • string: UTF-8 bytes <= maxLength (default 8192); boolean = true OR false; integer: safe integer
  • language: /^[A-Za-z]{2,3}(?:[-_][A-Za-z]{2,4})?$/
  • min_price <= max_price
  • check_in_date AND check_out_date: supply both or neither; valid YYYY-MM-DD dates; check_out_date > check_in_date
  • query OR property_token OR next_page_token: required
  • adults (default 2) + children <= 100; children_ages: comma-separated ages 0..17; count = children
  • bedrooms OR bathrooms => vacation_rentals = true; vacation_rentals = true => NOT brands
  • Tokens: copy the exact token from a fresh response; do not invent or reuse expired tokens; each page or token lookup is a separate billable successful request

Ví dụ

bash
curl --get "https://api.apihop.ai/v1/google-hotels/search" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-urlencode "currency=USD" \
  --data-urlencode "query=hotels in New York"

Google Hotels: Lấy gợi ý khách sạn

GET https://api.apihop.ai/v1/google-hotels/autocomplete

Tham số

TrườngKiểuGiới hạnVí dụ
querystringTừ khóa tìm kiếm; query: REQUIREDNew York
countrystringMã quốc gia hoặc cửa hàng (country); country: optional; ^[A-Za-z]{2}$-
languagestringNgôn ngữ; language: optional-
limitintegerGiới hạn kết quả; limit: optional; min: 1; max: 1001
devicestringThiết bị; device: optional; desktop, mobile, tabletdesktop
zero_tracebooleanKhông lưu trữ phản hồi; zero_trace: optionaltrue
currencystringMã tiền tệ (currency); currency: optional; ALL, DZD, ARS, AMD, AWG, AUD, AZN, BSD, BHD, BYN, BMD, BAM, BRL, GBP, BGN, XPF, CAD, CLP, CNY, COP, CRC, CUP, CZK, DKK, DOP, EGP, EUR, GEL, HKD, HUF, ISK, INR, IDR, IRR, ILS, JMD, JPY, JOD, KZT, KWD, LBP, MKD, MYR, MXN, MDL, MAD, TWD, NZD, NOK, OMR, PKR, PAB, PEN, PHP, PLN, QAR, RON, RUB, SAR, RSD, SGD, ZAR, KRW, SEK, CHF, THB, TRY, USD, UAH, AED, VND; ^[A-Z]{3}$ALL

Kiểm tra

Chỉ nhận tham số truy vấn, không có phần thân. Từ chối giá trị lạ, trùng lặp, trống hoặc không hợp lệ. Chỉ hỗ trợ JSON; không tự phân trang hay thử lại. Quy tắc: AND = cả hai, OR = hoặc, XOR = đúng một, NOT = loại trừ, => = yêu cầu.

  • GET query only; body = null; response = JSON; html, output, json_restrictor, no_cache: NOT supported
  • string: UTF-8 bytes <= maxLength (default 8192); boolean = true OR false; integer: safe integer
  • language: /^[A-Za-z]{2,3}(?:[-_][A-Za-z]{2,4})?$/

Ví dụ

bash
curl --get "https://api.apihop.ai/v1/google-hotels/autocomplete" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-urlencode "query=New York"

Google Hotels: Lấy ảnh khách sạn

GET https://api.apihop.ai/v1/google-hotels/photos

Tham số

TrườngKiểuGiới hạnVí dụ
idstringMã khách sạn từ kết quả tìm kiếm (id); id: REQUIREDChgI-N6n0Nnyw_K2ARoLL2cvMXRqZGgzMjkQAQ
countrystringMã quốc gia hoặc cửa hàng (country); country: optional; ^[A-Za-z]{2}$-
languagestringNgôn ngữ; language: optional-
limitintegerGiới hạn kết quả; limit: optional; min: 1; max: 1001
devicestringThiết bị; device: optional; desktop, mobile, tabletdesktop
zero_tracebooleanKhông lưu trữ phản hồi; zero_trace: optionaltrue
next_page_tokenstringMã trang tiếp theo; next_page_token: optional; UTF-8 bytes: 24576-

Kiểm tra

Chỉ nhận tham số truy vấn, không có phần thân. Từ chối giá trị lạ, trùng lặp, trống hoặc không hợp lệ. Chỉ hỗ trợ JSON; không tự phân trang hay thử lại. Quy tắc: AND = cả hai, OR = hoặc, XOR = đúng một, NOT = loại trừ, => = yêu cầu.

  • GET query only; body = null; response = JSON; html, output, json_restrictor, no_cache: NOT supported
  • string: UTF-8 bytes <= maxLength (default 8192); boolean = true OR false; integer: safe integer
  • language: /^[A-Za-z]{2,3}(?:[-_][A-Za-z]{2,4})?$/
  • Tokens: copy the exact token from a fresh response; do not invent or reuse expired tokens; each page or token lookup is a separate billable successful request

Ví dụ

bash
curl --get "https://api.apihop.ai/v1/google-hotels/photos" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-urlencode "id=ChgI-N6n0Nnyw_K2ARoLL2cvMXRqZGgzMjkQAQ"

Google Hotels: Lấy đánh giá khách sạn

GET https://api.apihop.ai/v1/google-hotels/reviews

Tham số

TrườngKiểuGiới hạnVí dụ
idstringMã khách sạn từ kết quả tìm kiếm (id); id: REQUIREDChgI-N6n0Nnyw_K2ARoLL2cvMXRqZGgzMjkQAQ
next_page_tokenstringMã trang tiếp theo; next_page_token: optional; UTF-8 bytes: 24576-
sort_bystringSắp xếp; sort_by: optional; relevance, newest, highest_rating, lowest_ratingrelevance
countrystringMã quốc gia hoặc cửa hàng (country); country: optional; ^[A-Za-z]{2}$-
languagestringNgôn ngữ; language: optional-
limitintegerGiới hạn kết quả; limit: optional; min: 1; max: 1010
devicestringThiết bị; device: optional; desktop, mobile, tabletdesktop
zero_tracebooleanKhông lưu trữ phản hồi; zero_trace: optionaltrue
category_tokenstringMã lựa chọn từ phản hồi mới nhất (category_token); category_token: optional; UTF-8 bytes: 2800; ^[A-Za-z0-9_-]+$-
source_numberintegerBộ lọc chỗ ở (source_number); source_number: optional; min: -1; max: 2147483647-1

Kiểm tra

Chỉ nhận tham số truy vấn, không có phần thân. Từ chối giá trị lạ, trùng lặp, trống hoặc không hợp lệ. Chỉ hỗ trợ JSON; không tự phân trang hay thử lại. Quy tắc: AND = cả hai, OR = hoặc, XOR = đúng một, NOT = loại trừ, => = yêu cầu.

  • GET query only; body = null; response = JSON; html, output, json_restrictor, no_cache: NOT supported
  • string: UTF-8 bytes <= maxLength (default 8192); boolean = true OR false; integer: safe integer
  • language: /^[A-Za-z]{2,3}(?:[-_][A-Za-z]{2,4})?$/
  • Tokens: copy the exact token from a fresh response; do not invent or reuse expired tokens; each page or token lookup is a separate billable successful request

Ví dụ

bash
curl --get "https://api.apihop.ai/v1/google-hotels/reviews" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-urlencode "id=ChgI-N6n0Nnyw_K2ARoLL2cvMXRqZGgzMjkQAQ" \
  --data-urlencode "limit=10"

Phản hồi và lỗi

Giữ JSON gốc và độ chính xác. Ví dụ kết quả rỗng thành công. HTTP 400: đầu vào; 401: xác thực; 402: số dư; 403: quyền; 405: phương thức; 429: giới hạn; 5xx: dịch vụ. Giữ X-Request-Id.

json
{
  "success": true,
  "request_id": "example-request",
  "data": {
    "format": "json",
    "content": {
      "results": []
    }
  }
}