I am trying to search for a certain layer but it returns null this is the code i am using, i even tried outside_org= True but it still didn't work.
@JayantaPoddar @DanPatterson @DavidPike @jcarlson @DanLee @JoshuaBixby @Scott_Harris @TomBole
Solved! Go to Solution.
The REST documentation is a good place to look. Here's the page for items and item types for reference. Is that what you're asking?
If you want to get more information about the content in your portal, you can try something like this:
[f'{i.id} | {i.title[:32]:32} | {i.type}' for i in gis.content.search('', max_items=-1)]
This will return a "table" of items as text. If you identify the desired item in the list, you can then use
gis.content.get('some-itemID')
to get that item specifically.
To get a true table, you can also use the advanced_search function combined with the pandas module.
import pandas as pd
pd.DataFrame(gis.content.advanced_search('omaha', max_items=-1, as_dict=True)['results'])
This returns a DataFrame of the items and all of their details. The DataFrame itself can interacted with further to filter, sort, etc.
Can you try searching without specifying item_type? Also, does searching for other items return anything? Or a search for an empty string?
You've posted in the ArcGIS Pro Community; are you doing this in a Notebook in Pro?
It's hard to know if it's simply that your search is too specific, or if something else is going on.
PS - Don't forget about the "code sample" button on here! Helps make code-based questions more readable.
My search was too specific when i removed the item type it gave me results but not exactly what i am looking for, is there is a way to know more about all available content.
The REST documentation is a good place to look. Here's the page for items and item types for reference. Is that what you're asking?
If you want to get more information about the content in your portal, you can try something like this:
[f'{i.id} | {i.title[:32]:32} | {i.type}' for i in gis.content.search('', max_items=-1)]
This will return a "table" of items as text. If you identify the desired item in the list, you can then use
gis.content.get('some-itemID')
to get that item specifically.
To get a true table, you can also use the advanced_search function combined with the pandas module.
import pandas as pd
pd.DataFrame(gis.content.advanced_search('omaha', max_items=-1, as_dict=True)['results'])
This returns a DataFrame of the items and all of their details. The DataFrame itself can interacted with further to filter, sort, etc.
Yes, that's exactly what i was asking for, thanks a lot for your help and effort.