Accessing meta data on Zenodo#

In this notebook we see how to access meta data of records on zenodo.org

import requests
import json

For this, we write a little helper function.

def read_zenodo(record):
    """
    Reads meta data from records on zenodo.org and returns them as json object.
    The record can be a link ()
    """
    import requests
    import json

    record = record.replace("https://zenodo.org/", "")
    url = "https://zenodo.org/api/" + record
    
    # Download the file
    response = requests.get(url)
    data = response.json()
    return data

We can then call the function and store the results in a data object.

data = read_zenodo("https://zenodo.org/records/3490058")

data
{'created': '2019-10-15T07:35:56.339355+00:00',
 'modified': '2020-01-20T17:07:16.366704+00:00',
 'id': 3490058,
 'conceptrecid': '3490057',
 'doi': '10.5281/zenodo.3490058',
 'conceptdoi': '10.5281/zenodo.3490057',
 'doi_url': 'https://doi.org/10.5281/zenodo.3490058',
 'metadata': {'title': 'Efficiently starting institutional research data management',
  'doi': '10.5281/zenodo.3490058',
  'publication_date': '2019-10-15',
  'description': '<p>Researchers are increasingly often confronted with research data management (RDM) topics during their work. Higher education institutions therefore begin to offer services for RDM at some point to give support and advice. However, many groundbreaking decisions have to be made at the very beginning of RDM services. Priorities must be set and policies formulated. Likewise, the staff must first be qualified in order to provide advice and adequately deal with the manifold problems awaiting.<br>\nThe FDMentor project has therefore bundled the expertise of five German universities with different experiences and levels of RDM knowledge to jointly develop strategies, roadmaps, guidelines, and open access training material. Humboldt-Universit&auml;t zu Berlin, Freie Universit&auml;t Berlin, Technische Universit&auml;t Berlin, University of Potsdam, and European University Viadrina Frankfurt (Oder) have worked together on common solutions that are easy to adapt. With funding of the German Federal Ministry of Education and Research, the collaborative project addressed four problem areas: strategy development, legal issues, policy development, and competence enhancement. The aim of the project outcomes is to provide other higher education institutions with the best possible support for the efficient introduction of research data management. Therefore, all project results are freely accessible under the CC-BY 4.0 international license. The early involvement of the community in the form of workshops and the collection of feedback has proven its worth: the FDMentor strategies, roadmaps, guidelines, and training materials are applied and adapted beyond the partner universities.</p>',
  'access_right': 'open',
  'creators': [{'name': 'Biernacka, Katarzyna',
    'affiliation': 'Humboldt-Universität zu Berlin',
    'orcid': '0000-0002-6363-0064'},
   {'name': 'Cortez, Katrin', 'affiliation': 'Humboldt-Universität zu Berlin'},
   {'name': 'Helbig, Kerstin',
    'affiliation': 'Humboldt-Universität zu Berlin',
    'orcid': '0000-0002-2775-6751'}],
  'version': '1.0',
  'language': 'eng',
  'resource_type': {'title': 'Poster', 'type': 'poster'},
  'meeting': {'title': 'RDA 14th Plenary - Data Makes the Difference',
   'dates': '23-25 October 2019',
   'place': 'Helsinki, Finland',
   'url': 'https://www.rd-alliance.org/rda-14th-plenary-helsinki-espoo'},
  'license': {'id': 'cc-by-4.0'},
  'communities': [{'id': 'fdmentor'}],
  'relations': {'version': [{'index': 0,
     'is_last': True,
     'parent': {'pid_type': 'recid', 'pid_value': '3490057'}}]},
  'notes': 'This work was funded by the German Federal Ministry of Education and Research (FKZ 16FDM010) and presented at the RDA Plenary 2019 in Helsinki, Finland.'},
 'title': 'Efficiently starting institutional research data management',
 'links': {'self': 'https://zenodo.org/api/records/3490058',
  'self_html': 'https://zenodo.org/records/3490058',
  'self_doi': 'https://zenodo.org/doi/10.5281/zenodo.3490058',
  'doi': 'https://doi.org/10.5281/zenodo.3490058',
  'parent': 'https://zenodo.org/api/records/3490057',
  'parent_html': 'https://zenodo.org/records/3490057',
  'parent_doi': 'https://zenodo.org/doi/10.5281/zenodo.3490057',
  'self_iiif_manifest': 'https://zenodo.org/api/iiif/record:3490058/manifest',
  'self_iiif_sequence': 'https://zenodo.org/api/iiif/record:3490058/sequence/default',
  'files': 'https://zenodo.org/api/records/3490058/files',
  'media_files': 'https://zenodo.org/api/records/3490058/media-files',
  'archive': 'https://zenodo.org/api/records/3490058/files-archive',
  'archive_media': 'https://zenodo.org/api/records/3490058/media-files-archive',
  'latest': 'https://zenodo.org/api/records/3490058/versions/latest',
  'latest_html': 'https://zenodo.org/records/3490058/latest',
  'draft': 'https://zenodo.org/api/records/3490058/draft',
  'versions': 'https://zenodo.org/api/records/3490058/versions',
  'access_links': 'https://zenodo.org/api/records/3490058/access/links',
  'access_users': 'https://zenodo.org/api/records/3490058/access/users',
  'access_request': 'https://zenodo.org/api/records/3490058/access/request',
  'access': 'https://zenodo.org/api/records/3490058/access',
  'reserve_doi': 'https://zenodo.org/api/records/3490058/draft/pids/doi',
  'communities': 'https://zenodo.org/api/records/3490058/communities',
  'communities-suggestions': 'https://zenodo.org/api/records/3490058/communities-suggestions',
  'requests': 'https://zenodo.org/api/records/3490058/requests'},
 'updated': '2020-01-20T17:07:16.366704+00:00',
 'recid': '3490058',
 'revision': 5,
 'files': [{'id': 'b6d0b3e8-895b-4934-a8cd-1f1748b5a0ae',
   'key': 'Poster-Efficiently-starting-institutional-RDM.pdf',
   'size': 433244,
   'checksum': 'md5:a1399249c4b1368107959c5cc897ae2d',
   'links': {'self': 'https://zenodo.org/api/records/3490058/files/Poster-Efficiently-starting-institutional-RDM.pdf/content'}}],
 'owners': [{'id': 18826}],
 'status': 'published',
 'stats': {'downloads': 95,
  'unique_downloads': 89,
  'views': 158,
  'unique_views': 142,
  'version_downloads': 93,
  'version_unique_downloads': 87,
  'version_unique_views': 137,
  'version_views': 153},
 'state': 'done',
 'submitted': True}

This json object consists of Python dictionaries and lists. We can navigate through those and extract information.

data['status']
'published'
data['metadata']['language']
'eng'
data['files']
[{'id': 'b6d0b3e8-895b-4934-a8cd-1f1748b5a0ae',
  'key': 'Poster-Efficiently-starting-institutional-RDM.pdf',
  'size': 433244,
  'checksum': 'md5:a1399249c4b1368107959c5cc897ae2d',
  'links': {'self': 'https://zenodo.org/api/records/3490058/files/Poster-Efficiently-starting-institutional-RDM.pdf/content'}}]
[f['key'] for f in data['files']]
['Poster-Efficiently-starting-institutional-RDM.pdf']

Exercises#

Print out the list of author names of the record above.

Print out the place of the meeting where the slides were presented.

Print out how often the record was viewed and downloaded.