Skip to content

Instantly share code, notes, and snippets.

@seignovert
Last active February 21, 2019 20:08
Show Gist options
  • Save seignovert/8e9aa0f7c0785ce6adab6e16a3b532f4 to your computer and use it in GitHub Desktop.
Save seignovert/8e9aa0f7c0785ce6adab6e16a3b532f4 to your computer and use it in GitHub Desktop.
[Zenodo] Add ORCID badge

Add ORCID badge to Zenodo publication

No longer required since Oct-2017. Now ORCID can be added directly under the Authors section of the metadata on the deposit web interface.

Create your personal access token

In order to access the API you need to create a personal token. To do that you need to:

  1. Go to Home > Account > Applications and + New token in the Personal access tokens section.
  2. Provide a name for the token to find it later
  3. Add Scopes deposit:actions and desposit:write
  4. Click Create
  5. Write down carefully the token which could not be retrieve later! (only the Scopes and the Name can be edited)
  6. Click the Save to save you token.

Find Zenodo deposition identification record

Go to your Upload section to have access to the list of your depositions id, or you can make a GET request directly on:

curl 'https://zenodo.org/api/deposit/depositions?access_token=<YOUR_PERSONAL_TOKEN>' > depositions.json

Retrieve metadata information

If you don't have created the depositions.json before you can get the metadata information with the following line:

curl 'https://zenodo.org/api/deposit/depositions/<YOUR_DEPOSITION_ID>?access_token=<YOUR_PERSONAL_TOKEN>' > deposition.json

Then remove all the tags except metadata object in the deposition you want to edit.

Add ORCID id

In the metadata object you should have a creators object with name and affiliation. You could the add orcid to the different creators, then your deposition.json file should looks like:

{
	"metadata": {
		...
		"creators": [
			{
				"name": "Last, First Mid.",
				"affiliation": "Laboratory 1",
				"orcid": "<ADD_YOUR_ORCID_HERE>"
			},
			{
				"name": "Last2, First2 Mid2.",
				"affiliation": "Laboratory 2"
			}
		],
		...
	}
}

Send the metadata back to Zenodo

The trick now is to put the deposit record into edit mode BEFORE sending the new metadata, send publish it.

curl -X POST 'https://zenodo.org/api/deposit/depositions/<YOUR_DEPOSITION_ID>/actions/edit?access_token=<YOUR_PERSONAL_TOKEN>'
curl -X PUT 'https://zenodo.org/api/deposit/depositions/<YOUR_DEPOSITION_ID>?access_token=<YOUR_PERSONAL_TOKEN>' -H "Content-Type: application/json" -d @deposition.json
curl -X POST 'https://zenodo.org/api/deposit/depositions/<YOUR_DEPOSITION_ID>/actions/publish?access_token=<YOUR_PERSONAL_TOKEN>'

And you should know see your badge in: https://zenodo.org/record/<YOUR_DEPOSITION_ID>.

Sources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment