Error create dataverse via API

82 views
Skip to first unread message

Uus Khusni

unread,
Jul 14, 2019, 11:18:23 PM7/14/19
to Dataverse Dev
 Hello Sir/Madame

 I am from Indonesia and newbie for dataverse, i try to create dataverse with Native Api from Codeigniter. I use dataverse-complete.json and not change anything on that file but when exec my app I always get error like this :
{"status":"ERROR","message":"Error parsing Json: Unexpected char 45 at (line no=1, column no=2, offset=1)"}.

This is my josn file content :
 
{
"name": "Scientific Research",
"alias": "science",
"dataverseContacts": [
{
"contactEmail": "p...@example.edu"
},
{
"contactEmail": "stu...@example.edu"
}
],
"affiliation": "Scientific Research University",
"description": "We do all the science.",
"dataverseType": "LABORATORY"
}


this is my url API dataverser : https://dev-rin1.lipi.go.id/api/dataverses/

Please help me. Thankfull

Philip Durbin

unread,
Jul 15, 2019, 10:11:15 AM7/15/19
to datave...@googlegroups.com
You seem to be suffering from https://github.com/IQSS/dataverse/issues/3533

That is to say, there's some confusion over how to create a Dataverse via API.

Does it work from curl?


curl -H "X-Dataverse-key:$API_TOKEN" -X POST $SERVER_URL/api/dataverses/$id --upload-file dataverse-complete.json

Please let me know.

Thanks,

Phil

--
You received this message because you are subscribed to the Google Groups "Dataverse Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dataverse-de...@googlegroups.com.
To post to this group, send email to datave...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dataverse-dev/c56377a7-53b9-4f81-84b6-828e464fb4b9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--

Uus Khusni

unread,
Jul 29, 2019, 10:10:38 PM7/29/19
to datave...@googlegroups.com
Dear Sir

I still got the same error. I try to call API from python and connect to demo dataverse. This my screenshot error.

gambar.png

Please help

James Myers

unread,
Jul 30, 2019, 10:01:33 AM7/30/19
to datave...@googlegroups.com

I haven’t used Python with Dataverse, but it looks to me like you are not sending the json file correctly. I think you could send the json directly, or search on the web for correct examples of how to load a file for a python post request.

 

The following might work:

 

data={

  "name": "Scientific Research",

  "alias": "science",

  "dataverseContacts": [

    {

      "contactEmail": "p...@example.edu"

    },

    {

      "contactEmail": "stu...@example.edu"

    }

  ],

  "affiliation": "Scientific Research University",

  "description": "We do all the science.",

  "dataverseType": "LABORATORY"

}

 

and

 

request.post(‘https://demo.dataverse.org/api/dataverses/root’, json=data, headers=headers )

 

Good luck,

 

-- Jim

Oliver Bertuch

unread,
Jul 31, 2019, 2:59:05 AM7/31/19
to Dataverse Dev
You also might think about using https://pypi.org/project/pyDataverse instead of crafting the requests manually.

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

--
You received this message because you are subscribed to the Google Groups "Dataverse Dev" group.

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

--
You received this message because you are subscribed to the Google Groups "Dataverse Dev" group.

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

Reply all
Reply to author
Forward
0 new messages