You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: graph/patterns/navigation-property.md
+12-7Lines changed: 12 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,13 +9,9 @@ Microsoft Graph API Design Pattern
9
9
10
10
It is often valuable to represent a relationship between resources in an API. This may be a many-to-one or a one-to-many relationship.
11
11
12
-
Relationships between resources are often implicitly represented by a property contained in one of the resources that identifies the other related resource. Usually that information returned in a representation as an id value and the property is named using a convention that identifies the target type of related resource. e.g. userId
12
+
Relationships between resources are often implicitly represented by a property contained in one of the resources that provides a key to a related resource. Usually that information is returned in a representation as an id value and the property is named using a convention that identifies the target type of related resource. e.g. userId
13
13
14
-
In many-to-one relationships, for a client to access the related resource it must request the primary resource, read the id value of the related resource and then construct a URL to the related resource using the Id value and knowledge of how the property name maps to the related resource. This requires at least two round trips and requires the client know how to construct the URL to the related resource.
15
-
16
-
For both many-to-one and one-to-many relationships in order to retrieve information from both resources on both sides of the relationship requires at minimum two requests.
17
-
18
-
Requiring two round trips to access this information is inefficient for some applications and the lack of a formally described relationship limits the ability for tooling to take advantage of the relationship to improve developer experience.
14
+
The use of foreign key properties to describe related resources is a weakly typed mechanism and requires additional information for a developer to traverse the relationship. Discovery of related resources is not trivial.
19
15
20
16
## Solution
21
17
--------
@@ -32,7 +28,7 @@ Additionally, using the OData Expand query parameter, related entities can be tr
32
28
33
29
In the current Microsoft Graph implementation, support for navigation properties is limited to entities within the same backend service or the user entity.
34
30
35
-
Navigation properties defined within an entity are not returned when retreiving the representation of an entity.
31
+
Navigation properties defined within an entity are not returned when retreiving the representation of an entity unless explicity desired by a service.
36
32
37
33
Implementing support for accessing the "$ref" of a navigation property allows a caller to return just the URL of related resource. e.g. `/user/23/manager/$ref`. This is useful when a client wishes to identity the related resource but doesn't need all of its properties.
38
34
@@ -51,6 +47,8 @@ Resources that contain a parent Id property in a child resource can utilize a na
0 commit comments