External tools - 'fileid' in JSON for a hello world example

Skip to first unread message


Apr 10, 2019, 12:01:03 PM4/10/19
to Dataverse Dev

I am planning to write some external tools to communicate with dataverse. I have been looking at the documentation on how to do that:

I don't understand how to use the 'fileid', which is defined as follows: "The Dataverse database ID of a file the external tool has been launched on."
Where do I get this ID from?

Let's assume I want to write a "Hello World" external tool that displays a message for every tabular file. What should I put in JSON under the 'fileid'?

Thanks a lot in advance for all the help.


James Myers

Apr 10, 2019, 12:13:54 PM4/10/19
to datave...@googlegroups.com


For all of the parameters available, what you’re setting up in the json is whether your tool gets that parameter and what it is called in the URL sent to run your tool. For example,

For the previewers at https://github.com/QualitativeDataRepository/dataverse-previewers, I have the following json (escaped for use in a curl command):

{ \"queryParameters\":[ {\"fileid\":\"{fileId}\"}, {\"siteUrl\":\"{siteUrl}\"}, {\"key\":\"{apiToken}\"}, {\"datasetid\":\"{datasetId}\"}, {\"datasetversion\":\"{datasetVersion}\"} ] }



This results in my tool being called with the URL: https://qualitativedatarepository.github.io/dataverse-previewers/previewers/ImagePreview.html?fileid=2231&siteUrl=https://dv.dev-aws.qdr.org&key=1c5ac34d-43a5-20c3-94cd-9f0af4f56ad12&datasetid=2228&datasetversion=:draft


The things to note are that the ‘fileId’ (how Dataverse names it) is sent to my tool as ‘fileid’ (lower case) and ‘apiToken’ is sent as ‘key’, etc.. This gives you some ability to map the Dataverse terms to ones your tool uses (although your tool is going to have to know the Dataverse API to retrieve the file or metadata anyway, so being able to rename the parameters you get sent is not that helpful).


FWIW: The new dataset and datasetversion options allow you to call the datasetversion API which will give you a json output of all the file metadata which includes things like the file names and  description (both of which can vary by dataset version) and creation date (new in the next version of Dataverse).


-- Jim

You received this message because you are subscribed to the Google Groups "Dataverse Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dataverse-de...@googlegroups.com.
To post to this group, send email to datave...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dataverse-dev/3d08538e-dee1-416c-8026-0637885075e9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

James Myers

Apr 10, 2019, 12:16:00 PM4/10/19
to datave...@googlegroups.com

I should add that apiTokens are sensitive and I have generated a useless one in the example below. One should not send real apiTokens in emails…

Tomasz Miksa

Apr 10, 2019, 12:38:47 PM4/10/19
to datave...@googlegroups.com

That was a quick and exhaustive response! Thanks a lot!


I was wrongly assuming the direction in which the parameters are passed. Now it makes sense.


Everything is clear now.



Reply all
Reply to author
0 new messages