https://geohub.lacity.org/data.json
---------------------------------------------------------------------------------------
https://community.esri.com/thread/226451-arcgis-open-data-api
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:
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:
- ‘data.json’ – returns a list of the first 1,000 datasets of an installation. This API is necessary to extract at least one dataset ID to be use in next request.
- ‘/api/v2/datasets/{:id}’ – returns further details about a dataset where it is possible to access the standardized field ‘Owner’ necessary to make next request.
- ‘/api/v2/datasets’ – returns all the datasets to a given ‘Owner’ of an installation as well as the nested attribute ‘meta.stats.totalCount’ in the resulting JSON dictionary which finally specifies the number of existing datasets.
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.
No comments:
Post a Comment