---
category: [Administration & Integrations, Administration & Integrations/Custom Integrations & Apps, Platform and Product Extensions, Platform and Product Extensions/Workday Extend, Platform and Product Extensions/Integration]
keyword: [Extend, Model Components, Extend Business Objects, MCBO, Model Component Business Objects, Business Objects, Model BO]
nav: wcp_docs
parent_url: /wcp_docs/
title: >- 
  Example: Query Parameters in Business Object API Requests
layout: subsection
---

Workday Extend indexes:

-   All `SINGLE_INSTANCE` fields of Extend business objects and attachments.
-   Up to 5 regular fields in Extend business objects and attachments on which you set the `enableIndex` attribute to `true`. You can't apply this attribute to derived fields.


Extend generates query parameters for all indexed fields in your app. Use indexed fields to optimize the performance of:

-   Custom report filters.
-   REST API query parameters.
-   The `WHERE` clause in WQL queries.


<b>Note:</b> You don't need to apply the `enableIndex` attribute to `SINGLE_INSTANCE` fields of business objects or attachments. Extend indexes these fields automatically.

### Scenario

<a id="context_N10029_N1001E_N10001"></a>
Use query parameters to filter the instances returned by a request to the REST API of a business object.

For the request to return a valid response, the domain security policy on the business object must authorize the processing user. In addition, if you set `"secureByTarget": true` on a `SINGLE_INSTANCE` field, the request returns only those instances that the processing user is contextually secured to view.

If your request uses more than 1 query parameter, the processing user must have access to the instances returned by all of the query parameters in the request.

### Steps

1.  <a id="step_N10041_N1003E_N1001E_N10001"></a>Add a `SINGLE_INSTANCE` field to the Charity business object in the Charitable Donations app. Use `SUPERVISORY_ORGANIZATION` as the `target` attribute.
2.  <a id="step_N100A9_N10091_N10059_N10001"></a>Add the `"enableIndex": true` attribute to the `matchDonations` boolean field.

    ```
    {
      "id": 1,
      "name": "Charity",
      "label": "Charity",
      "defaultSecurityDomains": [
        "ManageCharities"
      ],
      "defaultCollection": {
        "name": "charities",
        "label": "All Charities"
      },
      "fields": [
        {
          "id": 1,
          "name": "name",
          "type": "TEXT",
          "label": "Name",
          "useForDisplay": true,
          "isReferenceId": true
        },
        {
          "id": 2,
          "name": "description",
          "type": "TEXT",
          "label": "Description"
        },
        {
          "id": 3,
          "name": "matchDonations",
          "type": "BOOLEAN",
          "label": "Match Donations",
          "enableIndex": true
        },
        {
          "id": 4,
          "name": "relationshipManager",
          "type": "SINGLE_INSTANCE",
          "label": "Relationship Manager",
          "target": "WORKER"
        },
        {
          "id": 5,
          "name": "logo",
          "type": "SINGLE_INSTANCE",
          "label": "Logo",
          "target": "CharityLogo"
        },
        {
          "id": 6,
          "name": "createdBy",
          "type": "SINGLE_INSTANCE",
          "label": "Created By",
          "target": "WORKER",
          "secureByTarget": true
        },
        {
          "id": 7,
          "name": "organization",
          "type": "SINGLE_INSTANCE",
          "label": "Organization",
          "target": "SUPERVISORY_ORGANIZATION"
        }
      ],
      "derivedFields": [
        {
          "id": 1,
          "name": "logoUploadedBefore2022",
          "type": "BOOLEAN",
          "label": "Logo Before 2022",
          "expression": "logo.uploadedDate.toYear().toNumber() < 2022"
        },
        {
          "id": 2,
          "name": "logoLabel",
          "type": "TEXT",
          "label": "Logo Label",
          "expression": "logoUploadedBefore2022 ? 'Old Image' : 'New Image'"
        },
        {
          "id": 3,
          "name": "workdayMatched",
          "type": "BOOLEAN",
          "label": "Workday Matched Charity",
          "expression": "matchDonations && (description == 'Workday Charity')"
        }
      ]
    }
    ```

3.  <a id="step_N10053_N1003E_N1001E_N10001"></a>Add the Employee as Self and Manager security groups to the `ManageCharities` security domain.
4.  <a id="step_N10060_N1003E_N1001E_N10001"></a>Create a Charity instance where:

    -   The Created By worker is Logan McNeil.
    -   The Organization is 2000 Executive Management.
    -   Match Donations is selected.

5.  <a id="step_N1007A_N1003E_N1001E_N10001"></a>Ensure that Steve Morgan is the manager of Logan McNeil, and of the 2000 Executive Management organization.
6.  <a id="step_N10114_N100A6_N10059_N10001"></a>As Logan McNeil, use a query parameter to call the Charities REST API, filtering on charities for which donations are matched:

    ```
    GET https://api.workday.com/apps/charitableDonations_abcdef/v1/charities?matchDonations=true
    ```

    The query returns Charity data for only the charities for which donations are matched.

7.  <a id="step_N10083_N1003E_N1001E_N10001"></a>As Logan McNeil, use a query parameter to call the Charities REST API, filtering on Logan McNeil as the Created By worker:

    ```
    GET https://api.workday.com/apps/charitableDonations_abcdef/v1/charities?createdBy=3aa5550b7fe348b98d7b5741afc65534
    ```

    The query returns Charity data for charities where Logan McNeil is the Created By worker.

8.  <a id="step_N10136_N100A6_N10059_N10001"></a>As Logan McNeil, use query parameters to call the Charities REST API, filtering on Logan McNeil as the Created By worker and charities for which donations are matched:

    ```
    GET https://api.workday.com/apps/charitableDonations_abcdef/v1/charities?createdBy=3aa5550b7fe348b98d7b5741afc65534&matchDonations=true
    ```

    The query returns Charity data for charities where Logan McNeil is the Created By worker and for which donations are matched.

9.  <a id="step_N10094_N1003E_N1001E_N10001"></a>As Logan McNeil, use query parameters to call the Charities REST API, filtering on Logan McNeil as the Created By worker and 2000 Executive Management as the organization:

    ```
    GET https://api.workday.com/apps/charitableDonations_abcdef/v1/charities?createdBy=3aa5550b7fe348b98d7b5741afc65534&organization=9378b36dabd94cc391ef5392166aa00e
    ```

    Because Logan McNeil isn't a manager of the 2000 Executive Management organization, Logan doesn't have access to call the API using the Organization filter, and the query returns an error:

    ```
    {
        "error": "invalid request: validation errors",
        "errors": [
            {
                "error": "not found: 9378b36dabd94cc391ef5392166aa00e",
                "code": "S21"
            }
        ]
    }
    ```

10. <a id="step_N100A9_N1003E_N1001E_N10001"></a>As Steve Morgan, use query parameters to call the Charities REST API, filtering on Logan McNeil as the Created By worker and 2000 Executive Management as the organization:

    ```
    GET https://api.workday.com/apps/charitableDonations_abcdef/v1/charities?createdBy=3aa5550b7fe348b98d7b5741afc65534&organization=9378b36dabd94cc391ef5392166aa00e
    ```

    Because Steve Morgan is the manager of both:

    -   Logan McNeil
    -   2000 Executive Management

    The query returns Charity data for charities where Logan McNeil is the Created By worker and 2000 Executive Management is the Organization.



### Related Information

[Reference: Business Object API Requests](/wcp_docs/xml1559763881756.html)

