Skip to content
KiweelyKiweelyKiweely

Paging with POST /wql/v1/data in a PMD Grid When Queries Exceed URL Limits

Switching a PMD grid endpoint from GET /wql/v1/data to POST /wql/v1/data when a WQL query exceeds 2,048 characters causes HTTP 500 when native grid pagingInfo is enabled. Learn why PMD grid paging fails with POST and three working architectures to paginate long queries.

  • Checked against Workday on
  • Applies to Workday Query Language
  • 3 min read
  • Published
  • By Kiweely
On this page

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:

  1. Configure the Synchronous Orchestration to accept limit, offset, and your filter criteria (or a reference ID to a staging record) as orchestration launch parameters.
  2. Inside the orchestration, add a Send Workday API Request (or WQL step) that sends an HTTP POST to /wql/v1/data with the JSON body containing the full query, limit, and offset:
    json
    {
      "query": "SELECT worker, employeeID, location FROM allWorkers WHERE ...",
      "limit": 100,
      "offset": 0
    }
  3. Return the WQL JSON response (data and total) as the Synchronous Orchestration’s output.
  4. On the PMD page, bind the inbound endpoint to the Synchronous Orchestration using "httpMethod": "GET", and bind the grid’s pagingInfo.endPoint to that endpoint. Because the PMD page talks to the Synchronous Orchestration over GET, native grid pagination works without modification while the orchestration executes the 16,000-character POST /wql/v1/data call 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):

json
{
  "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:

json
{
  "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:

  1. Initialize pageVariables.offset = 0 and pageVariables.limit = 50.
  2. Configure your deferred POST /wql/v1/data endpoint to read pageVariables.offset and pageVariables.limit inside its JSON request body.
  3. Add Previous and Next button widgets below the grid whose onClick scripts increment or decrement pageVariables.offset by pageVariables.limit, re-invoke the POST endpoint, and refresh the grid’s rows array.

How to Verify in the Tenant

  1. Test your WQL statement in View WQL Query Result or via POST /wql/v1/data in REST API Explorer to confirm the query syntax is valid and under the 16,000-character POST limit.
  2. Deploy your PMD page and Synchronous Orchestration (or Graph Query component) to your development tenant.
  3. Open the browser developer tools (Network tab), load the Extend page, and click through pages 1, 2, and 3 on the grid.
  4. Confirm that each page transition returns HTTP 200, advances offset by the page size, and displays the expected slice of total records without throwing an HTTP 500 error.

Sources checked

Related guides

All guides

Let Workday check the work.

Kiweely writes WQL and builds orchestrations in your own tenant, and Workday, not Kiweely, says whether they passed.

Get the next guide in your inbox.

One email a month with new guides and one Extend tip. Nothing else.

We’ll email you once to confirm. Unsubscribe in one click from any issue.