Microsoft System Center Operations Manager - scom 2019 rest api - pagination and sorting

%3CLINGO-SUB%20id%3D%22lingo-sub-2173376%22%20slang%3D%22en-US%22%3EMicrosoft%20System%20Center%20Operations%20Manager%20-%20scom%202019%20rest%20api%20-%20pagination%20and%20sorting%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2173376%22%20slang%3D%22en-US%22%3E%3CP%3EI%20am%20usign%20SCOM%202019%20rest%20apis%20to%20fetch%20alerts%20from%20http%3A%2F%2Fscomhost%2F%3CSPAN%3EOperationsManager%2Fdata%2Falert.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIam%20forming%20the%20below%20query%20for%20SCOM%20rest%20api.%20How%20can%20I%20specify%20that%20the%20output%20data%20should%20be%20sorted%20on%20lastmodified%20time.%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%3CP%3EAnother%20question%20is%20how%20can%20specify%20to%20give%20top%20100%20results%20matching%20the%20query%20and%20get%20the%20remaining%20in%20next%20call.%20How%20can%20I%20implement%26nbsp%3B%20pagination%20with%20the%20query%20to%20get%20data%20in%20chunks.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECan%20someone%20please%20help%20me%20with%20this%3C%2FP%3E%3CPRE%3E%24Query%20%3CSPAN%3E%3D%20%40%3C%2FSPAN%3E(%3CSPAN%3E%40%3C%2FSPAN%3E%7B%20%3CSPAN%3E%22classId%22%20%3C%2FSPAN%3E%3CSPAN%3E%3D%20%3C%2FSPAN%3E%3CSPAN%3E%22%22%3CBR%20%2F%3E%3C%2FSPAN%3E%3CSPAN%3E%3CBR%20%2F%3E%3C%2FSPAN%3E%3CSPAN%3E%22criteria%22%20%3C%2FSPAN%3E%3CSPAN%3E%3D%20%20%3C%2FSPAN%3E%3CSPAN%3E%22%20(%20(LastModified%20%20%26gt%3B%20'%22%20%3C%2FSPAN%3E%3CSPAN%3E%2B%20%3C%2FSPAN%3E%24startTime%20%3CSPAN%3E%2B%3C%2FSPAN%3E%3CSPAN%3E%22'%20AND%20LastModified%20%20%26lt%3B%3D%20'%22%3C%2FSPAN%3E%3CSPAN%3E%2B%20%3C%2FSPAN%3E%24endTime%3CSPAN%3E%2B%20%3C%2FSPAN%3E%3CSPAN%3E%22'%20))%20%22%3CBR%20%2F%3E%3C%2FSPAN%3E%3CSPAN%3E%22displayColumns%22%20%3C%2FSPAN%3E%3CSPAN%3E%3D%20%3C%2FSPAN%3E%3CSPAN%3E%22id%22%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3CSPAN%3E%22description%22%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3CSPAN%3E%22context%22%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3CSPAN%3E%22monitoringclassid%22%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3CSPAN%3E%22monitoringobjectdisplayname%22%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3CSPAN%3E%22monitoringobjectfullname%22%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3CSPAN%3E%22monitoringobjectid%22%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3CSPAN%3E%22monitoringobjectname%22%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3CSPAN%3E%22monitoringobjectpath%22%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3CSPAN%3E%22severity%22%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3CSPAN%3E%22name%22%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3CSPAN%3E%22netbioscomputername%22%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3CSPAN%3E%22netbiosdomainname%22%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3CSPAN%3E%22principalname%22%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3CSPAN%3E%22priority%22%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3CSPAN%3E%22problemid%22%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3CSPAN%3E%22statelastmodified%22%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3CSPAN%3E%22age%22%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3CSPAN%3E%22repeatcount%22%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3CSPAN%3E%22timeadded%22%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3CSPAN%3E%22timeaddedutc%22%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3CSPAN%3E%22timeraised%22%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3CSPAN%3E%22timeresolved%22%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3CSPAN%3E%22lastmodified%22%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3CSPAN%3E%22lastmodifiedutc%22%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3CSPAN%3E%22ticketid%22%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3CSPAN%3E%22resolutionstate%22%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3CSPAN%3E%22customfield1%22%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3CSPAN%3E%22customfield2%22%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3CSPAN%3E%22customfield3%22%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3CSPAN%3E%22customfield4%22%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3CSPAN%3E%22customfield5%22%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3CSPAN%3E%22customfield6%22%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3CSPAN%3E%22customfield7%22%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3CSPAN%3E%22customfield8%22%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3CSPAN%3E%22customfield9%22%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3CSPAN%3E%22customfield10%22%3C%2FSPAN%3E%3CSPAN%3E%2C%20%3C%2FSPAN%3E%3CSPAN%3E%22owner%22%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3CSPAN%3E%22alertparams%22%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3CSPAN%3E%22ismonitoralert%22%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3CSPAN%3E%22metricname%22%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3CSPAN%3E%22metricdisplayname%22%3CBR%20%2F%3E%3C%2FSPAN%3E%7D)%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

I am usign SCOM 2019 rest apis to fetch alerts from http://scomhost/OperationsManager/data/alert.

 

Iam forming the below query for SCOM rest api. How can I specify that the output data should be sorted on lastmodified time.

Another question is how can specify to give top 100 results matching the query and get the remaining in next call. How can I implement  pagination with the query to get data in chunks.

 

Can someone please help me with this

$Query = @(@{ "classId" = ""

"criteria" = " ( (LastModified > '" + $startTime +"' AND LastModified <= '"+ $endTime+ "' )) "
"displayColumns" = "id","description","context","monitoringclassid","monitoringobjectdisplayname","monitoringobjectfullname","monitoringobjectid","monitoringobjectname","monitoringobjectpath","severity","name","netbioscomputername","netbiosdomainname","principalname","priority","problemid","statelastmodified","age","repeatcount","timeadded","timeaddedutc","timeraised","timeresolved","lastmodified","lastmodifiedutc","ticketid","resolutionstate","customfield1","customfield2","customfield3","customfield4","customfield5","customfield6","customfield7","customfield8","customfield9","customfield10", "owner","alertparams","ismonitoralert","metricname","metricdisplayname"
})

 

0 Replies