In order to have the data from the local data repository, you can do it in two ways: by downloading it directly (go to the resource) or by integrating against the repository.

In order to obtain the data of a particular dataset from the open data repository, integrating against the repository, the following steps must be followed:

Step 1: Get the name of the .csv document associated with the dataset on which we want to get the data:

Click the link "Available in open data" (in the image we see the name of the file highlighted in yellow)

faq_DO_1-1.png

Step 2: Obtain the identifier (resource_id) of the dataset: through a call to the package_show method, to which you will pass as a parameter the name of the .csv document where the data is, which you have just obtained in the previous step.

An example of a call: http://dadesobertes.seu-e.cat/api/action/package_show?id=iio-ii-dades-generals-ens

And here is the result you get (highlighting in yellow the name of the resource we will need to make the next call):

 {“help”: “ http://dadesobertes.seu-e.cat/api/3/action/help_show?name=package_show “, “success”: true, “result”: {“license_title”: “License not specified ”, “maintainer”: “”, “relationships_as_object”: [], “private”: false, “maintainer_email”: “”, “num_tags”: 0, “id”: “e6d3ad49-e651-4e14-9a12-6b9a8f29ac61” , “metadata_created”: “2015-10-22T16:19:54.362868”, “metadata_modified”: “2016-12-20T07:29:33.707001”, “author”: “”, “author_email”: “”, “state” : “active”, “version”: “”, “creator_user_id”: “0bcf446a-cdb5-454f-832d-bdbfa330e6bb”, “type”: “dataset”, “resources”: [{“cache_last_updated”: null, “package_id ”: “e6d3ad49-e651-4e14-9a12-6b9a8f29ac61”, “webstore_last_updated”: null, “data_actualitzacio”: “2016-12-20T07:29:33.654Z”, “datastore_active”: true, “id”: “ab53cbf3- a439-4f59-a2f5-658bee1994e5", "size": null, "filtre_ens": "", "state": "active", "hash": "", "description": "", "format": "CSV ”, “tracking_summary”: {“total”: 0, “recent”: 0}, “last_modified”: null, “url_type”: null, “mimetype”: null, “cache_url”: null, “name”: “Data generals of the entity”, “created”: “2015-10-22T18:20:18.279968”, “url”: “ http://dadesobertes.seu-e.cat/csv/iio-ii-dades-generals- ens.csv “, “webstore_url”: null, “mimetype_inner”: null, “position”: 0, “revision_id”: “2dc741dc-c98d-45b7-adbd-282e7eb4a638”, “resource_type”: null}], “num_resources” : 1, “tags”: [], “tracking_summary”: {“total”: 0, “recent”: 0}, “groups”: [{“display_name”: ” Institutional and organizational information”, “description”: “ Educational organization, personnel, entities and other bodies”, “image_display_url”: “ http://dadesortes.seu-e.cat//uploads/group/bank ”, “title”: “Institutional and organizational information”, “id” : “e15b2ad1-4bb5-4ff0-9ab9-6e73b809bcf8”, “name”: “1-informacio-institutional-i-organizativa”}], “license_id”: “notspecified”, “relationships_as_subject”: [], “organization”: {“description”: “”, “created”: “2015-11-11T16:44:11.030775”, “title”: “Consorci d’Administraciu00f3 Oberta de Catalunya”, “name”: “aoc”, “is_organization”: true, “state”: “active”, “image_url”: “ http://dadesobertes.dev.seu-e.cat/header-logo.png “, “revision_id”: “c9ebb9de-cae4-4282-864f-24ead9d254f1 ”, “type”: “organization”, “id”: “a26ffc54-d8b9-4d4a-bcad-e5cb5f00b518”, “approval_status”: “approved”}, “name”: “iio-ii-dades-generals-ens” , “isopen”: false, “url”: “Department of Government00f3 (Municat)”, “notes”: “”, “owner_org”: “a26ffc54-d8b9-4d4a-bcad-e5cb5f00b518”, “extras”: [], “title”: “General data of the entity”, “revision_id”: “00b43887-1e4c-4364-b096-d382df10b549”}}

Step 3: Call the datastore_search method, passing as a parameter the identifier obtained in point 2.

Call example: http://dadesobertes.seu-e.cat/api/action/datastore_search?resource_id=ab53cbf3-a439-4f59-a2f5-658bee1994e5

If you want to filter the data to obtain only those of an entity, you must add as a parameter the code_ine10 of the entity in question, with the format &filters={“CODE_ENS”%3A”<CODE_INE_10_ENS>”} .

So the call to obtain the data from the Manlleu City Council (INE code = 811200000) referring to the entity's General Data dataset would be as follows:

http://dadesobertes.seu-e.cat/api/action/datastore_search?resource_id=ab53cbf3-a439-4f59-a2f5-658bee1994e5&filters={%22CODI_ENS%22%3A%22811200000%22}

The result you will get will be the following:

 {“help”: “ http://dadesobertes.seu-e.cat/api/3/action/help_show?name=datastore_search “, “success”: true, “result”: {“resource_id”: “ab53cbf3-a439 -4f59-a2f5-658bee1994e5”, “fields”: [{“type”: “int4”, “id”: “_id”}, {“type”: “text”, “id”: “ADREu00c7A”}, { “type”: “text”, “id”: “MUNICIPALITY”}, {“type”: “text”, “id”: “TELu00c8FON”}, {“type”: “text”, “id”: “FAX ”}, {“type”: “text”, “id”: “CIF”}, {“type”: “text”, “id”: “COUNTY”}, {“type”: “numeric”, “id ”: “CODCOMARCA”}, {“type”: “text”, “id”: “PROVINCE”}, {“type”: “numeric”, “id”: “CODIPROV”}, {“type”: “text ”, “id”: “CAPICOM”}, {“type”: “numeric”, “id”: “ANY_CENS”}, {“type”: “numeric”, “id”: “CENS”}, {“type ”: “numeric”, “id”: “CODITIPUS”}, {“type”: “text”, “id”: “SUPERFICIE”}, {“type”: “text”, “id”: “ARTICLE”} , {“type”: “text”, “id”: “NOMTIPUS”}, {“type”: “numeric”, “id”: “POSTALCODE”}, {“type”: “text”, “id”: “SECRETARY”}, {“type”: “text”, “id”: “SCHEDULE”}, {“type”: “text”, “id”: “DISSOLVED”}, {“type”: “text”, “id”: “SIGLACOM”}, {“type”: “numeric”, “id”: “ALTURA”}, {“type”: “text”, “id”: “HD”}, {“type”: “text”, “id”: “NOM_CAPITAL”}, {“type”: “text”, “id”: “E_MAIL”}, {“type”: “text”, “id”: “WEB”}, { “type”: “text”, “id”: “PARTIT_JUDICIAL”}, {“type”: “text”, “id”: “PARTIT_ELECTORAL”}, {“type”: “text”, “id”: “GENTILICI ”}, {“type”: “text”, “id”: “LOCALITAT_CP”}, {“type”: “text”, “id”: “DELEGACIO_GOVERN”}, {“type”: “text”, “id ”: “MUNICAT”}, {“type”: “text”, “id”: “AMBIT”}, {“type”: “text”, “id”: “SITUA_GEO_MUNICIPI”}, {“type”: “text ”, “id”: “SITUA_GEO_COMARCA”}, {“type”: “text”, “id”: “PLANOL_CARRERS”}, {“type”: “text”, “id”: “SALUTACIO”}, {“type ”: “timestamp”, “id”: “DATA_ACTUALITZACIO”}, {“type”: “numeric”, “id”: “CODI_ENS”}, {“type”: “text”, “id”: “ORDENACIO_ALFABETICA”} , {“type”: “text”, “id”: “FULL_NOM”}], “records”: [{“SCOPE”: “Comarques Centrals”, “CIF”: “P0811100G”, “SITUA_GEO_MUNICIPI”: “ http: //hipermapa.ptop.gencat.cat/hipermapa/hipermapa2_cat.asp?NOM_FLASH=aea_high.swf&QUERY_LAYER=Municipis&QUERY=CODI_INE|LIKE|08112&FIT=True ", "NOMTIPUS": "Municipalities", "SITUA_GEO_COMARCA": " http:// hipermapa.ptop.gencat.cat/hipermapa/hipermapa2_cat.asp?NOM_FLASH=aea_high.swf&QUERY_LAYER=Comarques&QUERY=COMARCA|LIKE|24&FIT=True&FILTER=True ", "SECRETARY": "", "COMPLETE_NAME": "Ajuntament de Manlleu", “AREA”: “17.29”, “HD”: “H”, “ADREu00c7A”: “Pl. Fra Bernadu00ed, 6”, “CENSUS”: “20228”, “ORDENACIO_ALFABETICA”: “Manlleu”, “CODCOMARCA”: “8102490004”, “PARTIT_JUDICIAL”: “Vic”, “CODIPUS”: “2”, “PARTIT_ELECTORAL”: “Vic”, “COUNTY”: “Osona”, “ARTICLE”: ” “, “CENSUS_YEAR”: “2015”, “ALTURA”: “461”, “POSTAL CODE”: “8560”, “WEB”: “ http: //www.manlleu.cat “, “EN_CODE”: “811200000”, “PROVINCE”: “Barcelona”, “E_MAIL”: “ ajuntament@manlleu.cat “, “FAX”: “93-8507970”, “MUNICAT” : “ http://apploxis.municat.gencat.cat/index.php?page=consulta&mostraEns=0811200000 “, “DISSOLVED”: “N”, “CAPICOM”: “N”, “NAME_CAPITAL”: “Mallleu”, “ PLANOL_CARRERS": "http://mercuri.icc.cat/website/mob_nf/mob1/mob2/inici2.htm?&mun=081120", "TELu00c8FON": "93-8506666", "MUNICIPALITY": "Manlleu", " DELEGATION_GOVERN": "Catalunya Central", "SALUTACIO": "Dear Mayor", "GENTILICI": "manlleuencs", "DATE_ACTUALITZACIO": "2016-12-15T00:00:00", "LOCALITAT_CP": "Manlleu", " CODIPROV”: “8000840003”, “_id”: 444, “SIGLACOM”: “OS”, “HOURS”: “From Monday to Friday from 8.30 am to 2 pm.”}], “_links”: {“start”: “ /api/action/datastore_search?filters=%7B%22CODI_ENS%22%3A%22811200000%22%7D&resource_id=ab53cbf3-a439-4f59-a2f5-658bee1994e5”, “next”: “/api/action/datastore_search?offset=100&filters =%7B%22CODI_ENS%22%3A%22811200000%22%7D&resource_id=ab53cbf3-a439-4f59-a2f5-658bee1994e5”}, “filters”: {“CODE_ENS”: “811200000”}, “total”: 1}}

Note: usually the filter for us is done by the field CODI_ENS, but there are datasets such as for example the "dependent organizations" in which there are two fields: CODI_ENS_PARE and CODI_ENS_FILL.

The correct API call for this case would be:

http://dadesobertes.seu-e.cat/api/action/datastore_search?resource_id=a5773993-4992-4ec0-84e2-95d31ad8101c&filters={%22CODI_ENS_PARE%22:%221721680001%22}

To know the field that should be used to filter by us in a specific dataset, you need to make a previous call to another method of the API:

http://dadesobertes.seu-e.cat /api/action/package_show?id=iio-ii-organismes-dependents

In the "ens_filter" property, the field that must be used to filter by ens is indicated, CODI_ENS_PARE in this case, if the property is not indicated, it is necessary to filter by the CODI_ENS field.