is the study id and file id same in the api ??

47 views
Skip to first unread message

Anubhav Garg

unread,
Apr 22, 2015, 6:23:04 AM4/22/15
to dataverse...@googlegroups.com


the study id mentioned in the and file id are the same ?
what we have to pass in, download ??

Philip Durbin

unread,
Apr 22, 2015, 7:23:29 AM4/22/15
to dataverse...@googlegroups.com
Study/dataset IDs and file IDs are not the same.

Mentioned in what?

It sounds like perhaps you are looking for the Data Access API at http://guides.dataverse.org/en/latest/api

Phil

On Wed, Apr 22, 2015 at 6:23 AM, Anubhav Garg <anubh...@gmail.com> wrote:


the study id mentioned in the and file id are the same ?
what we have to pass in, download ??

--
You received this message because you are subscribed to the Google Groups "Dataverse Users Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dataverse-commu...@googlegroups.com.
To post to this group, send email to dataverse...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dataverse-community/0ac7fd17-86de-444a-bbbd-2daa224c78c3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Anubhav Garg

unread,
Apr 22, 2015, 7:35:33 AM4/22/15
to dataverse...@googlegroups.com
Yes i was looking in dataset api.
What should we pass in download so that the file can be downloaded in dataset api ??
You received this message because you are subscribed to a topic in the Google Groups "Dataverse Users Community" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/dataverse-community/a5aZhFWmjo4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to dataverse-commu...@googlegroups.com.

To post to this group, send email to dataverse...@googlegroups.com.

Philip Durbin

unread,
Apr 22, 2015, 7:45:29 AM4/22/15
to dataverse...@googlegroups.com
First you would figure out the file id (i.e. 12), based on the dataset id (i.e. 10). Then you would would download it:

$ curl -s https://apitest.dataverse.org/api/datasets/10/versions/1.0?key=f365dd3b-82fd-4602-93f0-06fbf1e84a84 | jq .data.files
[
  {
    "description": "",
    "label": "trees.png",
    "version": 1,
    "datasetVersionId": 1,
    "datafile": {
      "id": 12,
      "name": "trees.png",
      "contentType": "image/png",
      "originalFormatLabel": "UNKNOWN",
      "md5": "0386269a5acb2c57b4eade587ff4db64"
    }
  }
]
$ curl -s https://apitest.dataverse.org/api/access/datafile/12?key=f365dd3b-82fd-4602-93f0-06fbf1e84a84 > trees.png



For more options, visit https://groups.google.com/d/optout.

Anubhav Garg

unread,
Apr 24, 2015, 9:33:24 AM4/24/15
to dataverse...@googlegroups.com
Hi Philip,
Thanks for your input.
My aim is to download a file on the basis of authorname and title.
Below are the steps how i am trying it
1./dvn/api/metadataSearchFields/
using this link i am getting fields on the basis of which i can get results
example output
<SearchableField>
<fieldName>title</fieldName>
<fieldDescription>title</fieldDescription>
</SearchableField>
2.then i am hitting /dvn/api/metadataSearch/title:test AND authorName:leonid link to get 
<MetadataSearchResults>
<searchQuery>title:test</searchQuery>
<searchHits>
<study ID="hdl:TEST/10007"/>
...
</searchHits>
</MetadataSearchResults>
 does this id 10007 here represent datasetid which you are referring?
3.dvn/api/download/9956
i am passing id i got in step 2 in above link but unable to download the file.

Can you please tell me step by step at where i am doing wrong and do i need to essentialy use curl?
link i am referring to : http://thedata.harvard.edu/guides/dataverse-api-main.html
also, i am new to curl. how should i execute curl commands?
Thanks,
Anubhav Garg

Anubhav Garg

unread,
Apr 24, 2015, 9:44:08 AM4/24/15
to dataverse...@googlegroups.com
I am trying to build my application in .NET using visual studio framework. would that be ok? 
Also, please check whether i am referring to correct api link because i can see another link http://guides.dataverse.org/en/latest/api/search.html?
Is this link of some other latest api? which one should i use?
Waiting for your reply. thanks in advance.

Philip Durbin

