Skip to content

Commit 0a5ad5e

Browse files
committed
Update examples with response info
1 parent 3928589 commit 0a5ad5e

File tree

1 file changed

+73
-5
lines changed

1 file changed

+73
-5
lines changed

graph/patterns/navigation-property.md

Lines changed: 73 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,56 +62,124 @@ One other use case is when child resources appear in a non-contained collection
6262

6363
```http
6464
GET /users/{id}/manager
65+
66+
200 OK
67+
Content-Type: application/json
68+
69+
{
70+
"@odata.type": "#microsoft.graph.user",
71+
"id": "6b3ee805-c449-46a8-aac8-8ff9cff5d213",
72+
"displayName": "Bob Boyce"
73+
}
6574
```
6675

6776
### Retrieving a reference to a related entity
6877

6978
```http
7079
GET /users/{id}/manager/$ref
80+
81+
200 OK
82+
Content-Type: application/json
83+
84+
{
85+
"@odata.id": "https://graph.microsoft.com/v1.0/directoryObjects/6b3ee805-c449-46a8-aac8-8ff9cff5d213/Microsoft.DirectoryServices.User"
86+
}
7187
```
88+
Note: Currently the base URL returned in $ref results are incorrect. In order to process these URLs the client will need to convert the URL to a Graph URL.
7289

7390
### Retrieving an entity with a related entity included
7491

7592
```http
76-
GET /users/{id}?expand=manager
93+
GET /users/{id}?select=id,displayName&expand=manager(select=id,displayName)
94+
95+
200 OK
96+
Content-Type: application/json
97+
98+
{
99+
"id": "3f057904-f936-4bf0-9fcc-c1e6f84289d8",
100+
"displayName": "Jim James",
101+
"manager": {
102+
"@odata.type": "#microsoft.graph.user",
103+
"id": "6b3ee805-c449-46a8-aac8-8ff9cff5d213",
104+
"displayName": "Bob Boyce"
105+
}
106+
}
77107
```
78108

79109
### Creating an entity with a reference to a related entity
80110

111+
Create a new user that references an existing manager
81112
```http
82113
POST /users/{id}
83114
Content-Type: application/json
84115
85116
{
86117
"displayName": "Bob",
87-
"manager@bind": "https://graph.microsoft.com/v1.0/users/{someGuid}"
118+
"manager@bind": "https://graph.microsoft.com/v1.0/users/{managerId}"
119+
}
120+
121+
201 Created
122+
```
123+
124+
Create a new user and the users manager and create a relationship between the two.
125+
126+
```http
127+
POST /users/{id}
128+
Content-Type: application/json
129+
130+
{
131+
"displayName": "Jim James",
132+
"manager": {
133+
"displayName": "Bob Boyce"
134+
}
88135
}
136+
137+
201 Created
89138
```
90139

91140
### Updating a related entity reference
141+
142+
Update the user entity to contain a relationship to an existing manager.
92143

93144
```http
94145
PATCH /users/{id}
95146
Content-Type: application/json
96147
97148
{
98149
"displayName": "Bob",
99-
"manager@bind": "https://graph.microsoft.com/v1.0/users/{someGuid}"
150+
"manager@bind": "https://graph.microsoft.com/v1.0/users/{managerId}"
100151
}
152+
153+
204 No Content
101154
```
102155

103-
 
156+
Create a relationship between the user and the existing manager.
157+
104158
```http
105159
PUT /users/{id}/manager/$ref
106160
Content-Type: application/json
107161
108162
{
109-
"@OData.Id": "https://graph.microsoft.com/v1.0/users/{someGuid}"
163+
"@OData.Id": "https://graph.microsoft.com/v1.0/users/{managerId}"
110164
}
165+
166+
204 No Content
111167
```
112168

113169
### Clear a related entity reference
170+
171+
Remove the relationship between the user and the manager.
114172

115173
```http
116174
DELETE /users/{id}/manager/$ref
175+
176+
204 No Content
177+
```
178+
179+
Delete the related entity.
180+
181+
```http
182+
DELETE /users/{id}/manager
183+
184+
204 No Content
117185
```

0 commit comments

Comments
 (0)