...
How you use an API can depend on your operating system, permissions on your local machine, and other tools you are familiar with. There are many ways that you can work with API, including using your built-it in command line interface, with programming languages like Python, or through applications for working with APIs like Postman.
...
Once you have an environment set up, a quick way to test if it is working correctly is with an API command like the following, which retrieves information about the a dataverse collection (in this case, the root dataverse collection on the demo site):
curl https://demodv.scholarsportal.info/api/dataverses/sp
After entering this command and pressing enter, you should see JSON-formatted data with details about the dataversecollection, like the description and the date it was created.
...
For API commands related to dataversescollections, you may need the ID of the dataversecollection. This is the identifier that is in the URL of your dataversecollection.
For example, for the UBC Dataverse collection, which is available from https://dataverse.scholarsportal.info/dataverse/ubc, the ID of the dataverse collection would be "ubc".
Some Common & Useful API Commands
...
- Find the dataset id (see above) for the dataset with the citation date you want to update using the persistent identifier from your dataset (DOI or Handle).
- Ensure that the date you want to change the citation date to is reflected in your metadata in a date field, e.g. in the deposit date field.
- Find the name of the field you want to use as the citation date, e.g. for the deposit date you would use the field name of 'dateOfDeposit', for production date, use "productionDate"
- https://demodv.scholarsportal.info/api/datasets/:persistentId/?persistentId=doi:10.5072/FK2/QLQNAP (In this example, we can see that the field is called 'dateOfDeposit' under the metadata blocks.
- Enter the following command, replacing the dataset ID, API key, and name of the metadata field being used to replace the citation date:
curl -X PUT "https://dataverse.scholarsportal.info/api/datasets/$datasetID/citationdate?key=$apiKey" --data "dateOfDeposit"
Get the size of a
...
collection
To get the size of a dataverse collection which you have admin access to, paste the following command in your web browser, replacing the API Token and the Dataverse ID (found in the URL of a dataversecollection):
https://dataverse.scholarsportal.info/api/dataverses/DATAVERSE_ID/storagesize?key=API_KEY
...