unread,
Apr 24, 2015, 10:15:33 AM4/24/15
to dataverse...@googlegroups.com
Yes! That new JSON-based Search API (new as of Dataverse 4.0) is the one to start with.

It is perfectly fine to use .Net to access Dataverse APIs. If you have any interest in creating a library that other .Net users can use we would be very happy to list it along side libraries for Python and R at http://guides.dataverse.org/en/latest/api/client-libraries.html

Your best bet is probably to first use the Search API to  find the dataset that matches the title or author like this:

$ curl -s "https://apitest.dataverse.org/api/search?key=6fbb494e-3846-4fd0-9955-2e13bbdd04b1&show_entity_ids=true&q=authorName:Spruce" | jq '.data.items[] | {authors, entity_id}'
{
  "entity_id": 10,
  "authors": [
    "Spruce, Sabrina"
  ]
}

Then you take the entity ID and use it to list file IDs as I showed before:

curl -s https://apitest.dataverse.org/api/datasets/10/versions/1.0?key=6fbb494e-3846-4fd0-9955-2e13bbdd04b1 | jq .data.files

Then you download the files based on their ID (i.e. 12):

curl "https://apitest.dataverse.org/api/access/datafile/12?key=6fbb494e-3846-4fd0-9955-2e13bbdd04b1"

I hope this helps! Now you've got me curious about what your project is about! :)

Phil


For more options, visit https://groups.google.com/d/optout.

Anubhav Garg

unread,
Apr 24, 2015, 11:59:11 AM4/24/15
to dataverse...@googlegroups.com


---------- Forwarded message ----------
From: Tanu Jain <tanuj...@gmail.com>
Date: Friday, 24 April 2015
Subject: [Dataverse-Users] is the study id and file id same in the api ??
To: Anubhav Garg <anubh...@gmail.com>


I am building a .net web application . How can I run curl commands there and get output in my application.
Surely I will add it to your git repo once it's complete.
And application is about user can search on the basis  of author name ,title etc and get the links of all the papers that he can download ..this is a simple one for you I am sure :)
Sent from my iPhone

On 24-Apr-2015, at 19:57, Anubhav Garg <anubh...@gmail.com> wrote:

Philip Durbin

unread,
Apr 24, 2015, 4:41:39 PM4/24/15
to dataverse...@googlegroups.com
Great! We'd be happy for any code or example apps. We list them at http://guides.dataverse.org/en/latest/api/apps.html

I know very little about .Net but from a search it seems like http://unirest.io/net.html or http://restsharp.org might be good for use with REST APIs.

Phil


For more options, visit https://groups.google.com/d/optout.

Anubhav Garg

unread,
Apr 24, 2015, 4:44:42 PM4/24/15
to dataverse...@googlegroups.com
Thankxx phil !
If i need any other help i will get back to you !!

Philip Durbin

unread,
Apr 24, 2015, 8:38:44 PM4/24/15
to dataverse...@googlegroups.com
Oh sure. I checked with someone who knows .Net and he said he'd at least heard of RestSharp. He also sent these links:

- WebClient Class (System.Net) - https://msdn.microsoft.com/en-us/library/system.net.webclient.aspx
- How to make a GET request by using Visual C# - https://support.microsoft.com/en-us/kb/307023

Hope this helps!


For more options, visit https://groups.google.com/d/optout.

Anubhav Garg

unread,
May 5, 2015, 8:01:53 AM5/5/15
to dataverse...@googlegroups.com
hey philip !!
can you please help me in generating a token key and please tell me about the library files for asp.net..

--
You received this message because you are subscribed to a topic in the Google Groups "Dataverse Users Community" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/dataverse-community/a5aZhFWmjo4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to dataverse-commu...@googlegroups.com.

To post to this group, send email to dataverse...@googlegroups.com.

Philip Durbin

unread,
May 5, 2015, 8:32:23 AM5/5/15
to dataverse...@googlegroups.com
We don't have an asp.net client library but we'd love someone to contribute code so we can list it at http://guides.dataverse.org/en/latest/api/client-libraries.html . You could open a GitHub issue suggesting that someone build one: https://github.com/IQSS/dataverse/blob/master/CONTRIBUTING.md


For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages