-
Notifications
You must be signed in to change notification settings - Fork 493
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
API Guide should provide more examples of required JSON payload #3859
Comments
@shaw2thefloor hi! I assume you meant to include another Here's an example JSON file I use in integration tests: Here's where I use it: I hope this helps. That error is a bit surprising so maybe you found a bug. Also, I'm realizing that http://guides.dataverse.org/en/4.6.1/api/index.html doesn't say how to get help but this is certainly on topic at https://groups.google.com/forum/#!forum/dataverse-community and you're also welcome to email support@dataverse.org . Please let me know if the JSON file above helps. Thanks! |
Hi @pdurbin. Thanks for the response. The json fragment you linked to which you use in your tests doesn't contain the problem field. Like I said at the bottom of my original post, I pretty sure its the relatedMaterial section causing the error. Also relatedDataset causes the same error. Without those fields, it works fine, however, my users will probably want to use most if not all of the Dublincore spec, so its necessary for all the fields to be submittable. Are you able to run your test with the following json fragment to see if you can reproduce the error on your side? Thanks, {
"datasetVersion": {
"metadataBlocks": {
"citation": {
"fields": [
{
"value": "Darwin's Finches",
"typeClass": "primitive",
"multiple": false,
"typeName": "title"
},
{
"value": [
{
"authorName": {
"value": "Finch, Fiona",
"typeClass": "primitive",
"multiple": false,
"typeName": "authorName"
},
"authorAffiliation": {
"value": "Birds Inc.",
"typeClass": "primitive",
"multiple": false,
"typeName": "authorAffiliation"
}
}
],
"typeClass": "compound",
"multiple": true,
"typeName": "author"
},
{
"value": [
{ "datasetContactEmail" : {
"typeClass": "primitive",
"multiple": false,
"typeName": "datasetContactEmail",
"value" : "finch@mailinator.com"
}
}],
"typeClass": "compound",
"multiple": true,
"typeName": "datasetContact"
},
{
"value": [ {
"dsDescriptionValue":{
"value": "Darwin's finches (also known as the Galápagos finches) are a group of about fifteen species of passerine birds.",
"multiple":false,
"typeClass": "primitive",
"typeName": "dsDescriptionValue"
}}],
"typeClass": "compound",
"multiple": true,
"typeName": "dsDescription"
},
{
"value": [
"Medicine, Health and Life Sciences"
],
"typeClass": "controlledVocabulary",
"multiple": true,
"typeName": "subject"
},
{
"typeName": "relatedMaterial",
"typeClass": "primitive",
"multiple": true,
"value": "abc"
}
],
"displayName": "Citation Metadata"
}
}
}
} |
@shaw2thefloor because
Can you please give that a try? This example comes from default_metadata_blocks-4.6.1.json, which I first posted at https://groups.google.com/d/msg/dataverse-community/qsY8swD9Hh0/Q9Tm4Ll-AgAJ and will attached below, adding ".txt" to the end so that GitHub Issues accepts it: Even if this does work for you, I'd love to get some feedback on how we can make this easier for API users like yourself. Obviously, a more clear error message than Here are some related issues:
|
Ah ok thanks for that Phillip. As you said the error occurs when supplying an empty string for one of the multiple field types rather than an empty array.
So for me, the most useful thing was finding the JSON examples on github. I spent a long time looking through the docs here http://guides.dataverse.org/en/4.6.1/api/native-api.html, but they mostly only document the urls and not the JSON required in the payload.
I was working with these guys recently, and this is an example of what I found really useful REST documentation.
http://developer.agaveapi.co
Anyway, thanks for your help.
Felix
|
@shaw2thefloor I agree that JSON examples would be helpful. #3192 is about a similar issue. How do you feel about changing the title of this issue to something like "API Guide should provide more examples of required JSON payload"? Lately, I've been making an effort to make JSON examples downloadable from the API guide, as in 23fafb3, but the older APIs have been a bit neglected. |
hey @pdurbin. I can certainly do that. Thanks for your help. If there is anything else I can think of as I'm working with the API, I'll let you know. |
@shaw2thefloor thanks. I just added another example in bffb3fe |
The title of this issue is fairly broad. We should probably make a small chunk issue to add a cleaned up version of |
Yesterday in IRC I was chatting with @shirleyah about the JSON needed to create a new dataset and she reminded me that it's confusing that some fields are ignored such as the following:
These fields are ignored because when you create a new dataset the dataset will get a new id and identifier. The protocol and authority will be whatever the Dataverse installation is configured to use. Basically, as the person creating the dataset, you don't have any control over the fields above so they should not be included in the JSON example that will be downloadable from the API Guide. This is what I meant in my last comment about how the example JSON mentioned above needs to be cleaned up. @kcondon and I discussed how the fields above and others are ignored which let us to wonder if terms of use can be set via API. I have "Setting Terms of Use" listed under the "No functionality should be GUI-only. Make all functionality reachable via the API" issue I opened at #3440 so I don't believe it's possible. A separate issue should be created for this. This current issue should be only about documenting what's possible (with a JSON) example, using the native API. @jggautier this relates to https://help.hmdc.harvard.edu/Ticket/Display.html?id=258964 @shaw2thefloor out of curiosity, are you still interested in this issue? Thanks again for opening it. |
@shaw2thefloor two things... 😄 We haven't heard from you in a while. Are you still interested in this issue? 😄 As part of pull request #6107 I finally got around to making the more complete "all fields" example downloadable in the "create a dataset" section. Here's how it looks: |
This is related to the following issue: |
Im getting this error:
{"status":"ERROR","message":"Error parsing datasetVersion: org.glassfish.json.JsonStringImpl cannot be cast to javax.json.JsonArray"}'
I'm trying to create a Dataset on demo.dataverse.org against an existing dataverse, using python requests, with the following json fragment
I'm pretty sure its the relatedMaterial bit, but it also does the same with dataSources and relatedDatasets.
Any help much appreciated.
F
The text was updated successfully, but these errors were encountered: