Hello,
I'm using the Python API for arcgis and I'm trying to get information on all our items on arcgis online. However, when I use the gis.content.search() the sort_field option doesn't actually seem to sort the data no matter what I choose. I wrote a test to prove this, and sure enough when choosing to sort by numViews, an item with a lower view count comes before one with a higher view count in the array. Is is not supposed to work this way? Or did I do something wrong? My function looks like this:
def getData(url, username, password, itemType, sortType, numResults😞
#Send creds to ArcGIS
gis = GIS(url=url, username=username, password=password)
#Check if we want to search by item type or if we wanted all
if itemType.lower() == 'all':
return gis.content.search(query="", sort_field=sortType,
max_items=numResults)
return gis.content.search(query="", item_type=itemType, sort_field=sortType,
max_items=numResults)