參考︰WQL REST API
使用 WQL REST API傳回:
- 資料來源和資料來源篩選條件的清單。
- 特定資料來源「」的詳細資料。
- 特定資料來源的主要業務物件。
- 資料來源「」中的欄位。
- 特定欄位的相關業務物件。
- 的query的參數GET /data端點。
- 的要求, 申請內文POST /data端點。
GET /dataSources/
與GET /dataSources/{ID}
端點,驗證要使用的別名是否正確。
查看參照︰WQL 別名。
用戶自訂主機與Workday雲端平台 (WCP) API Gateway 均支援 WQL 要求。根據您提出 WQL 要求的來源,您使用的基本 URL 會有所不同。
WQL 要求來源
| 使用的基本 URL
|
|---|---|
Workday用戶自訂斜槓專案總召 | https://{hostname}/api/wql/{version}/{tenant}
|
WCP API閘道 | https://api.workday.com/wql/{version}
|
GET /data
傳回 WQL 查詢的資料。此要求, 申請用於少於 2,048 個字元的查詢。您只能檢視您有安全權限存取的資料。 您可以使用執行 WQL
query
參數。語法︰
{baseURL}/data?query={myquery}
範例查詢︰
{baseURL}/data?query=SELECT location, max(yearsOfService) FROM allWorkers GROUP BY location
JSON回覆範例︰
{ "total": 152, "data": [ { "location": { "descriptor": "Academic Location WATS 1", "id": "5403216f5ef810381796f3bb216504f5" }, "max(yearsOfService)": "20" }, ... ] }
Workday會在 30 分鐘後清除快取的 WQL 查詢結果。若要手動清除快取,您可以新增
offset=0
到您的查詢。範例︰{baseURL}/data?offset=0&query=SELECT firstName, location FROM allWorkers
POST /data
傳回 WQL 查詢的資料。此要求, 申請用於長度介於 2,048 到 16,000 字元之間的查詢。 您只能檢視您有安全權限存取的資料。 您可以使用執行 WQL
query
參數。將query
API呼叫的要求, 申請內文中包含 參數和查詢。語法︰
{baseURL}/data/
要求, 申請內文範例︰
{ "query" : "SELECT location, max(yearsOfService) FROM allWorkers GROUP BY location" }
JSON回覆範例︰
{ "total": 152, "data": [ { "location": { "descriptor": "Academic Location WATS 1", "id": "5403216f5ef810381796f3bb216504f5" }, "max(yearsOfService)": "20" }, ... ] }
GET /dataSources
傳回︰
- 用於 WQL 查詢的資料來源集合。
- 資料來源的主要業務物件。
- 資料來源的索引化資訊。
Syntax:
{baseURL}/dataSources/
範例查詢︰
{baseURL}/dataSources
JSON回覆範例︰
{ "total": 1722, "data": [ { "id": "aae24a47e36110000a37dcb7628d000d", "descriptor": "Indexed In Progress ~Worker~ Calibration Placements", "alias": "indexedInProgressWorkerCalibrationPlacements", "description": "Accesses a ~worker's~ in progress ~worker~ calibration event as the primary business object and the ~worker's~ attributes as the secondary business object. Returns the calibrated values specific to a ~worker~ for an in progress Calibration event.", "primaryBusinessObject": { "descriptor": "Indexed In Progress ~Worker~ Calibration Placements", "id": "aae24a47e36110000a37dd177601000e" }, "dataSourceIndexType": "Indexed" }, …… ] }
包含選填篩選條件的查詢範例。當使用篩選條件「SourceIndexType」= Indexed 時,傳回索引化資料來源。例如︰
{baseURL}/dataSources?SourceIndexType=Indexed
JSON回覆範例︰
{ "total": 35, "data": [ { "id": "aae24a47e36110000a37dcb7628d000d", "descriptor": "Indexed In Progress ~Worker~ Calibration Placements", "alias": "indexedInProgressWorkerCalibrationPlacements", "description": "Accesses a ~worker's~ in progress ~worker~ calibration event as the primary business object and the ~worker's~ attributes as the secondary business object. Returns the calibrated values specific to a ~worker~ for an in progress Calibration event.", "primaryBusinessObject": { "descriptor": "Indexed In Progress ~Worker~ Calibration Placements", "id": "aae24a47e36110000a37dd177601000e" }, "dataSourceIndexType": "Indexed" }, …… ] }
GET /dataSources/{ID}
傳回指定 ID 的資料來源,以用於 WQL 查詢。要求, 申請也會傳回資料來源「」的主要業務物件「 」。
Syntax:
{baseURL}/dataSources/‹datasource_wid›
範例查詢︰
{baseURL}/dataSources/aae24a47e36110000a37dcb7628d000d
JSON回覆範例︰
{ "id": "aae24a47e36110000a37dcb7628d000d", "descriptor": "Indexed In Progress ~Worker~ Calibration Placements", "optionalParameters": [ { "label": "Include ~Terminated~ ~Workers~", "alias": "includeTerminatedWorkers", "type": "Boolean" }, ... ], "supportsEntryDate": false, "description": "Accesses a ~worker's~ in progress ~worker~ calibration event as the primary business object and the ~worker's~ attributes as the secondary business object. Returns the calibrated values specific to a ~worker~ for an in progress Calibration event.", "supportsEffectiveDate": false, "alias": "indexedInProgressWorkerCalibrationPlacements", "dataSourceIndexType": "Indexed", "requiredParameters": [ { "label": "Calibration Node for nBox", "type": "Multi-instance", "alias": "calibrationNodeForNBox" } ], "fullAlias": "my::indexedInProgressWorkerCalibrationPlacements", "filterIsRequired": false, "primaryBusinessObject": { "descriptor": "Indexed In Progress ~Worker~ Calibration Placements", "id": "aae24a47e36110000a37dd177601000e" } }
GET /dataSources/{ID}/fields
傳回特定資料來源的欄位,以用於 WQL 查詢。要求, 申請也會傳回每個欄位的相關業務物件。
語法︰
{baseURL}/dataSources/‹datasource_wid›/fields
範例查詢︰
{baseURL}/datasources/aae24a47e36110000a37dcb7628d000d/fields
JSON回覆範例︰
{ "total": 2967, "data": [ { "id": "09d50672a44001ea5d41efcfd6419a00", "descriptor": "Trended Worker Org for Cost Center_Current_QA (tenant setup)", "alias": "cf_TrendedWorkerOrgForCostCenter_Current_QATenantSetup", "type": "Single instance", "relatedBusinessObject": { "descriptor": "Position Set", "id": "373872302e7e4afe96aa37c0dd93e53e" } },... ] }
GET /dataSources/{ID}/fields/{subresourceID}
將特定欄位的 ID 指定為「」時,傳回該欄位的詳細資料。
{subresourceID}
。要求, 申請也會傳回每個欄位的相關業務物件。語法︰
{baseURL}/dataSources/‹datasource_wid›/fields/{subresourceID}
範例查詢︰
{baseURL}/dataSources/7884e9fbf68c10000b2b632e6e0100f1/fields/bb4ed38524451000419c823f09ba1587
JSON回覆範例︰
{ "id": "bb4ed38524451000419c823f09ba1587", "descriptor": "ACA IRS 1094-C Reporting - ~Worker~ Included in Full Time Count for September", "type": "Boolean", "alias": "ACAIRS1094_CReporting_WorkerIncludedInFullTimeCountForSeptember", "requiredParameters": [ { "alias": "yearForIRSReporting", "label": "Year", "type": "Single Instance" }, { "type": "Single Instance", "alias": "companyWith1094_CCountDataAvailableForYearSelection", "label": "Company with 1094-c Count Data Available for Year Selection" } ], "optionalParameters": [ { "type": "Single Instance", "alias": "month", "label": "Month" } ] }
GET /dataSources/{ID}/dataSourceFilters
傳回特定資料資料來源資料來源條件,以用於 WQL 查詢。
語法︰
{baseURL}/dataSources/‹datasource_wid›/dataSourceFilters
範例查詢︰
{baseURL}/dataSources/6d34556ff015100012a60a4bb1ce0b92/dataSourceFilters
JSON回覆範例︰
{ "total": 6, "data": [ { "id": "432abca0a751100008144ff171b8000a", "descriptor": "Student Applications for Admissions Cohort Finalize Decisions", "alias": "studentApplicationsForAdmissionsCohortFinalizeDecisions", "optionalParameters": [ { "type": "Single Instance", "description": "The Application Grouping for this Student Application.", "alias": "applicationGrouping" } ], "description": "Return Applications that are valid for Publication with this Cohort\n- has an Admissions Decision\n- Decisions Published Status is Confidential - For Internal Use Only\n- No Inactive Status" }, ... ] }