Community
Showing results for 
Search instead for 
Do you mean 
Reply

Order By for History endpoint neither sorts nor throws an exception

Copper Contributor
Posts: 42
Country: United States

Order By for History endpoint neither sorts nor throws an exception

I'm testing the GET endpoint History to return the top 5 histories, ordered by startTime.  I've tested sorting by different fields, but in every case, including sorting ascending or descending, the data returned is always the same in the same order.

 

The documentation states that if the feature isn't implemented, it'll throw an exception.  Since it neither works nor throws an exception, I'm hoping I'm missing something.  I'll include the code below.

$.ajax({
                    type: "GET",
                    url: window.location.origin + "/act.web.api/api/History?$orderBy=regarding desc&$top=5",
                    //url: window.location.origin + "/act.web.api/api/History?$filter=contains(regarding,'Check it')",
                    headers: {
                        "Authorization": "Bearer " + $("#display_token").html()
                    },
                    success: function (data) {
                        for (var i in data) {
                            var j = $("#cleared_activities_output").html();
                            $("#cleared_activities_output").html(j + "Regarding: " + data[i].regarding + "<br/>StartTime: " + data[i].startTime + "<br/>" + data[i].historyTypeID + "<br/>" + data[i].details + "<br/><br/>");
                        }
                    },
                    error: function (data) {
                        alert("Error: " + JSON.stringify(data));
                    }
                })
Employee
Posts: 236
Country: USA

Re: Order By for History endpoint neither sorts nor throws an exception

Hi,

 

Histories con't currently support sorting (just filtering), you can review current support for the OData link in the API documentation:

https://actforweb.actops.com/Act.Web.API/OData/index 

Copper Contributor
Posts: 42
Country: United States

Re: Order By for History endpoint neither sorts nor throws an exception

Thanks, Xavier.  Your link leads me to a 404 error; however, on closer inspection of my copy of the documentation, I do see that sorting is not supported for History.

 

On a related note, I'm trying to filter by the history type id, but I get an error.  It's generic, so I take it that filtering on historyTypeId isn't supported right now.  Can you confirm if that's correct or not?


Thanks,

bconner26