SWORD API variable $DATAVERSE_ALIAS ????

21 views
Skip to first unread message

Sherry Lake

unread,
Oct 10, 2017, 5:43:39 PM10/10/17
to Dataverse Users Community
This should be an easy answer, but I have yet to find it on any of the API pages.

What is $DATAVERSE_ALIAS?

as seen on this curl command:

curl -u $API_TOKEN: --data-binary "@path/to/atom-entry-study.xml" -H "Content-Type: application/atom+xml" https://$HOSTNAME/dvn/api/data-deposit/v1.1/swordv2/collection/dataverse/$DATAVERSE_ALIAS


I've "dumped" my dataverses/dataset but I cannot find an "alias" for my dataverses. The only "alias" I found in the API guides was ":root" for the root dataverse (assuming that is an alias). 

Can I substitute the dataverse ID for the alias? or is the ID THE alias?

Thanks.
Sherry




Philip Durbin

unread,
Oct 10, 2017, 6:43:15 PM10/10/17
to dataverse...@googlegroups.com
Whoops, early on in Dataverse 4 development it was called "alias" but now it's called "identifier": http://guides.dataverse.org/en/4.8/user/dataverse-management.html#create-a-dataverse-within-the-root-dataverse

For https://dataverse.lib.virginia.edu/dataverse/uva-law the alias is "uva-law".

I hope this helps. Please feel free to open an issue to fix this in the API Guide!

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/dataverse-community/7bc91400-2236-4ec0-98a5-2abb0f3b332d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Sherry Lake

unread,
Oct 11, 2017, 9:13:48 AM10/11/17
to Dataverse Users Community
Phil,

Can you be a little clearer?

When I dumped the json from this curl command:

For dataverses, I get these "keys": type, id, title 
So you mean "id" (which is a number) and not identifier? Doesn't seem that "alias" is something the API knows about?

And the same command gives me (for datasets), id & identifier, so on the dataset commands, means the "id" and NOT "identifier"?

OR does the SWORD API use different parameters & how would I get those?

Right now I am figuring out how the commands work, then I am going to use them to create a dataset and upload files (in batch) via API.

If anyone has working "python" code to do this, I will be thrilled, but will still be testing out the capabilities as to figure out what is going on - getting my geek on.

Thanks.
Sherry

On Tuesday, October 10, 2017 at 6:43:15 PM UTC-4, Philip Durbin wrote:
Whoops, early on in Dataverse 4 development it was called "alias" but now it's called "identifier": http://guides.dataverse.org/en/4.8/user/dataverse-management.html#create-a-dataverse-within-the-root-dataverse

For https://dataverse.lib.virginia.edu/dataverse/uva-law the alias is "uva-law".

I hope this helps. Please feel free to open an issue to fix this in the API Guide!

Phil
On Tue, Oct 10, 2017 at 5:43 PM, Sherry Lake <shla...@gmail.com> wrote:
This should be an easy answer, but I have yet to find it on any of the API pages.

What is $DATAVERSE_ALIAS?

as seen on this curl command:

curl -u $API_TOKEN: --data-binary "@path/to/atom-entry-study.xml" -H "Content-Type: application/atom+xml" https://$HOSTNAME/dvn/api/data-deposit/v1.1/swordv2/collection/dataverse/$DATAVERSE_ALIAS


I've "dumped" my dataverses/dataset but I cannot find an "alias" for my dataverses. The only "alias" I found in the API guides was ":root" for the root dataverse (assuming that is an alias). 

Can I substitute the dataverse ID for the alias? or is the ID THE alias?

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

Philip Durbin

unread,
Oct 11, 2017, 9:53:10 AM10/11/17
to dataverse...@googlegroups.com
Sure, let me give you a more concrete example[1] that is exercised constantly by API tests against the phoenix[2] server.

curl --insecure --data-binary @scripts/search/tests/data/dataset-trees1.xml -H 'Content-Type: application/atom+xml' -u $SPRUCEKEY: https://localhost:8181/dvn/api/data-deposit/v1.1/swordv2/collection/dataverse/spruce

In this case the dataverse alias/identifier is "spruce" which also appears at the end of the URL for the dataverse like this: http://phoenix.dataverse.org/dataverse/spruce

Usually, we use the term "id" to mean a database primary key or entity id. For example, the dataverse id for the root dataverse is almost certainly always "1" because it's the first dataverse/dvobject created. There's a difference between the SWORD and native APIs in that SWORD only lets you operate on a dataverse alias/identifier such as "root" or "spruce" while the native API allows you to also operate on a dataverse id such as "1" or "42".

If you're looking to use the Dataverse API via Python, you might want to try https://github.com/IQSS/dataverse-client-python but please understand that its maintained by the community. I would love for the Pythonistas out there to collaborate and I'm happy to give more people "push" access to that repo! There's also https://github.com/astrofrog/pyverse by the way.

I tend to use Bash and Java for my testing. Please see my "create-all-and-test"[1] script for Bash examples using curl and "UtilIT.java"[3] for examples in Java using REST Assured.

I hope this helps. Please keep the questions coming and I'm glad to hear you're getting your geek on. :)

Phil

1. From https://github.com/IQSS/dataverse/blob/v4.8.1/scripts/search/tests/create-all-and-test
2. http://guides.dataverse.org/en/4.8/developers/testing.html#the-phoenix-server
3. https://github.com/IQSS/dataverse/blob/v4.8.1/src/test/java/edu/harvard/iq/dataverse/api/UtilIT.java

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

--
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.

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