Sparse Fieldsets

Especially with included resources the dataset could get quite large and may reduce performance on both server and client side. To limit the amount of data returned by the API, it is possible to specify which fields should be visible in the response.

The specific fields can be requested on a per-type basis using the fields[TYPE] parameter. This parameter can be included on any GET request to the API.

Parameters

fields[TYPE]
string
A comma seperated list of fields to return as data properties in the response. Known as Sparse Fieldsets. Replace TYPE with the name of the resource.

Example

For this example we will be requesting all of the customers in your account, limiting the results to only their first and last name.

Request

GET /customers?fields[customer]=first_name,last_name HTTP/1.1
X-Authorization: 53b9e049186e04743bcdd685ea0bafbd1ff9e0c7f

Response

{
  "meta": {
    "total": 12
  },
  "links": {
    "self": "https://api.ecurring.com/customers?page[number]=1&page[size]=10",
    "first": "https://api.ecurring.com/customers?page[number]=1&page[size]=10",
    "last": "https://api.ecurring.com/customers?page[number]=18&page[size]=10",
    "prev": null,
    "next": "https://api.ecurring.com/customers?page[number]=2&page[size]=10"
  },
  "data": [
    {
        "type": "customer",
        "id": "1",
        "links": {
          "self": "https://api.ecurring.com/customers/1"
        },
        "attributes": {
          "first_name": "Jeroen",
          "last_name": "van der Geer"
        },
    },
    {
        "type": "customer",
        "id": "2",
        "links": {
          "self": "https://api.ecurring.com/customers/2"
        },
        "attributes": {
          "first_name": "Suzette",
          "last_name": "Vrielink"
        },
    },
    { ... }
  ]
}