Skip to content

Commit 649062b

Browse files
committed
added report example
1 parent 73aca77 commit 649062b

File tree

1 file changed

+43
-3
lines changed

1 file changed

+43
-3
lines changed

graph/patterns/operations.md

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ To address these use cases, API designers can use operational resources such as
1414

1515
## When to use this pattern
1616

17-
The operations pattern is well suited to use cases that cannot be modeled as a single HTTP method on a resource and require either multiple round trips to complete a single logical operation or produce one or multiple side effects.
18-
1917
The operation pattern might be justified when a modeling operation represents one or combination of the following:
2018

2119
- a change of a resource (i.e., increment the value of a property) rather than a state (i.e., the final value of the property)
@@ -27,7 +25,7 @@ You can consider related patterns such as [long running operations](./long-runni
2725

2826
## Issues and considerations
2927

30-
- Microsoft Graph does NOT support unbound actions or functions. Bound actions and functions are invoked on resources matching the type of the binding parameter. The binding parameter can be of any type, and parameter value MAY be Nullable. For Microsoft Graph, actions and functions must have the `isBound="true"` attribute. The first parameter is the binding parameter.
28+
- Microsoft Graph does NOT support unbound actions or functions. Bound actions and functions MUST must have the `isBound="true"` attribute and a binding parameter. Bound operations are invoked on resources matching the type of the binding parameter.The first parameter of a bound operation is always the binding parameter.The binding parameter can be of any type, and parameter value MAY be Nullable.
3129

3230
- Both actions and functions support overloading, meaning a schema might contain multiple actions or functions with the same name. The overload rules as per the OData [standard](http://docs.oasis-open.org/odata/odata-csdl-xml/v4.01/odata-csdl-xml-v4.01.html#sec_FunctionOverloads) apply when adding parameters to actions and functions.
3331

@@ -106,3 +104,45 @@ HTTP/1.1 200 OK
106104
<ReturnType Type="Collection(graph.userActivity)" />
107105
</Function>
108106
```
107+
### Get a report that provides the number of active users using Microsoft Edge
108+
109+
```
110+
https://graph.microsoft.com/beta/reports/getBrowserUserCounts(period='D7')
111+
```
112+
113+
Response:
114+
115+
```
116+
HTTP/1.1 200 OK
117+
Content-Type: application/json
118+
Content-Length: 205
119+
120+
{
121+
"value":[
122+
{
123+
"reportRefreshDate":"2021-04-17",
124+
"reportPeriod":7,
125+
"userCounts":[
126+
{
127+
"reportDate":"2021-04-17",
128+
"edge":413
129+
},
130+
{
131+
"reportDate":"2021-04-16",
132+
"edge":883
133+
}
134+
]
135+
}
136+
]
137+
}
138+
```
139+
140+
`getBrowserUserCounts` operation doesn't change any server data and is a good fit for a function.`period` operation parameter convey a restricted set of options representing the number of days over which the report is aggregated. The report supports only 7,30,90, or 180 days. In addition the function doesn't return a Graph resource but streams response data in JSON or CSV formats.
141+
142+
```
143+
<Function Name="getBrowserUserCounts" IsBound="true" ags:OwnerService="Microsoft.O365Reporting">
144+
<Parameter Name="reportRoot" Type="graph.reportRoot" />
145+
<Parameter Name="period" Type="Edm.String" Nullable="false" Unicode="false" />
146+
<ReturnType Type="Edm.Stream" Nullable="false" />
147+
</Function>
148+
```

0 commit comments

Comments
 (0)