@mongoui/skills 0.1.8 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/products/index.js +6 -5
- package/package.json +26 -26
- package/skills/flink-flight-api/SKILL.md +63 -63
- package/skills/flink-flight-api/agents/openai.yaml +4 -4
- package/skills/flink-flight-api/references/api-workflows.md +104 -104
- package/skills/flink-flight-api/references/auth-and-credentials.md +136 -136
- package/skills/flink-flight-api/references/endpoint-index.md +92 -92
- package/skills/flink-flight-api/scripts/flink_signed_request.py +188 -188
- package/skills/glink-hotel-api/SKILL.md +153 -152
- package/skills/glink-hotel-api/agents/openai.yaml +4 -4
- package/skills/glink-hotel-api/references/api-workflows.md +168 -158
- package/skills/glink-hotel-api/references/auth-and-credentials.md +144 -144
- package/skills/glink-hotel-api/references/endpoint-index.md +148 -129
- package/skills/glink-hotel-api/references/field-and-enum-notes.md +161 -0
- package/skills/glink-hotel-api/scripts/glink_signed_request.py +199 -199
- package/skills/tmc-api/SKILL.md +63 -0
- package/skills/tmc-api/agents/openai.yaml +4 -0
- package/skills/tmc-api/references/api-workflows.md +365 -0
- package/skills/tmc-api/references/auth-and-calling.md +47 -0
- package/skills/tmc-api/references/endpoint-details.md +25964 -0
- package/skills/tmc-api/references/endpoint-index.md +116 -0
- package/skills/tmc-api/scripts/tmc_signed_request.py +199 -0
- package/skills/tmc-whitelabel/SKILL.md +0 -8
|
@@ -1,158 +1,168 @@
|
|
|
1
|
-
# Glink API Workflows
|
|
2
|
-
|
|
3
|
-
Source of truth:
|
|
4
|
-
|
|
5
|
-
- Current Open Platform route and payload source: `docs/swagger/glink-api.json`.
|
|
6
|
-
- Customer-facing explanations should use only our short interface paths, such as `/search/destination`, `/booking/createOrder`, and `/order/orderDetail`.
|
|
7
|
-
|
|
8
|
-
## Standard API Integration
|
|
9
|
-
|
|
10
|
-
Use this mode when the integrator will maintain a local saleable hotel catalog, hotel-room mapping, and daily price refresh jobs.
|
|
11
|
-
|
|
12
|
-
Mandatory interfaces:
|
|
13
|
-
|
|
14
|
-
| No. | Interface | Method | Path |
|
|
15
|
-
| --- | --- | --- | --- |
|
|
16
|
-
| 1 | Available Hotel ID List | POST | `/search/hotelIdList` |
|
|
17
|
-
| 2 | Query Hotel Basic Information | POST | `/hotel/detail` |
|
|
18
|
-
| 3 | Hotel Real-Time Product Query | POST | `/booking/productDetails` |
|
|
19
|
-
| 4 | Trial Booking / Availability Check | POST | `/booking/availabilityCheck` |
|
|
20
|
-
| 5 | Create Order | POST | `/booking/createOrder` |
|
|
21
|
-
| 6 | Order Payment | POST | `/booking/payOrder` |
|
|
22
|
-
| 7 | Cancel Order | POST | `/order/cancelOrder` |
|
|
23
|
-
| 8 | Order Detail Query | POST | `/order/orderDetail` |
|
|
24
|
-
|
|
25
|
-
## Static Data
|
|
26
|
-
|
|
27
|
-
Use these calls to build hotel search prerequisites:
|
|
28
|
-
|
|
29
|
-
- `/region/countries`
|
|
30
|
-
- `/region/cities`
|
|
31
|
-
- `/region/popularCities`
|
|
32
|
-
- `/region/districts`
|
|
33
|
-
- `/region/pois`
|
|
34
|
-
- `/region/businesses`
|
|
35
|
-
- `/hotel/groupBrand`
|
|
36
|
-
|
|
37
|
-
These APIs usually feed country/city selection, district filters, POI filters, business area filters, and brand filters.
|
|
38
|
-
|
|
39
|
-
For Standard API Integration, build local hotel and room mapping in this order:
|
|
40
|
-
|
|
41
|
-
1. `/search/hotelIdList`
|
|
42
|
-
- Fetch the account's saleable hotel ID list and cache it locally.
|
|
43
|
-
|
|
44
|
-
-
|
|
45
|
-
|
|
46
|
-
-
|
|
47
|
-
|
|
48
|
-
-
|
|
49
|
-
|
|
50
|
-
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
|
63
|
-
|
|
|
64
|
-
|
|
|
65
|
-
|
|
|
66
|
-
|
|
|
67
|
-
|
|
|
68
|
-
|
|
|
69
|
-
|
|
|
70
|
-
|
|
|
71
|
-
|
|
|
72
|
-
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
-
|
|
88
|
-
|
|
89
|
-
-
|
|
90
|
-
|
|
91
|
-
-
|
|
92
|
-
|
|
93
|
-
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
-
|
|
98
|
-
|
|
99
|
-
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
-
|
|
113
|
-
|
|
114
|
-
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
- `/order/
|
|
138
|
-
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
-
|
|
145
|
-
|
|
146
|
-
-
|
|
147
|
-
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
-
|
|
154
|
-
-
|
|
155
|
-
-
|
|
156
|
-
-
|
|
157
|
-
-
|
|
158
|
-
-
|
|
1
|
+
# Glink API Workflows
|
|
2
|
+
|
|
3
|
+
Source of truth:
|
|
4
|
+
|
|
5
|
+
- Current Open Platform route and payload source: `docs/swagger/glink-api.json`.
|
|
6
|
+
- Customer-facing explanations should use only our short interface paths, such as `/search/destination`, `/booking/createOrder`, and `/order/orderDetail`.
|
|
7
|
+
|
|
8
|
+
## Standard API Integration
|
|
9
|
+
|
|
10
|
+
Use this mode when the integrator will maintain a local saleable hotel catalog, hotel-room mapping, and daily price refresh jobs.
|
|
11
|
+
|
|
12
|
+
Mandatory interfaces:
|
|
13
|
+
|
|
14
|
+
| No. | Interface | Method | Path |
|
|
15
|
+
| --- | --- | --- | --- |
|
|
16
|
+
| 1 | Available Hotel ID List | POST | `/search/hotelIdList` |
|
|
17
|
+
| 2 | Query Hotel Basic Information | POST | `/hotel/detail` |
|
|
18
|
+
| 3 | Hotel Real-Time Product Query | POST | `/booking/productDetails` |
|
|
19
|
+
| 4 | Trial Booking / Availability Check | POST | `/booking/availabilityCheck` |
|
|
20
|
+
| 5 | Create Order | POST | `/booking/createOrder` |
|
|
21
|
+
| 6 | Order Payment | POST | `/booking/payOrder` |
|
|
22
|
+
| 7 | Cancel Order | POST | `/order/cancelOrder` |
|
|
23
|
+
| 8 | Order Detail Query | POST | `/order/orderDetail` |
|
|
24
|
+
|
|
25
|
+
## Static Data
|
|
26
|
+
|
|
27
|
+
Use these calls to build hotel search prerequisites:
|
|
28
|
+
|
|
29
|
+
- `/region/countries`
|
|
30
|
+
- `/region/cities`
|
|
31
|
+
- `/region/popularCities`
|
|
32
|
+
- `/region/districts`
|
|
33
|
+
- `/region/pois`
|
|
34
|
+
- `/region/businesses`
|
|
35
|
+
- `/hotel/groupBrand`
|
|
36
|
+
|
|
37
|
+
These APIs usually feed country/city selection, district filters, POI filters, business area filters, and brand filters.
|
|
38
|
+
|
|
39
|
+
For Standard API Integration, build local hotel and room mapping in this order:
|
|
40
|
+
|
|
41
|
+
1. `/search/hotelIdList`
|
|
42
|
+
- Fetch the account's saleable hotel ID list and cache it locally.
|
|
43
|
+
- Use `pageNo` and `pageSize` for pagination; current examples default to `pageNo=1` and `pageSize=1000`.
|
|
44
|
+
- Read `totalCount` for the total count when returned.
|
|
45
|
+
2. `/hotel/detail`
|
|
46
|
+
- Fetch hotel and room static data for the cached hotel IDs. Persist only the fields needed for local hotel and room mapping.
|
|
47
|
+
- Current static fields use `facility`, `popularFacility`, `roomInfos`, `latBaidu`, `lngBaidu`, `groupName`, and `brandName`.
|
|
48
|
+
- Room bed structures expose object `bedInfos[]` for both bedroom and living room beds.
|
|
49
|
+
3. `/hotel/increment`
|
|
50
|
+
- Periodically fetch changed hotel IDs, including added, updated, or deleted hotels.
|
|
51
|
+
4. `/hotel/detail`
|
|
52
|
+
- Rehydrate changed hotel IDs and decide whether local mappings should be updated or disconnected.
|
|
53
|
+
5. `/hotel/lowestPrice`
|
|
54
|
+
- Refresh mapped-hotel starting prices daily, normally after 05:00.
|
|
55
|
+
|
|
56
|
+
## Lightweight Integration Flow
|
|
57
|
+
|
|
58
|
+
Use this mode when the user wants a faster launch with less up-front static sync and a destination-driven hotel discovery path.
|
|
59
|
+
|
|
60
|
+
Mandatory interfaces:
|
|
61
|
+
|
|
62
|
+
| No. | Interface | Method | Path |
|
|
63
|
+
| --- | --- | --- | --- |
|
|
64
|
+
| 1 | Destination Query | POST | `/search/destination` |
|
|
65
|
+
| 2 | Get Hotel Filter Conditions | POST | `/search/hotelFilters` |
|
|
66
|
+
| 3 | Query Hotel List by Destination | POST | `/search/hotelList` |
|
|
67
|
+
| 4 | Query Hotel Basic Information | POST | `/hotel/detail` |
|
|
68
|
+
| 5 | Query Hotel Basic Information Increment | POST | `/hotel/increment` |
|
|
69
|
+
| 6 | Query Hotel Images | POST | `/hotel/images` |
|
|
70
|
+
| 7 | Hotel Real-Time Product Query | POST | `/booking/productDetails` |
|
|
71
|
+
| 8 | Trial Booking / Availability Check | POST | `/booking/availabilityCheck` |
|
|
72
|
+
| 9 | Create Order | POST | `/booking/createOrder` |
|
|
73
|
+
| 10 | Order Payment | POST | `/booking/payOrder` |
|
|
74
|
+
| 11 | Cancel Order | POST | `/order/cancelOrder` |
|
|
75
|
+
| 12 | Order Detail Query | POST | `/order/orderDetail` |
|
|
76
|
+
| 13 | Order Status Push | POST | `/notify/orderStatus` |
|
|
77
|
+
|
|
78
|
+
Recommended sequence:
|
|
79
|
+
|
|
80
|
+
1. `/search/destination`
|
|
81
|
+
- Resolve the destination keyword into an Open Platform destination ID.
|
|
82
|
+
- The response `data` is an array of flat destination objects. Use `destinationType` and `source` to decide whether the match is a hotel, city, district, business area, Google/Baidu result, or another type.
|
|
83
|
+
2. `/search/hotelFilters`
|
|
84
|
+
- Fetch filter conditions when the UI needs hotel filters.
|
|
85
|
+
3. `/search/hotelList`
|
|
86
|
+
- Search destination-based hotel results using the destination ID, stay dates, and optional filters.
|
|
87
|
+
- List items use `latBaidu` and `lngBaidu`; `groupName` and `brandName` can be displayed when present.
|
|
88
|
+
4. `/hotel/detail` and optionally `/hotel/images`
|
|
89
|
+
- Read richer hotel details and media for client display after the hotel list returns candidates.
|
|
90
|
+
5. `/hotel/lowestPrice`
|
|
91
|
+
- Optional but useful for list-page price reference when the experience needs a stable starting-price display.
|
|
92
|
+
6. `/booking/productDetails`
|
|
93
|
+
- Query real-time sellable products for a selected hotel on the hotel detail or booking path.
|
|
94
|
+
7. `/booking/availabilityCheck`
|
|
95
|
+
- Run trial booking with the actual room count before final booking.
|
|
96
|
+
8. `/booking/createOrder`
|
|
97
|
+
- Create the order after trial booking succeeds. If the booking step is delayed, run `/booking/availabilityCheck` again first.
|
|
98
|
+
9. `/booking/payOrder`
|
|
99
|
+
- Notify payment status after local payment succeeds or when the platform decides the order should be confirmed.
|
|
100
|
+
|
|
101
|
+
Lightweight mode still benefits from small local caches:
|
|
102
|
+
|
|
103
|
+
- Cache destination lookup results from `/search/destination` when the same searches are repeated often.
|
|
104
|
+
- Keep the current hotel IDs from `/search/hotelList` or prior detail-page flows long enough to avoid wasteful duplicate quote traffic.
|
|
105
|
+
- Treat order push/callback as primary even in lightweight mode.
|
|
106
|
+
|
|
107
|
+
## Booking Flow
|
|
108
|
+
|
|
109
|
+
Use this sequence for both Standard API Integration and Lightweight Integration Flow:
|
|
110
|
+
|
|
111
|
+
1. `/booking/productDetails`
|
|
112
|
+
- Identify the exact sellable room and rate.
|
|
113
|
+
2. `/booking/availabilityCheck`
|
|
114
|
+
- Perform pre-booking validation with the actual room count. Use this before showing or entering the final order submission path.
|
|
115
|
+
- Use response-level `breakfastNum` and `breakfastType`. Tax breakdown is under `priceItems[].taxDetail` and `roomTaxDetail`.
|
|
116
|
+
3. `/booking/createOrder`
|
|
117
|
+
- Submit the order with guest, contact, amount, and price item details. When the local order has been created and is ready to submit, call `/booking/availabilityCheck` again first if there is any delay or state change risk.
|
|
118
|
+
- Use `guestInfos[].guestType` for the guest type dictionary. Do not send the old nested `guestInfos[].nationality` field.
|
|
119
|
+
4. `/booking/payOrder`
|
|
120
|
+
- Notify payment after local customer payment succeeds, or after the platform has decided the order should be confirmed.
|
|
121
|
+
5. `/notify/orderStatus`
|
|
122
|
+
- Treat the push/callback as the primary confirmation result channel. The receiver must be idempotent.
|
|
123
|
+
6. `/order/orderDetail`
|
|
124
|
+
- Use as low-frequency compensation only before final confirmation or cancellation. Do not keep polling confirmed or canceled orders.
|
|
125
|
+
|
|
126
|
+
Key order identifiers:
|
|
127
|
+
|
|
128
|
+
- `coOrderCode`: customer platform order number.
|
|
129
|
+
- `fcOrderCode`: FCG order number when available.
|
|
130
|
+
|
|
131
|
+
Prefer carrying both once they appear, because several aftercare APIs accept one or both.
|
|
132
|
+
|
|
133
|
+
## Order Aftercare
|
|
134
|
+
|
|
135
|
+
Use these calls after booking:
|
|
136
|
+
|
|
137
|
+
- `/order/cancelOrder`
|
|
138
|
+
- Cancel an order when policy permits, when the customer asks to cancel, or when the local unpaid timeout is reached, such as 30 minutes. Send `cancelReason` when there is a customer or platform reason to record. If cancellation returns success, update the local order and do not continue polling for another push.
|
|
139
|
+
- `/notify/orderStatus`
|
|
140
|
+
- Required for order confirmation progress after `/booking/payOrder`; implement idempotency.
|
|
141
|
+
- `/order/checkInDetail`
|
|
142
|
+
- Read extended order or check-in related detail.
|
|
143
|
+
- `/order/checkoutRequest`
|
|
144
|
+
- Submit a checkout or refund-like aftercare request for an order.
|
|
145
|
+
- `/order/checkoutDetail`
|
|
146
|
+
- Query the checkout task by `taskOrderCode`.
|
|
147
|
+
- Use `paymentType` to distinguish prepaid and pay-at-hotel orders. Read `refundDetailList[]` for refund channel/time/amount/bill data and `checkoutDetailPriceItemList[].originalSalePrice` for original daily sale price.
|
|
148
|
+
|
|
149
|
+
## Finance
|
|
150
|
+
|
|
151
|
+
Use these calls for financial follow-up:
|
|
152
|
+
|
|
153
|
+
- `/order/invoiceRequest`
|
|
154
|
+
- Submit invoice information using business fields only.
|
|
155
|
+
- `/order/invoiceInfo`
|
|
156
|
+
- Query invoice status and invoice metadata after an invoice request.
|
|
157
|
+
- `/search/creditBalance`
|
|
158
|
+
- Read remaining credit balance.
|
|
159
|
+
|
|
160
|
+
## Business Handling Rules
|
|
161
|
+
|
|
162
|
+
- Do not treat HTTP `200` as enough; inspect `code`.
|
|
163
|
+
- Use only our short interface paths in customer-facing docs and workflows.
|
|
164
|
+
- Preserve FCG order identifiers from earlier responses instead of recomputing them.
|
|
165
|
+
- In `/order/orderDetail`, use `roomGuestNumbers[]` for room-level adult and child counts. Use `originalAmount` for order original amount, and top-level `nationality` as country or region code.
|
|
166
|
+
- Keep local saleable hotel ID cache and hotel/room mappings current before pricing and booking.
|
|
167
|
+
- Avoid integration quota waste: skip `/booking/productDetails` for hotels not in the saleable hotel cache.
|
|
168
|
+
- Push/callback is primary for order confirmation; `/order/orderDetail` is only a compensation path and should not be frequent.
|
|
@@ -1,144 +1,144 @@
|
|
|
1
|
-
# Glink Auth And Credentials
|
|
2
|
-
|
|
3
|
-
## Required Headers
|
|
4
|
-
|
|
5
|
-
Send these headers on every Glink open-platform request:
|
|
6
|
-
|
|
7
|
-
- `X-OP-App-Key`
|
|
8
|
-
- `X-OP-Timestamp`
|
|
9
|
-
- `X-OP-Nonce`
|
|
10
|
-
- `X-OP-Sign`
|
|
11
|
-
|
|
12
|
-
Optional headers that can help tracing or idempotency:
|
|
13
|
-
|
|
14
|
-
- `X-OP-Client-Request-Id`
|
|
15
|
-
- `X-Trace-Id`
|
|
16
|
-
- `X-Idempotency-Key`
|
|
17
|
-
|
|
18
|
-
`X-OP-App-Key` is the issued `open_app_id`.
|
|
19
|
-
|
|
20
|
-
## Signature Algorithm
|
|
21
|
-
|
|
22
|
-
Build the canonical string in this exact order, separated by newline characters:
|
|
23
|
-
|
|
24
|
-
```text
|
|
25
|
-
METHOD
|
|
26
|
-
PATH
|
|
27
|
-
CANONICAL_QUERY
|
|
28
|
-
BODY_SHA256
|
|
29
|
-
TIMESTAMP
|
|
30
|
-
NONCE
|
|
31
|
-
APP_KEY
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
Rules:
|
|
35
|
-
|
|
36
|
-
- Uppercase `METHOD`.
|
|
37
|
-
- Use the exact runtime public request path. Customer-facing docs use short paths like `/region/businesses`; for actual signing, prefix with `/openapi/v1/glink`, for example `/openapi/v1/glink/region/businesses`.
|
|
38
|
-
- Sort query parameters by key and then value before joining them as `k=v&k2=v2`.
|
|
39
|
-
- Hash the raw request body bytes with SHA256 and use the lowercase hex digest.
|
|
40
|
-
- Use the request timestamp exactly as sent in `X-OP-Timestamp`.
|
|
41
|
-
- Use the request nonce exactly as sent in `X-OP-Nonce`.
|
|
42
|
-
- Use the same `open_app_id` that is sent in `X-OP-App-Key`.
|
|
43
|
-
- Sign the canonical string with the plain `open_app_secret` using HMAC-SHA256, then output lowercase hex.
|
|
44
|
-
|
|
45
|
-
Notes:
|
|
46
|
-
|
|
47
|
-
- Timestamp may be Unix seconds, Unix milliseconds, or RFC3339.
|
|
48
|
-
- The platform validates timestamp drift within roughly `+-5` minutes.
|
|
49
|
-
- Nonce must be unique for the same app key in a short time window.
|
|
50
|
-
- For empty bodies, hash the empty byte string.
|
|
51
|
-
|
|
52
|
-
## Request Body Rules
|
|
53
|
-
|
|
54
|
-
Client responsibilities:
|
|
55
|
-
|
|
56
|
-
- Send only the business fields shown by our Open Platform swagger.
|
|
57
|
-
- Sign the runtime public request path, not only the short interface path.
|
|
58
|
-
- Do not add wrapper objects or hidden integration fields that are not part of our public schema.
|
|
59
|
-
|
|
60
|
-
If a legacy schema still exposes an internal managed field, prefer the route description and current swagger examples. Do not ask the customer to send fields that are not part of the Open Platform public contract.
|
|
61
|
-
|
|
62
|
-
## Credential Acquisition
|
|
63
|
-
|
|
64
|
-
Treat credentials as environment-specific.
|
|
65
|
-
|
|
66
|
-
Sandbox:
|
|
67
|
-
|
|
68
|
-
1. The developer applies for app access.
|
|
69
|
-
2. The operator activates the app access with `env_type=sandbox`.
|
|
70
|
-
3. The platform records sandbox Glink mapping and issues a sandbox `open_app_id/open_app_secret`.
|
|
71
|
-
4. The app access becomes `sandbox_active`.
|
|
72
|
-
|
|
73
|
-
Production:
|
|
74
|
-
|
|
75
|
-
1. The developer submits production access after sandbox work is complete.
|
|
76
|
-
2. The operator approves production with `env_type=production`.
|
|
77
|
-
3. The platform issues a production `open_app_id/open_app_secret`.
|
|
78
|
-
4. The production credential becomes usable only after the app access reaches `production_active`.
|
|
79
|
-
|
|
80
|
-
Important constraints:
|
|
81
|
-
|
|
82
|
-
- Sandbox and production credentials are separate and not interchangeable.
|
|
83
|
-
- Developers can see platform credentials only.
|
|
84
|
-
- Developers cannot see internal integration secrets.
|
|
85
|
-
|
|
86
|
-
## How To View Or Reset Keys
|
|
87
|
-
|
|
88
|
-
Developer portal APIs:
|
|
89
|
-
|
|
90
|
-
- `GET /api/portal/apps/{app_id}/credentials`
|
|
91
|
-
- Returns the credential list for the app.
|
|
92
|
-
- Includes `open_app_id`, `provider_code`, `env_type`, `open_secret_version`, and masked secret data.
|
|
93
|
-
- Does not return the plain secret in normal list queries.
|
|
94
|
-
- `POST /api/portal/apps/{app_id}/credentials/reset`
|
|
95
|
-
- Resets the platform secret and returns `plain_open_secret`.
|
|
96
|
-
- If the app has more than one credential mapping, pass both `provider_code` and `env_type`.
|
|
97
|
-
|
|
98
|
-
Response fields that matter:
|
|
99
|
-
|
|
100
|
-
- `open_app_id`: the App Key to place into `X-OP-App-Key`.
|
|
101
|
-
- `open_secret_masked`: masked secret for display only.
|
|
102
|
-
- `open_secret_version`: useful for rotation tracking.
|
|
103
|
-
- `plain_open_secret`: returned only on first issuance or reset.
|
|
104
|
-
|
|
105
|
-
Practical guidance:
|
|
106
|
-
|
|
107
|
-
- If a developer says "I can only see a masked secret", instruct them to use the reset endpoint or the corresponding portal UI action.
|
|
108
|
-
- If the task is only to call sandbox APIs, do not assume production credentials work.
|
|
109
|
-
- If the app has both sandbox and production mappings, always name the target `env_type` explicitly.
|
|
110
|
-
|
|
111
|
-
## Common Auth Failures
|
|
112
|
-
|
|
113
|
-
- `APP_KEY_INVALID`
|
|
114
|
-
- Wrong `open_app_id`, wrong environment, or the credential does not exist.
|
|
115
|
-
- `SIGN_ERROR`
|
|
116
|
-
- Wrong secret, wrong path, wrong query ordering, wrong body hash, or newline formatting mismatch.
|
|
117
|
-
- `TIMESTAMP_EXPIRED`
|
|
118
|
-
- Clock skew exceeds the allowed window.
|
|
119
|
-
- `NONCE_REPLAY`
|
|
120
|
-
- Nonce was reused under the same app key.
|
|
121
|
-
- `PRODUCT_FORBIDDEN`
|
|
122
|
-
- The app is not enabled for the product, the mapping is not active, or an IP whitelist rule failed.
|
|
123
|
-
|
|
124
|
-
## Response Contract
|
|
125
|
-
|
|
126
|
-
The platform wraps business responses in a common envelope:
|
|
127
|
-
|
|
128
|
-
```json
|
|
129
|
-
{
|
|
130
|
-
"request_id": "req_xxx",
|
|
131
|
-
"trace_id": "trc_xxx",
|
|
132
|
-
"downstream_request_id": "dreq_xxx",
|
|
133
|
-
"code": "SUCCESS",
|
|
134
|
-
"message": "ok",
|
|
135
|
-
"data": {}
|
|
136
|
-
}
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
Interpretation:
|
|
140
|
-
|
|
141
|
-
- `request_id` and `trace_id` are platform-side tracing keys.
|
|
142
|
-
- `downstream_request_id` is a platform response field used for cross-system tracing when available.
|
|
143
|
-
- `code=SUCCESS` means the business call succeeded.
|
|
144
|
-
- `code=SUPPLIER_BIZ_ERROR` means the business call failed after reaching the hotel integration and can still arrive with HTTP `200`.
|
|
1
|
+
# Glink Auth And Credentials
|
|
2
|
+
|
|
3
|
+
## Required Headers
|
|
4
|
+
|
|
5
|
+
Send these headers on every Glink open-platform request:
|
|
6
|
+
|
|
7
|
+
- `X-OP-App-Key`
|
|
8
|
+
- `X-OP-Timestamp`
|
|
9
|
+
- `X-OP-Nonce`
|
|
10
|
+
- `X-OP-Sign`
|
|
11
|
+
|
|
12
|
+
Optional headers that can help tracing or idempotency:
|
|
13
|
+
|
|
14
|
+
- `X-OP-Client-Request-Id`
|
|
15
|
+
- `X-Trace-Id`
|
|
16
|
+
- `X-Idempotency-Key`
|
|
17
|
+
|
|
18
|
+
`X-OP-App-Key` is the issued `open_app_id`.
|
|
19
|
+
|
|
20
|
+
## Signature Algorithm
|
|
21
|
+
|
|
22
|
+
Build the canonical string in this exact order, separated by newline characters:
|
|
23
|
+
|
|
24
|
+
```text
|
|
25
|
+
METHOD
|
|
26
|
+
PATH
|
|
27
|
+
CANONICAL_QUERY
|
|
28
|
+
BODY_SHA256
|
|
29
|
+
TIMESTAMP
|
|
30
|
+
NONCE
|
|
31
|
+
APP_KEY
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Rules:
|
|
35
|
+
|
|
36
|
+
- Uppercase `METHOD`.
|
|
37
|
+
- Use the exact runtime public request path. Customer-facing docs use short paths like `/region/businesses`; for actual signing, prefix with `/openapi/v1/glink`, for example `/openapi/v1/glink/region/businesses`.
|
|
38
|
+
- Sort query parameters by key and then value before joining them as `k=v&k2=v2`.
|
|
39
|
+
- Hash the raw request body bytes with SHA256 and use the lowercase hex digest.
|
|
40
|
+
- Use the request timestamp exactly as sent in `X-OP-Timestamp`.
|
|
41
|
+
- Use the request nonce exactly as sent in `X-OP-Nonce`.
|
|
42
|
+
- Use the same `open_app_id` that is sent in `X-OP-App-Key`.
|
|
43
|
+
- Sign the canonical string with the plain `open_app_secret` using HMAC-SHA256, then output lowercase hex.
|
|
44
|
+
|
|
45
|
+
Notes:
|
|
46
|
+
|
|
47
|
+
- Timestamp may be Unix seconds, Unix milliseconds, or RFC3339.
|
|
48
|
+
- The platform validates timestamp drift within roughly `+-5` minutes.
|
|
49
|
+
- Nonce must be unique for the same app key in a short time window.
|
|
50
|
+
- For empty bodies, hash the empty byte string.
|
|
51
|
+
|
|
52
|
+
## Request Body Rules
|
|
53
|
+
|
|
54
|
+
Client responsibilities:
|
|
55
|
+
|
|
56
|
+
- Send only the business fields shown by our Open Platform swagger.
|
|
57
|
+
- Sign the runtime public request path, not only the short interface path.
|
|
58
|
+
- Do not add wrapper objects or hidden integration fields that are not part of our public schema.
|
|
59
|
+
|
|
60
|
+
If a legacy schema still exposes an internal managed field, prefer the route description and current swagger examples. Do not ask the customer to send fields that are not part of the Open Platform public contract.
|
|
61
|
+
|
|
62
|
+
## Credential Acquisition
|
|
63
|
+
|
|
64
|
+
Treat credentials as environment-specific.
|
|
65
|
+
|
|
66
|
+
Sandbox:
|
|
67
|
+
|
|
68
|
+
1. The developer applies for app access.
|
|
69
|
+
2. The operator activates the app access with `env_type=sandbox`.
|
|
70
|
+
3. The platform records sandbox Glink mapping and issues a sandbox `open_app_id/open_app_secret`.
|
|
71
|
+
4. The app access becomes `sandbox_active`.
|
|
72
|
+
|
|
73
|
+
Production:
|
|
74
|
+
|
|
75
|
+
1. The developer submits production access after sandbox work is complete.
|
|
76
|
+
2. The operator approves production with `env_type=production`.
|
|
77
|
+
3. The platform issues a production `open_app_id/open_app_secret`.
|
|
78
|
+
4. The production credential becomes usable only after the app access reaches `production_active`.
|
|
79
|
+
|
|
80
|
+
Important constraints:
|
|
81
|
+
|
|
82
|
+
- Sandbox and production credentials are separate and not interchangeable.
|
|
83
|
+
- Developers can see platform credentials only.
|
|
84
|
+
- Developers cannot see internal integration secrets.
|
|
85
|
+
|
|
86
|
+
## How To View Or Reset Keys
|
|
87
|
+
|
|
88
|
+
Developer portal APIs:
|
|
89
|
+
|
|
90
|
+
- `GET /api/portal/apps/{app_id}/credentials`
|
|
91
|
+
- Returns the credential list for the app.
|
|
92
|
+
- Includes `open_app_id`, `provider_code`, `env_type`, `open_secret_version`, and masked secret data.
|
|
93
|
+
- Does not return the plain secret in normal list queries.
|
|
94
|
+
- `POST /api/portal/apps/{app_id}/credentials/reset`
|
|
95
|
+
- Resets the platform secret and returns `plain_open_secret`.
|
|
96
|
+
- If the app has more than one credential mapping, pass both `provider_code` and `env_type`.
|
|
97
|
+
|
|
98
|
+
Response fields that matter:
|
|
99
|
+
|
|
100
|
+
- `open_app_id`: the App Key to place into `X-OP-App-Key`.
|
|
101
|
+
- `open_secret_masked`: masked secret for display only.
|
|
102
|
+
- `open_secret_version`: useful for rotation tracking.
|
|
103
|
+
- `plain_open_secret`: returned only on first issuance or reset.
|
|
104
|
+
|
|
105
|
+
Practical guidance:
|
|
106
|
+
|
|
107
|
+
- If a developer says "I can only see a masked secret", instruct them to use the reset endpoint or the corresponding portal UI action.
|
|
108
|
+
- If the task is only to call sandbox APIs, do not assume production credentials work.
|
|
109
|
+
- If the app has both sandbox and production mappings, always name the target `env_type` explicitly.
|
|
110
|
+
|
|
111
|
+
## Common Auth Failures
|
|
112
|
+
|
|
113
|
+
- `APP_KEY_INVALID`
|
|
114
|
+
- Wrong `open_app_id`, wrong environment, or the credential does not exist.
|
|
115
|
+
- `SIGN_ERROR`
|
|
116
|
+
- Wrong secret, wrong path, wrong query ordering, wrong body hash, or newline formatting mismatch.
|
|
117
|
+
- `TIMESTAMP_EXPIRED`
|
|
118
|
+
- Clock skew exceeds the allowed window.
|
|
119
|
+
- `NONCE_REPLAY`
|
|
120
|
+
- Nonce was reused under the same app key.
|
|
121
|
+
- `PRODUCT_FORBIDDEN`
|
|
122
|
+
- The app is not enabled for the product, the mapping is not active, or an IP whitelist rule failed.
|
|
123
|
+
|
|
124
|
+
## Response Contract
|
|
125
|
+
|
|
126
|
+
The platform wraps business responses in a common envelope:
|
|
127
|
+
|
|
128
|
+
```json
|
|
129
|
+
{
|
|
130
|
+
"request_id": "req_xxx",
|
|
131
|
+
"trace_id": "trc_xxx",
|
|
132
|
+
"downstream_request_id": "dreq_xxx",
|
|
133
|
+
"code": "SUCCESS",
|
|
134
|
+
"message": "ok",
|
|
135
|
+
"data": {}
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Interpretation:
|
|
140
|
+
|
|
141
|
+
- `request_id` and `trace_id` are platform-side tracing keys.
|
|
142
|
+
- `downstream_request_id` is a platform response field used for cross-system tracing when available.
|
|
143
|
+
- `code=SUCCESS` means the business call succeeded.
|
|
144
|
+
- `code=SUPPLIER_BIZ_ERROR` means the business call failed after reaching the hotel integration and can still arrive with HTTP `200`.
|