Data can be grouped by a field:
/api/[entity]?group=[field]
Multiple fields can be specified as well:
/api/[entity]?group=[field],[field2]
Response
When grouping, the default Response Data field is changed into a group response type:
The following is a JSON format of the response:
{
Success: bool,
ErrorMessage: string,
Data: {
Data: <Group>{
field: string,
items: Array<object> or <Group>,
value: variable,
hasSubgroups: boolean,
aggregates
},
Count: int
}
}
Example
The following example is in javascript, using jQuery:
function getData(){
$.ajax({
type: "GET",
url: 'https://[subdomain].manageworkonline.com/awt/api/[entity]?group=[field]',
crossDomain: true,
xhrFields: { withCredentials: true },
success: function(response){
if(response.Success){
alert(response.Data.Data.items.length
+ " out of " + response.Data.Count
+ " items returned");
} else {
alert(response.ErrorMessage);
}
},
dataType: "json"
});
}
For further information view Entities
Post your comment on this topic.