GET $select

The $select system query option allows clients to request a specific set of properties for each entity or complex type.

The $select query option is often used in conjunction with the $expand system query option, to define the extent of the resource graph to return ($expand) and then specify a subset of properties for each resource in the graph ($select).

Examples:

  • Account number and name of all accounts : http://host/odata/Accounts?$select=Number,Name

It is also possible to request all declared and dynamic structural properties using a star (*).

  • All structural properties of all products: http://host/odata/Accounts?$select=\\*

Example Code

var myHeaders = new Headers();

myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVc2VySW5mbyI6IntcIklkXCI6OTgxLFwiSWRlbnRpdHlJZFwiOlwiNjMyMzhhZTQtMzAyMC00NWI5LWEwODktOTE2ZTY4MDMyZTY3XCIsXCJVc2VyTmFtZVwiOlwiMF9URVNUX0NMSUVOVFwiLFwiRW1haWxcIjpcInRlc3RjbGllbnRAd2VhbHRodGVjaHMuY29tXCIsXCJGaXJzdE5hbWVcIjpcIlRlc3RcIixcIkxhc3ROYW1lXCI6XCJDbGllbnRcIixcIklzQ2xpZW50VXNlclwiOmZhbHNlfSIsIm5iZiI6MTY5NDcwMjU3OSwiZXhwIjoxOTI0OTIzNjAwLCJpc3MiOiJXZWFsdGhUZWNocyIsImF1ZCI6IkFQSVVzZXJzIn0.bNcP0ouNwtFoxrI7pYXw0WKiw0TN6w_R2-Ban5moo1A");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("https://api.wealthtechs.com/v2/odata/Accounts?$select=Number,Master,Name&$top=5", requestOptions)
  .then(response => response.json())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Example Response

{
    "@odata.context": "https://api.wealthtechs.com/v2/odata/$metadata#Accounts(Number,Master,Name)",
    "value": [
        {
            "Number": "X72843476R",
            "Master": "123456789",
            "Name": "Test Account Name"
        },
        {
            "Number": "Y41213443S",
            "Master": "123456789",
            "Name": "Test Account Name"
        },
        {
            "Number": "Z68397130T",
            "Master": "123456789",
            "Name": "Test Account Name"
        }
    ]
}