参考信息:WQL REST API
使用 WQL REST API返回:
- 数据源和数据源筛选器列表。
- 有关特定数据源“”的详细信息。
- 特定数据源“”的主要业务对象。
- “”数据源中的字段。
- 特定字段的相关业务对象。
- 该query的参数GET /data端点。
- 的请求,申请主体POST /data端点。
GET /dataSources/
“”及“”GET /dataSources/{ID}
用于验证要使用的别名是否正确。
查看参考信息:WQL 别名.
两个租户主机和Workday Cloud Platform (WCP) 应用程序编程接口 (API)网关均支持 WQL 请求。您使用的基 URL 会有所不同,具体取决于您发出 WQL 请求的位置。
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 查询的数据源集合。
- 数据源的主要业务对象。
- 数据源的索引信息
语法:
{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}
返回指定编号的数据源,以在 WQL 查询中使用。该请求,申请还会返回数据源“”的主要业务对象。
语法:
{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}
当指定字段的编号时,返回特定字段的详细信息
{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" }, ... ] }