Skip to content

Update native-api.rst#6580

Merged
kcondon merged 2 commits intoIQSS:developfrom
BPeuch:patch-2
Jan 27, 2020
Merged

Update native-api.rst#6580
kcondon merged 2 commits intoIQSS:developfrom
BPeuch:patch-2

Conversation

@BPeuch
Copy link
Contributor

@BPeuch BPeuch commented Jan 27, 2020

What this PR does / why we need it:
Quotation marks are necessary in this curl command, otherwise bash cannot parse the URLs properly (and the ampersand (&) in the first of the two paths especially confuses it).

Which issue(s) this PR closes:
Closes #6563

Quotation marks are necessary in this curl command, otherwise bash cannot parse the URLs properly (and the ampersand (&) in the first of the two paths confuses it).
@coveralls
Copy link

coveralls commented Jan 27, 2020

Coverage Status

Coverage remained the same at 19.496% when pulling 3835baa on BPeuch:patch-2 into 80c3bbe on IQSS:develop.

Copy link
Member

@pdurbin pdurbin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good (thanks, @BPeuch !). I did also add this commit: c54133c

@pdurbin
Copy link
Member

pdurbin commented Jan 27, 2020

Whoops! I meant to say that I added this commit: 3835baa

Time for coffee. ☕️

@BPeuch
Copy link
Contributor Author

BPeuch commented Jan 27, 2020

Thanks, @pdurbin!

@kcondon kcondon self-assigned this Jan 27, 2020
@kcondon kcondon merged commit 4f74e92 into IQSS:develop Jan 27, 2020
@landreev
Copy link
Contributor

What this PR does / why we need it:
Quotation marks are necessary in this curl command, otherwise bash cannot parse the URLs properly (and the ampersand (&) in the first of the two paths especially confuses it).

Which issue(s) this PR closes:
Closes #6563

@BPeuch
@pdurbin
I may be missing something, but this PR still doesn't make much sense to me. You are correct, yes, in that you can't have unquoted ampersands in URLs in shell commands. But in the actual changes you guys committed in this PR, there are NO ampersands in the URLs that you're putting the quotes around.
So no, you DON'T need the double quotes in this example (from the diff):

curl -H "X-Dataverse-key:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" -X POST "https://demo.dataverse.org/api/dataverses/root/datasets" --upload-file "dataset-finch1.json"

On the other hand, I'm still seeing some curl examples in that guide with un-quoted URLs that DO have ampersands in them... -?
Like this line, for example - which appears to be the line for which #6563 was originally opened - it looks like it hasn't been fixed:

curl -H X-Dataverse-key:$API_TOKEN -X POST $SERVER_URL/api/dataverses/$DV_ALIAS/datasets/:import?pid=$PERSISTENT_IDENTIFIER&release=yes --upload-file dataset.json

@BPeuch
Copy link
Contributor Author

BPeuch commented Jan 29, 2020

Hello, @landreev.

I am responsible for the confusion: I forgot to remove certain local variables from the example before posting it, and there happened to be an ampersand in one of them. I later erased the contents of the variables (it was especially problematic for the admin token) but forgot to update my message elsewhere. Sorry about that.

The general idea still is that certain characters might need escaping and the guidelines should specify that in case they pop up in a query.

@donsizemore
Copy link
Contributor

@landreev @BPeuch the "Datasets" section was next on my list of examples through which to stroll, but there are pending pull requests on the page.

@pdurbin
Copy link
Member

pdurbin commented Jan 29, 2020

Yeah, I also noticed that there are no & but I figured sending the message that it's often good to put URLs in quotes is probably a good thing. I think in the example @BPeuch or his colleague sent me, there were some extra query parameters and hence a & or two.

@djbrooke djbrooke added this to the 4.20 milestone Feb 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Guides - Missing quotation marks in curl command for creating dataset via API

7 participants