# Field Expansion

Fields can be expanded with the expand query parameter. Multiple field expansion in an API request will need to be separated by a comma. You can see what parameters are expandable for a given endpoint by referring to each endpoint's documentation.

Example:
`https://fetch.yellowdogsoftware.com/api/v3/purchaseOrders?Expand=Stores,Vendor`

## Expanded Dimensions

The following endpoints return item dimensions and include the first ten dimensions by default:

- [GET /items](/rest/fetch/api/items/get-items)
- [GET /items/{id}](/rest/fetch/api/items/get-items-byid)
- [GET /stores/{id}/items](/rest/fetch/api/stores/get-stores-items)


If the database defines more than ten dimensions per item, the entire array of
defined dimensions can be returned by using the `Expand=Dimensions` query parameter
with these endpoints.
When this parameter is added to the request, an additional `dimensions` array property
is added near the end of the response payload. For backward compatibility, the first
ten dimensions still appear with their default property names even though they will
redundantly appear in the `dimensions` array when the expansion is specified.

Below are a few examples for illustration.

### Example without Dimension expansion


```
{
    "id": "09a3de17-40a6-11ea-83e0-08626681c914",

    ...truncated for brevity

    "lastUpdated": "2025-01-09T11:17:21.029Z",
    "dimension1": {
        "id": "987b4fce-3fc2-11ea-83e0-08626681c914",
        "description": "Each"
    },

    ...truncated for brevity

    "dimension9": {
        "id": "21c55710-939d-11ea-b45d-dc4a3e82e82f",
        "description": "StandPOS"
    },
    "dimension10": {
        "id": "4d3ed444-4cf6-11eb-a39d-2c27d7b26643",
        "description": "Demo Item"
    },
    "level": {
        "id": "0cfa4098-b95c-11eb-a3a6-2c27d7b26643",
        "code": "10",
        "description": "Food"
    },
    "level1": {
        "id": "ec6c053c-3fc0-11ea-83e0-08626681c914",
        "code": "00000090",
        "description": "Menu Items"
    },
    "level2": {
        "id": "322458e5-4110-11ea-9c64-5cf37077435a",
        "code": "00020",
        "description": "Quick Service"
    },

    ...truncated for brevity

    "attributes": null,
    "dimensions": null // this is where the expansion values would be included
}
```

### Example with Dimension expansion


```
{
    "id": "09a3de17-40a6-11ea-83e0-08626681c914",

    ...truncated for brevity

    "lastUpdated": "2025-01-09T11:17:21.029Z",
    "dimension1": {
        "id": "987b4fce-3fc2-11ea-83e0-08626681c914",
        "description": "Each"
    },

    ...truncated for brevity

    "dimension9": {
        "id": "21c55710-939d-11ea-b45d-dc4a3e82e82f",
        "description": "StandPOS"
    },
    "dimension10": {
        "id": "4d3ed444-4cf6-11eb-a39d-2c27d7b26643",
        "description": "Demo Item"
    },
    "level": {
        "id": "0cfa4098-b95c-11eb-a3a6-2c27d7b26643",
        "code": "10",
        "description": "Food"
    },
    "level1": {
        "id": "ec6c053c-3fc0-11ea-83e0-08626681c914",
        "code": "00000090",
        "description": "Menu Items"
    },
    "level2": {
        "id": "322458e5-4110-11ea-9c64-5cf37077435a",
        "code": "00020",
        "description": "Quick Service"
    },

    ...truncated for brevity

    "attributes": null,
    "dimensions": {
        "Dimension1": {
            "id": "987b4fce-3fc2-11ea-83e0-08626681c914",
            "description": "Each"
        },
        "Dimension2": {
            "id": "f221e016-3fc2-11ea-83e0-08626681c914",
            "description": "Import"
        },
        "Dimension3": {
            "id": "dc993f47-3fc3-11ea-83e0-08626681c914",
            "description": "Merlot"
        },
        "Dimension4": {
            "id": "cbe9bc5d-4103-11ea-9c64-5cf37077435a",
            "description": "Oregon"
        },

    ...truncated for brevity

        "Dimension26": {
            "id": "a820737e-20c9-11ee-bb0a-b4b5b67da7a8",
            "description": "dim 26"
        },
        "Dimension27": {
            "id": "98753134-d4df-11ee-bb1e-b4b5b67da7a8",
            "description": "test"
        },
        "Dimension28": {
            "id": "465bfb7a-dbf5-11ee-bb1f-b4b5b67da7a8",
            "description": "test"
        }
    }
}
```

### Example of an Item with sparse dimensions


```
{
        "id": "871a8f10-f343-11ed-bb01-b4b5b67da7a8",

    ...truncated for brevity

        "lastUpdated": "2024-08-26T10:53:42.779Z",
        "dimension1": {
            "id": "987b4fce-3fc2-11ea-83e0-08626681c914",
            "description": "Each"
        },
        "dimension2": null,
        "dimension3": {
            "id": "e444e178-3fc3-11ea-83e0-08626681c914",
            "description": "Pinot Noir"
        },
        "dimension4": {
            "id": "d27d824f-4103-11ea-9c64-5cf37077435a",
            "description": "Italy"
        },
        "dimension5": {
            "id": "5d0bfccd-4105-11ea-9c64-5cf37077435a",
            "description": "1995"
        },
        "dimension6": null,
        "dimension7": {
            "id": "967f3501-eeaa-11ed-bb00-b4b5b67da7a8",
            "description": "Test dim 7"
        },
        "dimension8": null,
        "dimension9": null,
        "dimension10": null,
        "level": {
            "id": "7be2d56e-3fc0-11ea-83e0-08626681c914",
            "code": "00010",
            "description": "Packaged"
        },

    ...truncated for brevity

        "attributes": null,
        "dimensions": {
            "Dimension1": {
                "id": "987b4fce-3fc2-11ea-83e0-08626681c914",
                "description": "Each"
            },
            "Dimension3": {
                "id": "e444e178-3fc3-11ea-83e0-08626681c914",
                "description": "Pinot Noir"
            },
            "Dimension4": {
                "id": "d27d824f-4103-11ea-9c64-5cf37077435a",
                "description": "Italy"
            },
            "Dimension5": {
                "id": "5d0bfccd-4105-11ea-9c64-5cf37077435a",
                "description": "1995"
            },
            "Dimension7": {
                "id": "967f3501-eeaa-11ed-bb00-b4b5b67da7a8",
                "description": "Test dim 7"
            }
        }
    }
```