GET/v1/trains/order/:gdsprovider/:orderId

获取火车订单和票据

获取当前订单状态和票据资源。

分享

获取当前订单状态和票据资源。

认证和请求头

请求头说明
AuthorizationBearer <secret_key>。密钥只能保存在服务器端,不能写入客户端日志。
X-Travelandz-Id<public_key>:<profile_code>,持久化的 profile code 格式为 dp_<12 位字母数字>
Content-Type带 JSON body 的请求使用 application/json

请求

Path 参数:gdsprovider 当前为 0orderId 来自订单创建。

请求参数结构

gdsprovider
enum
0
Currently 0
orderId
string
Order id returned by order creation.

成功响应

返回 order,包含状态、reference 和 itineraryItems[].tickets[]。票据类型包括 pdf_ticketcheck_in_resourceticket_on_departure;票据字段可能为 null。

响应体结构

order
object
ordergdsprovider
number
orderid
string
orderstatus
enum
pendingconfirmedcancelled
orderreference
string
orderitineraryItems
array
orderitineraryItems[]itineraryIndex
number
orderitineraryItems[]tickets
array
orderitineraryItems[]tickets[]type
enum
pdf_ticketcheck_in_resourceticket_on_departure
orderitineraryItems[]tickets[]url
string可为空
orderitineraryItems[]tickets[]reference
string可为空
orderitineraryItems[]tickets[]description
string可为空

错误

  • 400 表示验证失败或存在未知字段。
  • 401403 表示 API 凭证无效。
  • 供应方失败时返回 500 internal_communication_errorunknown_error
  • 订单不存在时返回 order_not_found

使用说明

票据 URL 可能是供应方资源。urlreferencedescription 为 null 是正常情况。

cURL 示例

bash
bash
curl --request GET \
  --url "https://api.sandbox.travelandz.com/v1/trains/order/0/order_123" \
  --header "Authorization: Bearer $TRAVELANDZ_SECRET_KEY" \
  --header "X-Travelandz-Id: $TRAVELANDZ_PUBLIC_KEY:$TRAVELANDZ_PROFILE_CODE"