MyData Contents via API

51 views
Skip to first unread message

Sherry Lake

unread,
Sep 4, 2018, 2:40:07 PM9/4/18
to Dataverse Users Community
I thought I posted this question before, but can't seem to find it.

Is there an API to get the underlying information displayed on the MyData Tab?

I found an "undocumented" API script for mydata, but can't seem to make it give me any results.

Should the above API still work? If not is there a "new undocumented" API for mydata?

Thanks.
Sherry

julian...@g.harvard.edu

unread,
Sep 4, 2018, 3:34:16 PM9/4/18
to Dataverse Users Community
Oh cool. I just removed everything after the quotation mark and it worked for me:

https://demo.dataverse.org/api/mydata/retrieve?key=$API_TOKEN&role_ids=1&dvobject_types=DataFile&published_states=Published&published_states=Unpublished&published_states=Draft&published_states=In+Review&published_states=Deaccessioned

Does that work?

Sherry Lake

unread,
Sep 4, 2018, 4:24:59 PM9/4/18
to dataverse...@googlegroups.com
Thank you Julian!!!

When I used your command on my demo.dataverse account I got:
 {"success":false,"error_message":"Sorry, nothing was found for this role: Admin"}

but that helped me figure things out
role_ids=1 is "Admin" (didn't know that)

So to get this to work for me, I kept changing the role_ids until I got a successful one: role_ids=6 ... is contributor. My successful command:


I also changed "dvobject_types=Dataset" which is what I really wanted to see.

Seems my main problem was not know what role_ids correspond to role names (or the alias). By testing the URL (and getting errors), I found:
1 = Admin
2 = FileDownloader
3 = Dataverse & DatasetCreator
4 = DataverseCreator
5 = DatasetCreator
6 = Contributor - which worked
7 = Curator
8 = Member
9 = Admin - no Publish
10 = Custom

Is that it for role_ids, are there any others?

Thanks again Julian!!

--
Sherry

--
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/4717ad02-ec04-41cc-a273-e59db569410f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

julian...@g.harvard.edu

unread,
Sep 4, 2018, 4:55:31 PM9/4/18
to dataverse...@googlegroups.com
You're welcome!

I think the roles and ids Dataverse ships with are:

 id |            name             

----+-----------------------------

  1 | Admin

  2 | File Downloader

  3 | Dataverse + Dataset Creator

  4 | Dataverse Creator

  5 | Dataset Creator

  6 | Contributor

  7 | Curator

  8 | Member


 On Demo Dataverse there are custom roles, too. This is what I get when I query the database (select id, name from dataverserole;)


 id |            name             

----+-----------------------------

  1 | Admin

  2 | File Downloader

  3 | Dataverse + Dataset Creator

  4 | Dataverse Creator

  5 | Dataset Creator

  6 | Contributor

  7 | Curator

  8 | Member

  9 | Admin - no Publish

 10 | Custom

 12 | zztop

 15 | zztop

 16 | Special

 17 | 1

 19 | Admin sans publish



I tried running the API as a curl command in my terminal and kept getting a message about needing to login and requiring authentication. Didn't try my password since it didn't seem safe, but I don't know. Maybe the API isn't meant to be used in certain ways or isn't ready, yet?

Pete Meyer

unread,
Sep 4, 2018, 5:09:09 PM9/4/18
to Dataverse Users Community


On Tuesday, September 4, 2018 at 4:55:31 PM UTC-4, julian...@g.harvard.edu wrote:
You're welcome!

I think the roles and ids Dataverse ships with are:

 id |            name             

----+-----------------------------

  1 | Admin

  2 | File Downloader

  3 | Dataverse + Dataset Creator

  4 | Dataverse Creator

  5 | Dataset Creator

  6 | Contributor

  7 | Curator

  8 | Member


 On Demo Dataverse there are custom roles, too. This is what I get when I query the database (select distinct on (id) id, name from dataverserole;)


 id |            name             

----+-----------------------------

  1 | Admin

  2 | File Downloader

  3 | Dataverse + Dataset Creator

  4 | Dataverse Creator

  5 | Dataset Creator

  6 | Contributor

  7 | Curator

  8 | Member

  9 | Admin - no Publish

 10 | Custom

 12 | zztop

 15 | zztop

 16 | Special

 17 | 1

 19 | Admin sans publish



I tried running the API as a curl command in my terminal and kept getting a message about needing to login and requiring authentication. Didn't try my password since it didn't seem safe, but I don't know. Maybe the API isn't meant to be used in certain ways or isn't ready, yet?


Most of the APIs (and it looks like this one as well) use a token rather than a password (that's what the `key=${API_TOKEN}` parameter is doing above).  It's also preferable to put the token in the `X-Dataverse-Key` header (with curl, `-H "X-Dataverse-Key: ${API_TOKEN}"`) rather than as a GET parameter (where it will should up in various access logs).

Sherry Lake

unread,
Sep 5, 2018, 1:16:47 PM9/5/18
to Dataverse Users Community
Thanks Pete,

I got it to work on the command w/ curl and the -H option.

Phil, is this truly undocumented, because it isn't in the API guides, OR undocumented because it is not supported?

It seems to work great and was hoping the Center for Open Science could use that for the OSF - Dataverse integration instead of going through EVERY dataverse to find EVERY dataset that person has permission for. The current interface (OSF-Dataverse AddOn) is really clunky because of the dataverse search to find datasets to test permissions..

--
Sherry

Philip Durbin

unread,
Sep 6, 2018, 3:33:01 PM9/6/18
to dataverse...@googlegroups.com
Hi Sherry,

I think you're right. the My Data API is truly undocumented. I can't find any docs for it anyway. I'm not sure if we really made a conscious decision not to support that API or if it was simply an oversight. From a quick look I don't believe this API is exercised by our API tests. My understanding is that the UI of My Data is built on top of this API so if it stops working we should notice. I'm sorry if this is a non-answer. If you're getting a lot of value out of this API, I'd suggest opening a GitHub value to have it be documented.

With regard to the OSF integration being broken and clunky, I agree with you. https://github.com/IQSS/dataverse/issues/2122 is what we're using to track this problem and my understanding is that the OSF team doesn't have the time/resources/capacity to rewrite the code on their end to use the My Data API so for that issue we're attempting to speed up the "contents" API (the one OSF uses) that does all the permission checking you're talking about. There's been some recent activity on that issue if you'd like to check it out. I appreciate the out of the box thinking! One can also list dataverses and datasets via SWORD, which is reasonably fast as far as I know.

I hope this helps rather than further muddying the waters. Good job on getting that API working!

Phil

p.s. I laughed out loud at "zztop" as a custom role and Steve and I were just rocking out to "Sharp Dressed Man."

--
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-community+unsub...@googlegroups.com.
To post to this group, send email to dataverse-community@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dataverse-community/c441e1ec-ac8d-42ac-8ad6-0abdf517646c%40googlegroups.com.

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

Sherry Lake

unread,
Sep 7, 2018, 2:46:15 PM9/7/18
to dataverse...@googlegroups.com
Hi Phil,

I brought up the MyData API in a conversation with COS on how to make the interface better (oh, and to get it working again, publish doesn't work now - I do not know how long it's been broken, must have been after Dataverse Community meeting because I think you & I both were "publishing" from OSF?).

Since I have started the Dataverse-OSF conversation (again), I am hoping there is traction this time. So you think they should wait on when the "contents" API is fixed & not pursue the MyData API?

A note on issue 2122: I have not had trouble getting the OSF-Dataverse to show "All" dataverses at Harvard, so am not sure what API they are using. Main problem with the OSF addon is the clunky way ALL dataverses (not in any order) are displayed. I assume I see them all; I don't get any error messages & it hasn't hung for me.

But to be clear, you are NOT saying that the MyData API shouldn't be used? Or, yes "don't use it" and wait for #2122?

And whey you say "opening a GitHub [issue] to have it be documented", you mean document the way to use the MyDataAPI and the parameters to the API guide (documented)?

Thanks, 
Sherry

Philip Durbin

unread,
Sep 7, 2018, 3:44:54 PM9/7/18
to dataverse...@googlegroups.com
It's so nice that COS is down the street from you. It's a bummer that when I visited them years ago you weren't running Dataverse yet or I would have stopped by UVa as well!

I myself am waiting for #2122 to work its way through the pipeline.

Let me put it this way. If some OSF developers are available to work on their side of the code, to make improvements in user experience or whatever, and want to chat with some Dataverse developers about APIs that are available in 2018, the normal channels such as this mailing list or http://chat.dataverse.org or sup...@dataverse.org are open. Whenever we talk about integrations OSF is mentioned and we want this integration to work well. Perhaps the best solutions is to wait for #2122. Perhaps other APIs could be tried. I'm not sure. We're happy to answer questions from any API users.

And yes when I was talking about opening a GitHub issue about the My Data API the scope of work would be something like this:

- Document in the API Guide how to use the My Data API.
- Write integration tests for the My Data API so that it is exercised regularly.

Something like that.

I hope this helps!

Phil

--
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-community+unsub...@googlegroups.com.
To post to this group, send email to dataverse-community@googlegroups.com.

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

Philip Durbin

unread,
Sep 10, 2018, 4:24:18 PM9/10/18
to dataverse...@googlegroups.com
Sherry, thanks for opening https://github.com/IQSS/dataverse/issues/5042 about documenting the My Data API.

To unsubscribe from this group and stop receiving emails from it, send an email to dataverse-community+unsubscribe...@googlegroups.com.

To post to this group, send email to dataverse-community@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages