Para disponer de los datos del repositorio de datos locales, puedes hacerlo de dos formas: descargándolos directamente (ir al recurso) o bien, integrándose contra el repositorio.

Para poder obtener los datos de un dataset concreto del repositorio de datos abiertos, integrándose contra el repositorio, es necesario seguir los siguientes pasos:

Paso 1: Obtener el nombre del documento .csv asociado al dataset sobre el que queremos obtener los datos:

Hacer clic en el enlace “Disponible a datos abiertos” (en la imagen vemos destacado en amarillo el nombre del archivo)

faq_DO_1-1.png

Paso 2: Obtener el identificador (resource_id) del dataset: mediante una llamada al método package_show , al que pasarás como parámetro el nombre del documento .csv donde están los datos, que acabas de obtener en el paso anterior.

Un ejemplo de llamada: http://dadesobertes.seu-e.cat/api/action/package_show?id=iio-ii-dades-generals-ens

Y aquí el resultado que obtienes (destacando en amarillo el nombre del recurso que necesitaremos para realizar la siguiente llamada):

 {“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”: “ : “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, “fecha_actualización”: “2016-12-20T07:29:33.654Z”, “datastore_:db a439-4f59-a2f5-658bee1994e5”, “size”: null, “filtro_ens”: “”, “state”: “active”, “hash”: “”, “description”: “”, “formato”: “CSV ”, “tracking_summary”: {“total”: 0, “reciente”: 0}, “last_modified”: null, “url_type”: null, “mimetype”: null, “cache_url”: null, “name”: “Datos generales del ente”, “created”: “2015-10-22T18:20:18.279968”, “url”: “ http://dadesobertes.seu-e.cat/csv/iio-ii-dades-generals- ente.csv “, “webstore_url”: null, “mimetype_inner”: null, “position”: 0, “revision_id”: “2dc741dc-c98d-45b7-adbd-282e7eb4a638”, “resource_type”: null}], “ : 1, “tags”: [], “tracking_summary”: {“total”: 0, “reciente”: 0}, “groups”: [{“display_name”: ” Informaci00f3 institucional y organizativa”, “description”: “ Organizaciu00f3 polu00edtica, personal, entidades y otros organismos”, “image_display_url”: “ http://dadesobertes.seu-e.cat//uploads/group/bank “, “title”: ” Informaciu00f3 institucional y organizativa”, “id” : “e15b2ad1-4bb5-4ff0-9ab9-6e73b809bcf8”, “name”: “1-informacio-institucional-y-organizativa”}], “license_id”: “notspecified”, “relationships_as_subject”: [], “organization”: {“description”: “”, “created”: “2015-11-11T16:44:11.030775”, “title”: “Consorcio de Administraci00f3 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-datos-generals-ens” , “isopen”: false, “url”: “Departamento de Gobernación00f3 (Municado)”, “notas”: “”, “owner_org”: “a26ffc54-d8b9-4d4a-bcad-e5cb5f00b518”, “extras”: [], “title”: “Datos generales del ente”, “revision_id”: “00b43887-1e4c-4364-b096-d382df10b549”}}

Paso 3: Hacer una llamada al método datastore_search, pasando como parámetro el identificador obtenido en el punto 2.

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

En caso de que desees filtrar los datos para obtener sólo los de un ente, debes añadir como parámetro el código_ine10 del ente en cuestión, con el formato &filters={“CODI_ENS”%3A”<CODI_INE_10_ENS>”} .

De modo que el llamamiento para obtener los datos del Ayuntamiento de Manlleu (código INE = 811200000) referentes al dataset Datos general del ente sería el siguiente:

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

El resultado que obtendrás será el siguiente:

 {“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”: “texto”, “id”: “ADREu00c7A”}, { “type”: “texto”, “id”: “MUNICIPIO”}, {“type”: “texto”, “id”: “TELu00c8FON”}, {“type”: “texto”, “id”: “FAX }, {“type”: “texto”, “id”: “CIF”}, {“type”: “texto”, “id”: “COMARCA”}, {“type”: “numerico”, “id ”: “CODCOMARCA”}, {“type”: “texto”, “id”: “PROVINCIA”}, {“type”: “numérico”, “id”: “CODIPROV”}, {“type”: “texto ”, “id”: “CAPICOM”}, {“type”: “numerico”, “id”: “AÑO_CENSO”}, {“type”: “numeric”, “id”: “CENSO”}, {“type ”: “numeric”, “id”: “CODITIPO”}, {“type”: “texto”, “id”: “SUPERFICIE”}, {“type”: “texto”, “id”: “ARTÍCULO”} , {“type”: “texto”, “id”: “NOMTIPUSO”}, {“type”: “numérico”, “id”: “CODIPOSTAL”}, {“type”: “texto”, “id”: “SECRETARIO”}, {“type”: “texto”, “id”: “HORARIO”}, {“type”: “texto”, “id”: “DISUELTO”}, {“type”: “texto”, “id”: “SIGLACOM”}, {“type”: “numérico”, “id”: “ALTURA”}, {“type”: “texto”, “id”: “HD”}, {“type”: “texto”, “id”: “NOMBRE_CAPITAL”}, {“type”: “texto”, “id”: “E_MAIL”}, {“type”: “texto”, “id”: “WEB”}, { “type”: “texto”, “id”: “PARTID_JUDICIAL”}, {“type”: “texto”, “id”: “PARTID_ELECTORAL”}, {“type”: “texto”, “id”: “GENTILICIO }, {“type”: “texto”, “id”: “LOCALIDAD_CP”}, {“type”: “texto”, “id”: “DELEGACION_GOVIERNO”}, {“type”: “texto”, “id ”: “MUNICADO”}, {“type”: “texto”, “id”: “AMBITO”}, {“type”: “texto”, “id”: “SITUA_GEO_MUNICIPI”}, {“type”: “texto ”, “id”: “SITUA_GEO_COMARCA”}, {“type”: “texto”, “id”: “PLANOL_CALLES”}, {“type”: “texto”, “id”: “SALUDACION”}, {“type ”: “timestamp”, “id”: “FECHA_ACTUALIZACIÓN”}, {“type”: “numeric”, “id”: “CÓDIGO_ENS”}, {“type”: “texto”, “id”: “ORDENACION_ALFABETICA”} , {“type”: “texto”, “id”: “NOMBRE_COMPLERT”}], “recuerdos”: [{“AMBITO”: “Comarcas Centrales”, “CIF”: “P0811100G”, “SITUA_GEO_MUNICIPI”: “ http: //hipermapa.ptop.gencat.cat/hipermapa/hipermapa2_cat.asp?NOMBRE_FLASH=aea_high.swf&QUERY_LAYER=Municipios&QUERY=CODI_INE|LIKE|08112&FIT=True “, “NOMTIPUOS”: “ Municipios_: hipermapa.ptop.gencat.cat/hipermapa/hipermapa2_cat.asp?NOMBRE_FLASH=aea_high.swf&QUERY_LAYER=Comarcas&QUERY=COMARCA|LIKE|24&FIT=True&FILTER=True “, “MANO”, “SECRETARIO”: “”, “ “SUPERFICIE”: “17,29”, “HD”: “H”, “ADREu00c7A”: “Pl. Fra Bernadu00ed, 6”, “CENSO”: “20228”, “ORDENACIÓN_ALFABETICA”: “Manlleu”, “CODCOMARCA”: “8102490004”, “PARTID_JUDICIAL”: “Vic”, “CODITIPO”: “2”, “PARTIDO “Vic”, “COMARCA”: “Osona”, “ARTÍCULO”: ” “, “AÑO_CENSO”: “2015”, “ALTURA”: “461”, “CODIPOSTAL”: “8560”, “WEB”: “ http: //www.manlleu.cat ”, “CODI_ENS”: “811200000”, “PROVINCIA”: “Barcelona”, “E_MAIL”: “ ajuntament@manlleu.cat ”, “FAX”: “93-8507970”, “MUNICAT” : “ http://aplicacions.municat.gencat.cat/index.php?page=consulta&mostraEns=0811200000 “, “DISUELO”: “N”, “CAPICOM”: “N”, “NOMBRE_CAPITAL”: “Manlleu”, “ PLANOL_CARRERS”: “http://mercuri.icc.cat/website/mob_nf/mob1/mob2/inici2.htm?&mun=081120“, “TELu00c8FON”: “93-8506666”, “MUNICIPIO”: “Manlleu”, “ DELEGACION_GOVIERNO”: “Catalunya Central”, “SALUTACION”: “Querido alcalde”, “GENTILICIO”: “manlleuencs”, “FECHA_ACTUALIZACIÓN”: “2016-12-15T00:00:00”, “LOCALIDAD_CP”: “Manlleu CODIPROV”: “8000840003”, “_id”: 444, “SIGLACOM”: “OS”, “HORARIO”: “De lunes a viernes de 8.30ha 14 h.”}], “_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”}, “filteros”: {“CODI_ENS”: “8112

Nota: habitualmente el filtro por ente se hace por el campo CODI_ENS, pero existen datasets como por ejemplo el de organismos dependientes en el que hay dos campos: CODI_ENS_PARE y CODI_ENS_FILL.

La llamada correcta a la API por este caso sería la siguiente:

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

Para saber el campo que se debe utilizar para filtrar por ente en un dataset concreto es necesario hacer una llamada previa a otro método de la API:

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

En la propiedad “filtro_ente” viene indicado el campo que se debe utilizar para filtrar por ente, CODI_ENS_PARE en este caso, si la propiedad no viene indicada es necesario filtrar por el campo CODI_ENS.