Somewhere in conversation, I came across a json url which gives me the number of views on the particular item be it a webmap, app, kml.
Have lost it .Can someone point me out correctly?
Is it something that only an admin can do?
Each item in portal has a property "numViews":
Item—ArcGIS REST API: Users, groups, and content | ArcGIS for Developers
See an example using Python to get the items sorted by the number of views (at the bottom of the page):
Example: Update the URL of a service in a web map—Portal for ArcGIS (10.6) | ArcGIS Enterprise
I guess you will need to have access to the items to be able to retrieve the properties.
Using the ArcGIS API for Python you can do the following:
<SPAN class="keyword token">import</SPAN> arcgis <SPAN class="keyword token">from</SPAN> arcgis<SPAN class="punctuation token">.</SPAN>gis <SPAN class="keyword token">import</SPAN> GIS <SPAN class="comment token"># Org URL</SPAN> url <SPAN class="operator token">=</SPAN> <SPAN class="string token"><SPAN>"</SPAN><A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fnation.maps.arcgis.com" target="_blank">https://nation.maps.arcgis.com</A><SPAN>"</SPAN></SPAN> <SPAN class="comment token"># Make a connection to the portal</SPAN> gis <SPAN class="operator token">=</SPAN> GIS<SPAN class="punctuation token">(</SPAN>url<SPAN class="operator token">=</SPAN>url<SPAN class="punctuation token">)</SPAN> <SPAN class="comment token"># Item ID</SPAN> <SPAN class="comment token"># Using a public story map for this example</SPAN> <SPAN class="comment token"><SPAN># </SPAN><A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fnation.maps.arcgis.com%2Fapps%2FCascade%2Findex.html%3Fappid%3De4ae5b57cf9045288909a93cc31cde7c" target="_blank">https://nation.maps.arcgis.com/apps/Cascade/index.html?appid=e4ae5b57cf9045288909a93cc31cde7c</A></SPAN> item <SPAN class="operator token">=</SPAN> <SPAN class="string token">"e4ae5b57cf9045288909a93cc31cde7c"</SPAN> i <SPAN class="operator token">=</SPAN> gis<SPAN class="punctuation token">.</SPAN>content<SPAN class="punctuation token">.</SPAN>get<SPAN class="punctuation token">(</SPAN>item<SPAN class="punctuation token">)</SPAN> <SPAN class="keyword token">print</SPAN><SPAN class="punctuation token">(</SPAN>i<SPAN class="punctuation token">[</SPAN><SPAN class="string token">'numViews'</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
That's near to what I wanted. We have few items not worth running a script.
Can you give me the Url that returns me the number of items in html , json formats? You know something like <portal>.arcgis.com\sharing\rest\....\....\ where I can view the output
why do certain people come and just post in answers not even fully understanding the question? Everyone here isn't looking for APIs though it's a good medium
Anything you're looking at in the Portal home app is driven from an API...
Anyway, you can use the home app to find the number of views:
https://<portal>.<domain>.com/portal/home/item.html?id=<itemID>
Or users content within Sharing API that the home app is getting its information from:
https://<portal>.<domain>.com/portal/sharing/rest/content/users/<user>/items/<itemID>
Or by searching in the home app:
Or by searching in the Sharing API, which is what searching in the Sharing API is giving you:
Hi all,
is it possible to retrieve the numviews property filtered by user? I mean, is there any log where I could find the items viewed by a user?
Thanks in advance.
I found a bug/error in ESRI REST API, please fix the bug in code or update doc either way:
https://developers.arcgis.com/rest/users-groups-and-items/item.htm
the api reads:
https://<content-url>/items/<itemId>
also give example at bottom
https://www.arcgis.com/sharing/rest/content/items/10ba62fe50864339a8a3e0f18ca85506
You actually will NOT get any info by use above link format. Only a blank page
You must add
?f=json
by define format to get something
This is a working example:
https://www.arcgis.com/sharing/rest/content/items/a22e7905d67f4330bbec630eebd38419?f=json
esri staff, please fix the rest api code, by define 'f=json' format by default.
or update the rest api doc above, by put a NOTE: * remind user must append ?f=json at the url end
Adding f?=psjon will return an easier to read version. But if run within a script, I guess that doesn't matter as much.
Dear all,
Is there any workflow to reset the numviews property without connecting to the portal postgres database?
I cannot find the way to update the property in sharing/rest.
Best
Borja
Hello @BorjaParés_Fuente ,
I came across your comment and this is exactly one of the things I am currently trying to achieve! This was three years ago, but maybe you remember how you solved this? Thanks for any tip you might have.
Yes! I posted a solution on another reply in this thread.
サインインしたメンバーは投稿、更新のフォローなどができます。初めてですか?無料アカウントを登録してください。
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.