Skip to content

curl issue with native API #4510

@kaitlinnewson

Description

@kaitlinnewson

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions