Dear
I'm looking for a simple way to get the total number of datasets of an instance under *.opendata.arcgis.com.
The only way I found till now is to call data.json and then iterate through all its results/pages, e.g. https://alcaldiadeguarne-guarne.opendata.arcgis.com/data.json where there are 40 datasets.
I was wondering if could call e.g. api/v2/datasets and provide a filter with a parameter URL like this
https://alcaldiadeguarne-guarne.opendata.arcgis.com/api/v2/datasets?filter[url]=any(alcaldiadeguarne-guarne)
Can you help me on this?
Thanks.
Hi Andreiwid,
You can return total datasets by a given source by filtering on the source field and looking at the aggregation values at the bottom of the json document. For example, if you call https://opendata.arcgis.com/api/v2/datasets?filter[source]=Municipio%20de%20Guarne and collapse the data field, you should see something like this:
The docCount aggregation field is what I think you're after, but let me know if I'm on the wrong track.
Best,
Patrick
Hi Patrick!
Thank you for you attention and answer.
Let me expand a lit bit more my needs just to see if you can supply me an extra help.
What I'm doing is automatically get the total number of datasets of many ArcGIS Open Data instances/installations. I only know beforehand the customer's domain (what comes before *.opendata.arcgis.com). So I can't go manually to each customer's instance/installation to check 'owner' attribute. So it came to my mind to rely on the customer ID (I think what comes before *.opendata.arcgis.com) to be a filter choice. I realized that the example I gave before (filter[url]) was not a good choice, as URL attribute doesn't see to be consistent across different instances/installations according to customer ID.
In sum, is there a way to return all datasets of an instance/installation given only the customer ID (what comes before *.opendata.arcgis.com)?
Thank you,
Hi!
After testing a lot of possibilities, I ended up making a sequence of 3 APIs in order to get the number of datasets of a given installation:
My experiments reported the API sequence 1 returns an empty dataset array for some installations. If you are curious about that, see https://data-brookhavenga.opendata.arcgis.com/data.json and https://data-eastlongmeadow.opendata.arcgis.com/data.json.
Did you miss type /api/v2/datasets, missing something
is it /api/v2/datasets/owner/{owner-id}?????