Why Switching a Paginated PMD Grid to POST /wql/v1/data Returns HTTP 500
The WQL REST API provides two endpoints for executing queries:
GET /wql/v1/data?query={myquery}: Supports WQL queries up to 2,048 characters.POST /wql/v1/data: Accepts a JSON request body ({"query": "...", "limit": 100, "offset": 0}) for queries between 2,048 and 16,000 characters.
When a Workday Extend page constructs a long dynamic WHERE ... IN (...) clause or selects dozens of fields and aliases, the query string easily crosses the 2,048-character threshold for GET. However, if you change a PMD inbound endpoint bound to a grid widget’s pagingInfo block from "httpMethod": "GET" to "httpMethod": "POST", the page fails with an HTTP 500 error as soon as the grid loads or the user clicks to the next page.
This happens because Workday Extend’s built-in pagingInfo framework on a grid widget is designed around GET requests. When a user pages through a grid, the native pagingInfo handler automatically appends ?limit=...&offset=... as URL query parameters to the endpoint invocation rather than serializing limit and offset into the JSON request body expected by POST /wql/v1/data.
Three Working Patterns for Paginating Long Queries in a PMD Grid
When you cannot shorten the WQL query below 2,048 characters (for instance, by moving complex conditions into a Calculated Field or using a hierarchy filter), use one of these three verified patterns.
Pattern 1: Wrap POST /wql/v1/data in a Synchronous Orchestration Called via GET
The cleanest way to preserve native PMD grid pagingInfo while executing POST /wql/v1/data is to create a Synchronous Orchestration that acts as a bridge:
- Configure the Synchronous Orchestration to accept
limit,offset, and your filter criteria (or a reference ID to a staging record) as orchestration launch parameters. - Inside the orchestration, add a Send Workday API Request (or WQL step) that sends an HTTP
POSTto/wql/v1/datawith the JSON body containing the fullquery,limit, andoffset:json { "query": "SELECT worker, employeeID, location FROM allWorkers WHERE ...", "limit": 100, "offset": 0 } - Return the WQL JSON response (
dataandtotal) as the Synchronous Orchestration’s output. - On the PMD page, bind the inbound endpoint to the Synchronous Orchestration using
"httpMethod": "GET", and bind the grid’spagingInfo.endPointto that endpoint. Because the PMD page talks to the Synchronous Orchestration overGET, native grid pagination works without modification while the orchestration executes the 16,000-characterPOST /wql/v1/datacall behind the scenes.
Pattern 2: Convert the Query to a Workday GraphQL (workday-graphql) Endpoint
Workday GraphQL (POST https://api.workday.com/graphql/v1) natively uses HTTP POST without the 2,048-character URL ceiling, and PMD’s graphQuery property explicitly binds pagingVariables.offset and pagingVariables.limit into GraphQL $offset and $limit variables.
First, create a Graph Query component (getWorkers.graph):
{
"id": "getWorkers",
"query": "query getWorkers($offset: BigInt, $limit: BigInt) { worker(dataSource: {indexedAllWorkers: {filter: {indexedAllWorkersFilter: {}}}}, limit: $limit, offset: $offset) { data { nameInGeneralDisplayFormat descriptor workdayID { id } } total } }"
}Then configure the PMD inbound endpoint with "httpMethod": "POST" and map pagingVariables.offset and pagingVariables.limit using number:convertStringToInt:
{
"id": "workersView",
"endPoints": [
{
"name": "getWorkers",
"httpMethod": "POST",
"authType": "sso",
"url": "https://api.workday.com/graphql/v1",
"graphQuery": {
"queryId": "getWorkers",
"variables": {
"offset": "<% empty pagingVariables.offset ? 0 : number:convertStringToInt(pagingVariables.offset) %>",
"limit": "<% empty pagingVariables.limit ? 100 : number:convertStringToInt(pagingVariables.limit) %>"
}
},
"failOnStatusCodes": [
{ "code": 400 },
{ "code": 429 }
]
}
],
"presentation": {
"body": {
"type": "section",
"children": [
{
"type": "grid",
"id": "workersGrid",
"label": "Workers",
"rows": "<% getWorkers.data.worker.data %>",
"rowVariableName": "worker",
"pagingInfo": {
"endPoint": "<% endpoints.getWorkers %>",
"rowCount": "<% getWorkers.data.worker.total %>",
"data": "<% getWorkers.data.worker.data %>"
},
"columns": [
{
"type": "column",
"columnId": "workerIdColumn",
"label": "Worker ID",
"cellTemplate": {
"type": "text",
"id": "workerId",
"value": "<% worker.workdayID?.id %>"
}
}
]
}
]
}
}
}Keep in mind that Workday GraphQL enforces a maximum limit of 100 rows per page, so set the default limit to 100 or less.
Pattern 3: Custom Paging Buttons with pageVariables
If you want to call POST /wql/v1/data directly from PMD without a Synchronous Orchestration or GraphQL, omit the native pagingInfo block on the grid widget and manage pagination state in pageVariables:
- Initialize
pageVariables.offset = 0andpageVariables.limit = 50. - Configure your deferred
POST /wql/v1/dataendpoint to readpageVariables.offsetandpageVariables.limitinside its JSON request body. - Add Previous and Next button widgets below the grid whose
onClickscripts increment or decrementpageVariables.offsetbypageVariables.limit, re-invoke thePOSTendpoint, and refresh the grid’srowsarray.
How to Verify in the Tenant
- Test your WQL statement in View WQL Query Result or via
POST /wql/v1/datain REST API Explorer to confirm the query syntax is valid and under the 16,000-characterPOSTlimit. - Deploy your PMD page and Synchronous Orchestration (or Graph Query component) to your development tenant.
- Open the browser developer tools (Network tab), load the Extend page, and click through pages 1, 2, and 3 on the grid.
- Confirm that each page transition returns HTTP
200, advancesoffsetby the page size, and displays the expected slice oftotalrecords without throwing an HTTP500error.