跳至主要內容
Administrator Guide
上次更新時間 :2024-11-15
參照︰WQL REST API

參照︰WQL REST API

使用 WQL REST API 傳回︰
  • 資料來源和資料來源篩選條件的清單。
  • 有關特定資料來源的詳細資料。
  • 特定資料來源的主要業務物件。
  • 資料來源中的欄位
  • 特定欄位的相關業務物件。
您可以使用回應中的資訊,在以下位置建構 WQL 要求︰
  • query
    的參數
    GET /data
    端點
  • 的要求內文
    POST /data
    端點
建構要求前,您可以使用
GET /dataSources/
GET /dataSources/{ID}
端點,以驗證要使用的別名是否正確。
請參閱「」 參照︰WQL 別名
用戶自訂主機和 Workday 雲端平台 (WCP) API 閘道均支援 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 個字元的查詢。您只能檢視您有權安全存取的資料。 您可以使用
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 會在 15 分鐘後清除快取的 WQL 查詢結果。若要手動清除快取,您可以新增
offset=0
新增至您的查詢。範例︰
{baseURL}/data?offset=0&query=SELECT firstName, location FROM allWorkers

POST /資料

傳回 WQL 查詢的資料。此要求用於長度介於 2,048 到 16,000 字元之間的查詢。 您只能檢視您有權安全存取的資料。 您可以使用
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 查詢中使用。此要求也會傳回資料來源的主要業務物件。
語法︰
{baseURL}/dataSources/
範例查詢︰
{baseURL}/dataSources
JSON 回應範例︰
{ "total": 1722, "data": [ { "id": "6d34556ff015100012a60a4bb1ce0b92", "descriptor": "Student Applications", "alias": "studentApplications", "description": "Accesses the Student Application object and returns one row for each application. Includes data source filters with built-in prompts. You can use this data source to list student applications and related data." "primaryBusinessObject": { "Descriptor": "Student Application", "id": "8b7dc084c617100028ff0f3bdbf000ac" }, }, ... ] }

GET /dataSources/{ID}

傳回指定 ID 的資料來源,以用於 WQL 查詢。該要求也會傳回資料來源的主要業務物件。
語法︰
{baseURL}/dataSources/‹datasource_wid›
範例查詢︰
{baseURL}/dataSources/aae24a47e36110000a37dcb7628d000d
JSON 回應範例︰
{ "id": "aae24a47e36110000a37dcb7628d000d", "descriptor": "Indexed In Progress ~Worker~ Calibration Placements", "primaryBusinessObject": { "descriptor": "Indexed In Progress ~Worker~ Calibration Placements", "id": "aae24a47e36110000a37dd177601000e" }, "requiredParameters": [...], "filterIsRequired": false, "optionalParameters": [...], "supportsEntryDate": false, "alias": "indexedInProgressWorkerCalibrationPlacements", "supportsEffectiveDate": 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." }

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/aae24a47e36110000a37dcb7628d000d/fields/09d50672a44001ea5d41efcfd6419a00
JSON 回應範例︰
{ "id": "09d50672a44001ea5d41efcfd6419a00", "descriptor": "Trended Worker Org for Cost Center_Current_QA (tenant setup)", "relatedFields":[...] "relatedBusinessObject": { "descriptor": "Position Set", "id": "373872302e7e4afe96aa37c0dd93e53e" }, "type": "Single instance", "alias": "cf_TrendedWorkerOrgForCostCenter_Current_QATenantSetup" }

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" }, ... ] }