exclude

To exclude specific properties from a response body, use the exclude request parameter. The exclude parameter is available in API version 27.0 and later.

The value for the exclude query is a list of properties separated by bars (|). You must URL encode the bars as %7C. You must include a forward slash before each property name.

The following request excludes both the aboutMe and address properties from a response body:
1/chatter/users/me?exclude=/aboutMe%7C/address

The following table lists rules for using the exclude query parameter, as well as additional examples.

Description Original Output Exclude Value Filtered Output
Include a forward slash (/) before property names or the request returns an error.
1{
2 "bar" : "bar value",
3 "baz" : "baz value"
4}
exclude=bar 400 error with error code INVALID_FILTER_VALUE
Filter properties by name.
1{
2 "bar" : "bar value",
3 "baz" : "baz value"
4}
exclude=/bar
1{
2 "baz" : "baz 
3value"
4}
Top-level properties cannot be filtered. Note that this query string doesn’t return an error.
1<foo>
2 <bar>bar value</bar>
3 <baz>baz value</baz>
4</foo>
exclude=/foo
1<foo>
2 <bar>bar value
3 </bar>
4 <baz>baz value
5 </baz>
6</foo>
Use a bar (|) delimiter to filter multiple properties. URL encode the delimiter as %7C.
1{
2 "foo" : "foo value",
3 "bar" : "bar value",
4 "baz" : "baz value"
5}
exclude=/foo%7C/bar
1{
2 "baz" : "baz 
3value"
4}
Filtering a response body filters everything in the response body.
1<foo>
2 <bar>bar value</bar>
3 <baz>baz value</baz>
4 <someObject>
5   <sub>sub 1</sub>
6 </someObject>
7</foo>
exclude=/someObject
1<foo>
2 <bar>bar value
3</bar>
4 <baz>baz value
5 </baz>
6</foo>
To filter a property nested in a response body, include the parent response body name as a filter segment.
1<foo>
2 <bar>bar value</bar>
3 <baz>baz value</baz>
4 <someObject>
5   <sub>sub value</sub>
6  </someObject>
7</foo>
exclude=/someObject/sub
1<foo>
2 <bar>bar value
3 </bar>
4 <baz>baz value
5 </baz>
6 <someObject>
7 </someObject>
8</foo>
Identify an item in a list by its property name. This example uses XML.
1<foo>
2 <bar>bar valu</bar>
3 <baz>baz value</baz>
4 <someList>
5   <item>
6     <id>1</id>
7   </item>
8   <item>
9     <id>2</id>
10   </item>
11   <item>
12     <id>3</id>
13   </item>
14 </someList>
15</foo>
exclude=/someList/item/id
1<foo>
2 <bar>bar value
3 </bar>
4 <baz>baz value
5 </baz>
6 <someList>
7   <item/>
8   <item/>
9   <item/>
10 </someList>
11</foo>
Identify an item in a list by its property name. This example uses JSON.
1{
2 "bar" : "bar value",
3 "baz" : "baz value",
4 "someList" : [
5   {
6     "id" : "1"
7   },
8   {
9     "id" : "2"
10   } ,
11   {
12     "id" : "3"
13   } 
14 ]
15}
exclude=/someList/item/id
1{
2 "bar" : "bar value",
3 "baz" : "baz value",
4 "someList" : [
5   {},
6   {},
7   {}
8 ]
9}