Skip to content

Commit 2489db9

Browse files
authored
Merge pull request #25981 from microsoftgraph/directoryAudits-complexFilter
Add example of complex type filtering - directoryAudits LIST
2 parents fba9367 + 5d297ab commit 2489db9

File tree

2 files changed

+155
-6
lines changed

2 files changed

+155
-6
lines changed

api-reference/beta/api/directoryaudit-list.md

Lines changed: 78 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,11 @@ Don't supply a request body for this method.
5252

5353
If successful, this method returns a `200 OK` response code and a collection of [directoryAudit](../resources/directoryaudit.md) objects in the response body.
5454

55-
## Example
55+
## Examples
5656

57-
### Request
57+
### Example 1: Retrieve the list of audit logs
58+
59+
#### Request
5860

5961
The following example shows a request.
6062

@@ -102,7 +104,7 @@ GET https://graph.microsoft.com/beta/auditLogs/directoryAudits
102104

103105
---
104106

105-
### Response
107+
#### Response
106108

107109
The following example shows the response.
108110

@@ -175,6 +177,79 @@ Content-type: application/json
175177
}
176178
```
177179

180+
### Example 2: Retrieve the list of audit logs with a filter on initiatedBy/user
181+
182+
#### Request
183+
184+
The following example shows a request.
185+
186+
<!-- {
187+
"blockType": "request",
188+
"name": "get_directoryaudits_filter_initiatedby"
189+
}-->
190+
191+
```http
192+
GET https://graph.microsoft.com/beta/auditLogs/directoryAudits?$filter=initiatedBy/user/id eq '00000000-0000-0000-0000-000000000000'
193+
```
194+
195+
#### Response
196+
197+
The following example shows the response.
198+
199+
>**Note:** The response object shown here might be shortened for readability.
200+
<!-- {
201+
"blockType": "response",
202+
"truncated": true,
203+
"@odata.type": "microsoft.graph.directoryAudit",
204+
} -->
205+
206+
```http
207+
HTTP/1.1 200 OK
208+
Content-type: application/json
209+
210+
{
211+
"@odata.context": "https://graph.microsoft.com/beta/$metadata#auditLogs/directoryAudits",
212+
"@microsoft.graph.tips": "Use $select to choose only the properties your app needs, as this can lead to performance improvements. For example: GET auditLogs/directoryAudits?$select=activityDateTime,activityDisplayName",
213+
"value": [
214+
{
215+
"id": "SSGM_b662f17a-4e4d-4e1c-9248-cdec180024b2_MCDC4_88453290",
216+
"category": "GroupManagement",
217+
"correlationId": "b662f17a-4e4d-4e1c-9248-cdec180024b2",
218+
"result": "success",
219+
"resultReason": "OK",
220+
"activityDisplayName": "GroupLifecyclePolicies_Get",
221+
"activityDateTime": "2024-12-27T10:01:19.5796748Z",
222+
"loggedByService": "Self-service Group Management",
223+
"operationType": "Update",
224+
"userAgent": null,
225+
"initiatedBy": {
226+
"app": null,
227+
"user": {
228+
"id": "00000000-0000-0000-0000-000000000000",
229+
"displayName": null,
230+
"userPrincipalName": null,
231+
"ipAddress": "10.0.0.0",
232+
"userType": null,
233+
"homeTenantId": null,
234+
"homeTenantName": null
235+
}
236+
},
237+
"targetResources": [
238+
{
239+
"id": "00000000-0000-0000-0000-000000000000",
240+
"displayName": null,
241+
"type": "N/A",
242+
"userPrincipalName": null,
243+
"groupType": null,
244+
"modifiedProperties": []
245+
}
246+
],
247+
"additionalDetails": []
248+
}
249+
]
250+
}
251+
```
252+
178253
<!-- uuid: 8fcb5dbc-d5aa-4681-8e31-b001d5168d79
179254
2015-10-25 14:57:30 UTC -->
180255
<!-- {

api-reference/v1.0/api/directoryaudit-list.md

Lines changed: 77 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,11 @@ Don't supply a request body for this method.
5151

5252
If successful, this method returns a `200 OK` response code and a collection of [directoryAudit](../resources/directoryaudit.md) objects in the response body.
5353

54-
## Example
54+
## Examples
5555

56-
### Request
56+
### Example 1: Retrieve the list of audit logs
57+
58+
#### Request
5759

5860
The following example shows a request.
5961

@@ -102,7 +104,7 @@ GET https://graph.microsoft.com/v1.0/auditLogs/directoryAudits
102104

103105
---
104106

105-
### Response
107+
#### Response
106108

107109
The following example shows the response.
108110

@@ -166,6 +168,78 @@ Content-type: application/json
166168
}
167169
```
168170

171+
### Example 2: Retrieve the list of audit logs with a filter on initiatedBy/user
172+
173+
#### Request
174+
175+
The following example shows a request.
176+
177+
<!-- {
178+
"blockType": "request",
179+
"name": "get_directoryaudits_filter_initiatedby"
180+
}-->
181+
182+
```http
183+
GET https://graph.microsoft.com/v1.0/auditLogs/directoryAudits?$filter=initiatedBy/user/id eq '00000000-0000-0000-0000-000000000000'
184+
```
185+
186+
#### Response
187+
188+
The following example shows the response.
189+
190+
>**Note:** The response object shown here might be shortened for readability.
191+
<!-- {
192+
"blockType": "response",
193+
"truncated": true,
194+
"@odata.type": "microsoft.graph.directoryAudit",
195+
} -->
196+
197+
```http
198+
HTTP/1.1 200 OK
199+
Content-type: application/json
200+
201+
{
202+
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#auditLogs/directoryAudits",
203+
"@microsoft.graph.tips": "Use $select to choose only the properties your app needs, as this can lead to performance improvements. For example: GET auditLogs/directoryAudits?$select=activityDateTime,activityDisplayName",
204+
"value": [
205+
{
206+
"id": "SSGM_b662f17a-4e4d-4e1c-9248-cdec180024b2_MCDC4_88453290",
207+
"category": "GroupManagement",
208+
"correlationId": "b662f17a-4e4d-4e1c-9248-cdec180024b2",
209+
"result": "success",
210+
"resultReason": "OK",
211+
"activityDisplayName": "GroupLifecyclePolicies_Get",
212+
"activityDateTime": "2024-12-27T10:01:19.5796748Z",
213+
"loggedByService": "Self-service Group Management",
214+
"operationType": "Update",
215+
"initiatedBy": {
216+
"app": null,
217+
"user": {
218+
"id": "00000000-0000-0000-0000-000000000000",
219+
"displayName": null,
220+
"userPrincipalName": null,
221+
"ipAddress": "10.0.0.0",
222+
"userType": null,
223+
"homeTenantId": null,
224+
"homeTenantName": null
225+
}
226+
},
227+
"targetResources": [
228+
{
229+
"id": "00000000-0000-0000-0000-000000000000",
230+
"displayName": null,
231+
"type": "N/A",
232+
"userPrincipalName": null,
233+
"groupType": null,
234+
"modifiedProperties": []
235+
}
236+
],
237+
"additionalDetails": []
238+
}
239+
]
240+
}
241+
```
242+
169243
<!-- uuid: 8fcb5dbc-d5aa-4681-8e31-b001d5168d79
170244
2015-10-25 14:57:30 UTC -->
171245
<!-- {

0 commit comments

Comments
 (0)