Field Manual for the Fenbeitong Travel Application Query API: From Subscription Trigger to Kingdee Cloud Cosmos
What Problem Does This API Solve
The Fenbeitong travel application query API fetches a single travel request by third_apply_id or apply_id, driven by subscription messages, and syncs it into the Kingdee Cloud Cosmos expense request form (ER_ExpenseRequest_Travel). It acts as the bridge in the "travel request → cost-bearing organization writeback" chain, avoiding the latency and redundancy of batch polling.
API Capability Overview
- Endpoint:
/openapi/apply/custom_trip/v1/detail - Method: POST (on-premise deployments usually go through an internal gateway)
- Authentication: AppKey + signature + timestamp, with access_token in the header
- Request Parameters:
third_apply_id(third-party custom application ID),apply_id(Fenbeitong custom application ID),update_mode(1-create new, 2-amend existing) - Response Structure: Standard envelope
code/msg/data; business data lives indata.apply, containing nested objects for the master record, itinerary, cost attribution, and accompanying persons - Pagination/Incremental Mode: Single-record query, no pagination; incrementality is driven by subscription messages pushing IDs
Typical Field Mapping
| Field | Type | Meaning | Field Notes |
|---|---|---|---|
| id | string | Unique primary key of the travel application | metadata id points here; used as the cross-system anchor |
| code | string | Business document number | metadata number points here; maps to Kingdee FBillNo |
| form_id / root_id | string | Form template and process root | Routes different business branches |
| state / past_status | string | Current / past status | past_status must be retained for audit on amendments |
| create_time / update_time / complete_time | string | Timestamp sequence | create_time maps to Kingdee application date; watch time-zone drift |
| name / reason / remark | string | Name, reason, remark | remark should be concatenated with all_cityname before writing into Kingdee reason |
| city1_name / citylast_name | string | Origin / destination | Extracted by script from multi_trips; not present in the raw response |
| 部门_name / 部门_id / 部门_code | string | Cost-bearing department | Extracted from cost_attributions.details; maps to Kingdee FDeptID/FCostDeptID |
| 费用承担公司_name / 费用承担公司_id | string | Cost-bearing organization | Maps to Kingdee FOrgID; verify the org is enabled |
| proposer | object | Applicant object | Includes code, department_id, phone; maps to FStaffID/FTOCONTACTUNIT/FPhoneNumber |
| users_names / users_codes | string | Accompanying person names / codes | Joined by script from users[]; maps to Kingdee FAccompany / F_dps_TXRNO |
| base_controls | object | Base form control values | Carries custom field extensions |
How to Configure on the Qeasy Data Integration Platform
On the Qeasy Data Integration Platform, this kind of "subscription-trigger + single-record query + script enrichment + target writeback" chain is typically carried by a single QUERY_ONLY strategy. The configuration roughly goes:
- Source Adapter: Pick the Fenbeitong travel application adapter, fill in AppKey/Secret, and wire the subscription-message callback as the trigger.
- Field Mapper: Drag standard fields like
code,proposer.code,create_timeto Kingdee FBillNo, FStaffID, FApplyDate. Script-enriched fields (city1_name,all_cityname,users_names, etc.) are surfaced through the "custom fields" panel and made available for mapping. - AfterSourceInvoke Hook: Mount a script on the source response callback to join
multi_trips.citys[].city_nameintoall_cityname, expandcost_attributions.detailsinto部门_*and费用承担公司_*, and joinusers[]intousers_names/users_codes. The Qeasy field mapper auto-detects script-injected fields and lists them in the mapping palette. - Target Writeback: On the Kingdee side, use
_findCollectionwithFBillNo={{code}}to decide create vs. amend, and setIsAutoSubmitAndAuditto true (new) or false (amend) accordingly.
Cross-Project Practical Highlights
- Derived fields must be declared explicitly: Fields like
city1_nameand部门_namedo not exist in the raw response; they must be produced insideAfterSourceInvoke, otherwise the target side will see empty values. codeis the only Kingdee anchor: Kingdee FBillNo consumescodedirectly; any collision will scramble the create/amend logic.multi_tripsis the itinerary source: Origin, destination, and the full city list all live here; do not misread top-leveldata.applyfields.cost_attributionsis the cost-bearing key: It is an array ofdetails[]and must be iterated; do not treat it as a flat object.users[]joining must stay consistent: Accompanying persons are joined with commas, names and codes separately, mapping one-to-one to Kingdee FAccompany and F_dps_TXRNO.- Subscription beats polling: This single-record query API does not need a cron job; subscription-triggered calls are both real-time and quota-friendly.
Pitfall Recap
city1_namenot found in the response: The script is missing or wired at the wrong hook. The safe move is to enrich explicitly insideAfterSourceInvokeand log it for confirmation.remarkalone gets overwritten: Kingdee reason needsremark + all_cityname; mappingremarkonly drops the itinerary context.update_modemis-set to 1 on amendments: This recreates a new doc and causes Kingdee document-number conflicts. The safe approach is to distinguish new vs. amend events in the subscription message and pass the matching mode.- Cost-bearing organization not enabled: Disabled org records cause write failures; add an enablement check in the script and either skip or route to manual handling.
- Accompanying-person codes and names misaligned: Inconsistent join order scrambles FAccompany vs. F_dps_TXRNO. The safe move is to join from the same
users[]array so order is naturally consistent.
When to Use It
Pick this API when you need to sync Fenbeitong travel applications into Kingdee Cloud Cosmos expense requests in near real time and latency matters. For batch reconciliation or offline analytics, prefer Fenbeitong's bulk-pull API instead; if the target is not Kingdee Cloud Cosmos, the field-enrichment patterns here still apply, but the actual mappings must be rebuilt.