Native API and Harvard hosted Dataverse

84 views
Skip to first unread message

Jamie Jamison

unread,
Aug 4, 2021, 12:24:22 PM8/4/21
to Dataverse Users Community
For my local UCLA Dataverse I am able to use the Native API or pyDataverse to generate reports.   

 One of of our collections is still a sub-dataverse hosted on Harvard Dataverse. Using the same script to list DOIs I get an ' HTTPError: HTTP Error 403: Forbidden'.

Is use of the APIs blocked for hosted sub-dataverses?

Thank you,

Jamie Jamison
UCLA Dataverse

Julian Gautier

unread,
Aug 5, 2021, 11:55:46 AM8/5/21
to Dataverse Users Community
Hey Jamie,

If you're still seeing an error when you use the script, could you share APIs or endpoints being used by the script? Most of the API endpoints shouldn't be blocked as far as I know, especially the ones for just getting lists of DOIs in collections. I was just able to use some endpoints to get the DOIs of published datasets in https://dataverse.harvard.edu/dataverse/ssda_ucla .

Jamie Jamison

unread,
Aug 5, 2021, 2:29:23 PM8/5/21
to Dataverse Users Community
Hope this is a good example.   

What works at my local UCLA Dataverse:    https://dataverse.ucla.edu/api/search?q=*        
Same script but for our sub-dataverse at   https://dataverse.harvard.edu/dataverse/ssda_ucla:     https://dataverse.harvard.edu/dataverse/ssda_ucla/api/search?q=*

I'm attaching a screen graberror-jpg.JPGThank you,

Jamie

Julian Gautier

unread,
Aug 5, 2021, 5:02:49 PM8/5/21
to Dataverse Users Community
I think for all of the API endpoints, the "/api" always needs to come right after the base URL of the repository:  
https://dataverse.harvard.edu/api/search?q=*

Then what follows after "search?" are the parameters in the parameters table in the Search API guide page at https://guides.dataverse.org/en/5.5/api/search.html.

The "type" and "subtree" parameters can help narrow down the results to the items that are datasets (type=dataset) in the UCLA collection and any sub-collections (subtree=ssda_ucla):

Another option is using the "Dataverse contents" endpoint, especially if you don't want or need the DOIs of any datasets within the sub-collection of that ssda_ucla collection:
https://dataverse.harvard.edu/api/dataverses/ssda_ucla/contents gets you everything directly in the ssda_ucla collection, but not the 10 published datasets in the tutorials_and_resources collection.

Hope that helps! It's really interesting to think of the motivation for having the Search API, and perhaps all of the APIs, work the way you tried them (not sure if that's technically possible).

Jamie Jamison

unread,
Aug 5, 2021, 6:03:59 PM8/5/21
to Dataverse Users Community
That explanation clears up a lot.  Thank you!

Jamie

Reply all
Reply to author
Forward
0 new messages