Skip to content

Latest commit

 

History

History
156 lines (132 loc) · 2.91 KB

QueryParameters.md

File metadata and controls

156 lines (132 loc) · 2.91 KB

Query Parameters

$SELECT

.select() can take a string property, an array of strings or you can pass in each value as a separate argument.

try{// Below three statements are sameletres1=awaitclient.api("/me/people").select("displayName").select("department").get();letres2=awaitclient.api("/me/people").select("displayName","department").get();letres3=awaitclient.api("/me/people").select(["displayName","department"]).get();}catch(error){throwerror;}

$EXPAND

.expand() can take a string property, an array of strings or you can pass in each value as a separate argument.

try{// Below three statements are sameletres1=awaitclient.api("/me/people").expand("manager").expand("directReports").get();letres2=awaitclient.api("/me/people").expand("manager","directReports").get();letres3=awaitclient.api("/me/people").expand(["manager","directReports"]).get();}catch(error){throwerror;}

$ORDERBY

.orderby() can take a string property, an array of strings or you can pass in each value as a separate argument.

try{// Below three statements are sameletres1=awaitclient.api("/me/messages").orderby("name").orderby("subject").get();letres2=awaitclient.api("/me/messages").orderby("name","subject").get();letres3=awaitclient.api("/me/messages").orderby(["name","subject"]).get();}catch(error){throwerror;}

$TOP

.top() can take only a number as a parameter. Calling it multiple times is not supported.

try{letres=awaitclient.api("/me/contacts").top(5).get();console.log(res);}catch(error){throwerror;}

$SKIP

.skip() can take only a number as a parameter. Calling it multiple times is not supported.

try{letres=awaitclient.api("/me/events").skip(10).get();console.log(res);}catch(error){throwerror;}

$COUNT

Set .count() to true to additionally return the number of objects in the collection.

try{letres=awaitclient.api("/me/calendars").count(true).get();console.log(res);}catch(error){throwerror;}

$FILTER

Pass a filter string to .filter() for filtering result collections. Calling filter multiple times will override previous filter strings.

try{letres=awaitclient.api("/users").filter("startswith(displayName, 'dicaprio')").get();console.log(res);}catch(error){throwerror;}

$SEARCH

Pass a search string to .search() to restrict the results of a request to match a search criterion. Calling search multiple times will override previous search strings.

try{letres=awaitclient.api("/me/people").search("dicaprio").get();console.log(res);}catch(error){throwerror;}
close