跳到主要内容

内容

Cities usable as a hotel search destination, optionally filtered by term or country.

get/v1/content/cities

  • 需要身份验证

参数

名称位置类型说明
q查询string
country查询string
page查询integer (int32)
pageSize查询integer (int32)

响应

200OKCityItemPagedList

  • CityItem[]
    • codestring
    • namestring可为 null
    • countryCodestring可为 null
    • countryNamestring可为 null
  • pageinteger (int32)
  • pageSizeinteger (int32)
  • totalinteger (int32)

代码示例

完整的程序,按网关的验证方式对请求进行签名。请替换 YOUR_KEY_ID 和 YOUR_SECRET。

# Sign the request: METHOD \n path+query \n unix time \n nonce \n sha256(body)
KEY_ID="YOUR_KEY_ID"
SECRET="YOUR_SECRET"
BODY=''
TS=$(date +%s)
NONCE=$(openssl rand -hex 16)
BODY_HASH=$(printf '%s' "$BODY" | openssl dgst -sha256 | sed 's/^.* //')
CANON=$(printf 'GET\n/v1/content/cities\n%s\n%s\n%s' "$TS" "$NONCE" "$BODY_HASH")
SIG=$(printf '%s' "$CANON" | openssl dgst -sha256 -hmac "$SECRET" | sed 's/^.* //')

curl -X GET "https://api.dubaitrip.com/v1/content/cities" \
  -H "X-API-Key: $KEY_ID" \
  -H "X-Timestamp: $TS" \
  -H "X-Nonce: $NONCE" \
  -H "X-Signature: $SIG" \
  -H "Accept: application/json"