I'm attempting to query all of my organization's AGOL content that is a dashboard, within a single group (based on the group ID), and has a specified group category.
Here is a snippet from my code:
import arcgis
gis = arcgis.gis.GIS("https://www.arcgis.com", "username", "password")
dashboardItems = gis.content.search(query="group:groupID AND categories:'categoryName'",
item_type="Dashboard",max_items=9999)
I am not returning any dashboards with the query, though there are around 20 dashboards in the group that would meet the criteria. Think it's an issue with the syntax in the query, but I can't figure it out.
Are groupID and categoryName variables you've assigned earlier in your code? Doesn't make sense to pass them as strings if so
import arcgis
gis = arcgis.gis.GIS("https://www.arcgis.com", "username", "password")
dashboardItems = gis.content.search(query=f"group:{groupID} AND categories:'{categoryName}'",
item_type="Dashboard",max_items=9999)
I didn't assign groupID and categoryName as variables earlier in the code. Was trying to read them into the query as strings.
I did try your approach and assigned groupID and categoryName as variables and still not returning any results with the query unfortunately.
import arcgis
groupID = " " # string with group ID
categoryName = " " # string with category name
gis = arcgis.gis.GIS("https://www.arcgis.com", "username", "password")
dashboardItems = gis.content.search(query=f"group:{groupID} AND categories:'{categoryName}'",
item_type="Dashboard",max_items=9999)