Closed
Description
When using sparse fieldsets, any related data that is included will be set to null
.
For example, request to http://localhost:1479/api/v1/todoItems/375?include=owner
returns:
{
"links": {
"self": "http://localhost:1479/api/v1/todoItems/375"
},
"data": {
"type": "todoItems",
"id": "375",
"attributes": {
"description": "Iusto harum voluptatem voluptatibus asperiores est iusto architecto eaque numquam.",
"ordinal": 1,
"guidProperty": "e0ca07d8-3db2-4060-a6d8-a910b0a1e672",
"createdDate": "2019-11-08T06:59:38.612382",
"achievedDate": null,
"updatedDate": null,
"calculatedValue": "calculated",
"offsetDate": null
},
"relationships": {
"owner": {
"links": {
"self": "http://localhost:1479/api/v1/todoItems/375/relationships/owner",
"related": "http://localhost:1479/api/v1/todoItems/375/owner"
},
"data": {
"type": "people",
"id": "129"
}
},
"assignee": {
"links": {
"self": "http://localhost:1479/api/v1/todoItems/375/relationships/assignee",
"related": "http://localhost:1479/api/v1/todoItems/375/assignee"
}
},
"oneToOnePerson": {
"links": {
"self": "http://localhost:1479/api/v1/todoItems/375/relationships/oneToOnePerson",
"related": "http://localhost:1479/api/v1/todoItems/375/oneToOnePerson"
}
},
"stakeHolders": {
"links": {
"self": "http://localhost:1479/api/v1/todoItems/375/relationships/stakeHolders",
"related": "http://localhost:1479/api/v1/todoItems/375/stakeHolders"
}
},
"collection": {
"links": {
"self": "http://localhost:1479/api/v1/todoItems/375/relationships/collection",
"related": "http://localhost:1479/api/v1/todoItems/375/collection"
}
},
"dependentOnTodo": {
"links": {
"self": "http://localhost:1479/api/v1/todoItems/375/relationships/dependentOnTodo",
"related": "http://localhost:1479/api/v1/todoItems/375/dependentOnTodo"
}
},
"parentTodo": {
"links": {
"self": "http://localhost:1479/api/v1/todoItems/375/relationships/parentTodo",
"related": "http://localhost:1479/api/v1/todoItems/375/parentTodo"
}
},
"childrenTodos": {
"links": {
"self": "http://localhost:1479/api/v1/todoItems/375/relationships/childrenTodos",
"related": "http://localhost:1479/api/v1/todoItems/375/childrenTodos"
}
}
},
"links": {
"self": "http://localhost:1479/api/v1/todoItems/375"
}
},
"included": [
{
"type": "people",
"id": "129",
"attributes": {
"firstName": "Tiffany",
"lastName": "Kub",
"age": 97
},
"relationships": {
"todoItems": {
"links": {
"self": "http://localhost:1479/api/v1/people/129/relationships/todoItems",
"related": "http://localhost:1479/api/v1/people/129/todoItems"
}
},
"assignedTodoItems": {
"links": {
"self": "http://localhost:1479/api/v1/people/129/relationships/assignedTodoItems",
"related": "http://localhost:1479/api/v1/people/129/assignedTodoItems"
}
},
"todoCollections": {
"links": {
"self": "http://localhost:1479/api/v1/people/129/relationships/todoCollections",
"related": "http://localhost:1479/api/v1/people/129/todoCollections"
}
},
"role": {
"links": {
"self": "http://localhost:1479/api/v1/people/129/relationships/role",
"related": "http://localhost:1479/api/v1/people/129/role"
}
},
"oneToOneTodoItem": {
"links": {
"self": "http://localhost:1479/api/v1/people/129/relationships/oneToOneTodoItem",
"related": "http://localhost:1479/api/v1/people/129/oneToOneTodoItem"
}
},
"stakeHolderTodoItem": {
"links": {
"self": "http://localhost:1479/api/v1/people/129/relationships/stakeHolderTodoItem",
"related": "http://localhost:1479/api/v1/people/129/stakeHolderTodoItem"
}
},
"unIncludeableItem": {
"links": {
"self": "http://localhost:1479/api/v1/people/129/relationships/unIncludeableItem",
"related": "http://localhost:1479/api/v1/people/129/unIncludeableItem"
}
},
"passport": {
"links": {
"self": "http://localhost:1479/api/v1/people/129/relationships/passport",
"related": "http://localhost:1479/api/v1/people/129/passport"
}
}
},
"links": {
"self": "http://localhost:1479/api/v1/people/129"
}
}
]
}
But request to http://localhost:1479/api/v1/todoItems/375?include=owner&fields=description
returns:
{
"links": {
"self": "http://localhost:1479/api/v1/todoItems/375"
},
"data": {
"type": "todoItems",
"id": "375",
"attributes": {
"description": "Iusto harum voluptatem voluptatibus asperiores est iusto architecto eaque numquam."
},
"relationships": {
"owner": {
"links": {
"self": "http://localhost:1479/api/v1/todoItems/375/relationships/owner",
"related": "http://localhost:1479/api/v1/todoItems/375/owner"
},
"data": null
},
"assignee": {
"links": {
"self": "http://localhost:1479/api/v1/todoItems/375/relationships/assignee",
"related": "http://localhost:1479/api/v1/todoItems/375/assignee"
}
},
"oneToOnePerson": {
"links": {
"self": "http://localhost:1479/api/v1/todoItems/375/relationships/oneToOnePerson",
"related": "http://localhost:1479/api/v1/todoItems/375/oneToOnePerson"
}
},
"stakeHolders": {
"links": {
"self": "http://localhost:1479/api/v1/todoItems/375/relationships/stakeHolders",
"related": "http://localhost:1479/api/v1/todoItems/375/stakeHolders"
}
},
"collection": {
"links": {
"self": "http://localhost:1479/api/v1/todoItems/375/relationships/collection",
"related": "http://localhost:1479/api/v1/todoItems/375/collection"
}
},
"dependentOnTodo": {
"links": {
"self": "http://localhost:1479/api/v1/todoItems/375/relationships/dependentOnTodo",
"related": "http://localhost:1479/api/v1/todoItems/375/dependentOnTodo"
}
},
"parentTodo": {
"links": {
"self": "http://localhost:1479/api/v1/todoItems/375/relationships/parentTodo",
"related": "http://localhost:1479/api/v1/todoItems/375/parentTodo"
}
},
"childrenTodos": {
"links": {
"self": "http://localhost:1479/api/v1/todoItems/375/relationships/childrenTodos",
"related": "http://localhost:1479/api/v1/todoItems/375/childrenTodos"
}
}
},
"links": {
"self": "http://localhost:1479/api/v1/todoItems/375"
}
}
}
Note how data.relationships.owner.data
has been set to null
in the second response.
Metadata
Metadata
Assignees
Labels
No labels