Self Links and Inheritance of Sparse Fieldsets

If you’re still looking for the answer, the sparse fieldsets should not be present in a resource-level self link. Otherwise the client has to remove those query parameters before requesting other data from that endpoint.

See also Top-level links vs. resource-level links for item resources. Main take away is that the resource-level self link identifies the resource, not how you want to have it represented in a specific call.

Thus a request for /pools?fields[pools]=name,description returns:

{
	"data": [
        {
			"attributes": {
				"name": "First Pool",
				"description": "A good pool"
			},
			"id": "5c071fae-01fa-4f18-b692-7bc6fc98331f",
			"links": {
				"self": "/pools/5c071fae-01fa-4f18-b692-7bc6fc98331f"
			},
			"type": "pools"
		},
		{
			"attributes": {
				"name": "Second Pool",
				"description": "Another good pool"
			},
			"id": "a0d6a8c1-eaed-43ed-8937-f3c5387ee78a",
			"links": {
				"self": "/pools/a0d6a8c1-eaed-43ed-8937-f3c5387ee78a"
			},
			"type": "pools"
		}
	],
	"links": {
		"self": "/pools?fields[pools]=name,description"
	}
}

The client can then request the extra data if a user interacts with one of the resources using /pools/5c071fae-01fa-4f18-b692-7bc6fc98331f?fields[pools]=city,country,active:

{
	"data": {
        "attributes": {
            "city": "Berlin",
            "country": "Germany",
            "active": true
	    },
        "id": "5c071fae-01fa-4f18-b692-7bc6fc98331f",
        "links": {
            "self": "/pools/5c071fae-01fa-4f18-b692-7bc6fc98331f"
        },
        "type": "pools",
    },
    "links": {
        "self": "/pools/5c071fae-01fa-4f18-b692-7bc6fc98331f?fields[pools]=city,country,active"
    }
}