curl issue with native API #4510
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
Milestone
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.
The text was updated successfully, but these errors were encountered: