Using the following API I could fetch dataverses:
export API_TOKEN=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
export SERVER_URL=https://demo.dataverse.org
export ROLE_IDS=6
export DVOBJECT_TYPES=Dataverse
export PUBLISHED_STATES=Unpublished
export PER_PAGE=10
curl -H "X-Dataverse-key:$API_TOKEN" "$SERVER_URL/api/mydata/retrieve?role_ids=$ROLE_IDS&dvobject_types=$DVOBJECT_TYPES&published_states=$PUBLISHED_STATES&per_page=$PER_PAGE"
However, I am curious if it is possible to say to this API that I need only those dataverses that the user is the Admin or Member of.
Also, Is it possible to say those dataverses that are Published or Unpublished or Draft?
Hmm, I'm looking at https://guides.dataverse.org/en/6.2/api/native-api.html#mydata
What if you pass ROLE_IDS=1 for Admin?
Philip Durbin said:
Hmm, I'm looking at https://guides.dataverse.org/en/6.2/api/native-api.html#mydata
What if you pass ROLE_IDS=1 for Admin?
That works, but I need to define more than just one role_id.
Hmm :thinking:
I looks like the API accepts a list: @QueryParam("role_ids") List<Long> roleIds
In a Java test we do this: ArrayList<Long> emptyRoleIdsList = new ArrayList<>();
I'm not sure how to do it with curl. Maybe try comma-separated?
Philip Durbin said:
I'm not sure how to do it with curl. Maybe try comma-separated?
I will check and let you know.
Mohsen Jafari said:
Philip Durbin said:
I'm not sure how to do it with curl. Maybe try comma-separated?
I will check and let you know.
Could you share the line of code in GitHub for this endpoint, please?
@Mohsen Jafari I think this is what you are asking for:
https://github.com/IQSS/dataverse/blob/2f6d3aafaf75cf7b23ae4a9fd7865fbe681841ae/src/main/java/edu/harvard/iq/dataverse/mydata/DataRetrieverAPI.java
Yes, thank you. This line is the entry point: https://github.com/IQSS/dataverse/blob/v6.2/src/main/java/edu/harvard/iq/dataverse/mydata/DataRetrieverAPI.java#L271
Thanks, @Philip Durbin I guess the link I have is the currently being worked on branch? You sent the branch for the current release 6.2? Still trying to understand github.......
@Sherry Lake ha. There's nothing wrong with your link. I just prefer putting version numbers (e.g. v6.2) in the URL when I can so it's clear which version we're talking about.
When you do a search on GitHub the results are always commits rather than versions. I'm not sure why.
I have those requests in my local history... http://localhost:8080/api/mydata/retrieve?dvobject_types=Dataset&role_ids=6&role_ids=34&published_states=In+Review&published_states=Published&published_states=Unpublished&published_states=Draft&selected_page=1
Oh! Duplicate them! Thanks!
Mohsen Jafari has marked this topic as resolved.
Mohsen Jafari has marked this topic as unresolved.
Should we add a note to the docs? Does anyone want to create an issue?
I think this way of sending params to the endpoint should be added to the existing documentation, so other people also know about it.
Right. Me too. Do you mind creating an issue?
Mohsen Jafari has marked this topic as resolved.
Thanks for creating this issue! Add more information to the documentation about how api/mydata/retrieve is called #10530
Last updated: Oct 30 2025 at 06:21 UTC