> For the complete documentation index, see [llms.txt](https://docs.mews.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mews.com/pos-api/guidelines/sparse-fieldsets.md).

# Sparse fieldsets

**Mews POS API** allows the clients to fetch only a subset of fields from a resource or collection using the JSON:API sparse fieldsets feature. Sparse fieldsets can be specified using `?fields[TYPE]=exampleFieldA,exampleFieldB` as a query parameter, where `TYPE` is the singular resource type e.g. `invoices`, from which only `exampleFieldA` and `exampleFieldB` should be fetched. The value of any `fields` parameter must be a comma-separated (U+002C COMMA, ",") list that refers to the name(s) of the fields to be returned. An empty value indicates that no fields should be returned. Please note that support for fieldsets is endpoint-specific. Visit the documentation of an endpoint to get more details about the fields that can be used in the `fields[TYPE]` query parameter.

> **Unsafe characters**: We recommend you always URI-encode the values of the `fields` query parameter, because fields can contain unsafe URL characters, such as square brackets.

### Example request and response

In the example request, we will query the `/invoices` endpoint with only a subset of fields:

`GET` `[PlatformAddress]/v1/invoices?fields[invoices]=total,subtotal,tax,createdAt,updatedAt`

#### Response

```javascript

{
    "data": [
        {
            "id": "babcf91e-5930-4b90-b929-0fb2b076bd3b",
            "type": "invoices",
            "attributes": {
                "total": "10.00",
                "subtotal": "10.00",
                "tax": "0.00",
                "createdAt": "2024-07-26T07:35:07.817Z",
                "updatedAt": "2024-07-26T07:35:07.836Z",
            },
            "relationships": {}
        }
    ],
    "links": {
        "prev": "[PlatformAddress]/v1/invoices?page[before]=OTMzMw&page[size]=1",
        "next": "[PlatformAddress]/v1/invoices?page[after]=OTMzMw&page[size]=1"
    }
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.mews.com/pos-api/guidelines/sparse-fieldsets.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
