Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

curl issue with native API #4510

Closed
kaitlinnewson opened this issue Mar 15, 2018 · 2 comments · Fixed by KimJinYeon/dataverse#1 or #9654
Closed

curl issue with native API #4510

kaitlinnewson opened this issue Mar 15, 2018 · 2 comments · Fixed by KimJinYeon/dataverse#1 or #9654
Labels
Feature: API Guide good first issue appears at https://github.com/IQSS/dataverse/contribute Hackathon: Low Hanging Fruit hacktoberfest It's Hacktoberfest! https://groups.google.com/g/dataverse-community/c/n_Nn_T2yA-w/m/BcoXO4tEAQAJ Help Wanted: Documentation Mentor: pdurbin User Role: API User Makes use of APIs
Projects
Milestone

Comments

@kaitlinnewson
Copy link
Contributor

kaitlinnewson commented Mar 15, 2018

Hi Dataverse team,

I wanted to let you know about an issue we ran into using the Native API today. It appears to be an issue with certain versions of curl, in this case curl version 7.56.1. It seems to be related to this issue: curl/curl#2022. The person running the commands was using Windows & Git bash. Our Dataverse instance is version 4.7.1.

Running the data upload command resulted in the following error:
Warning: garbage at end of field specification: ,"categories":["Data"]}

We eventually figured out that to get around this, you have to replace the second F flag (before the JSON) with --form-string instead, resulting in a command like this:

curl -H "X-Dataverse-key:$API_TOKEN" -X POST -F 'file=@data.tsv' --from-string 'jsonData={"description":"My description.","categories":["Data"]}' "https://example.dataverse.edu/api/datasets/:persistentId/add?persistentId=$PERSISTENT_ID"

I thought you might like to know in case anyone else runs into this. It may be useful to have in the docs somewhere too.

@pdurbin
Copy link
Member

pdurbin commented Mar 15, 2018

Huh. Interesting. Thanks for the bug report and the fix, @kaitlinnewson !

@pdurbin pdurbin added this to To do for pkiraly in pdurbin Sep 20, 2019
@pdurbin pdurbin added Hackathon: Low Hanging Fruit hacktoberfest It's Hacktoberfest! https://groups.google.com/g/dataverse-community/c/n_Nn_T2yA-w/m/BcoXO4tEAQAJ labels Sep 30, 2022
@pdurbin
Copy link
Member

pdurbin commented Mar 12, 2023

I'm thinking we should simply add a note at the bottom of https://guides.dataverse.org/en/latest/api/getting-started.html#curl-examples-and-environment-variables

Something like:

"With curl version 7.56.1 and below, for commands with -F 'jsonData=... you might need to use --from-string 'jsonData=... instead: curl/curl#2022 "

For how to edit that page in the API Guide: https://guides.dataverse.org/en/latest/developers/documentation.html#quick-fix

@pdurbin pdurbin added the good first issue appears at https://github.com/IQSS/dataverse/contribute label Mar 12, 2023
KimJinYeon added a commit to KimJinYeon/dataverse that referenced this issue Jun 19, 2023
What this PR does / why we need it:
Add information about problem with curl -F option without outer quote for curl 7.56.0 and higher versions. IQSS#4510
Which issue(s) this PR closes:
IQSS#4510
Special notes for your reviewer:
None.
Suggestions on how to test this:
None.
Does this PR introduce a user interface change? If mockups are available, please link/include them here:
No.
Is there a release notes update needed for this change?:
No.
Additional documentation:
KimJinYeon added a commit to KimJinYeon/dataverse that referenced this issue Jun 19, 2023
add information about curl -F option without outer quote IQSS#4510
kcondon added a commit that referenced this issue Jun 23, 2023
add information about curl -F option without outer quote #4510
@pdurbin pdurbin added this to the 5.14 milestone Jul 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature: API Guide good first issue appears at https://github.com/IQSS/dataverse/contribute Hackathon: Low Hanging Fruit hacktoberfest It's Hacktoberfest! https://groups.google.com/g/dataverse-community/c/n_Nn_T2yA-w/m/BcoXO4tEAQAJ Help Wanted: Documentation Mentor: pdurbin User Role: API User Makes use of APIs
Projects
2 participants