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

API for creating datasets fails: Error parsing the POSTed json into a dataverse: Field alias is mandatory #3805

Closed
pameyer opened this issue Apr 28, 2017 · 4 comments

Comments

@pameyer
Copy link
Contributor

pameyer commented Apr 28, 2017

Test scripts creating a native dataset (POST to /api/dataverses/$dataverse_aliase/datasets) fail with error message:
{"status":"ERROR","message":"Error parsing the POSTed json into a dataverse: Field alias is mandatory"}

Creation of dataset through UI works; querying dataset API endpoint to check JSON (api/datasets/:persistentId/?persistentId=doi:$persistentId) does not show an alias field in the JSON returned. scripts/api/data/dataset-*json also don't show an alias field.

Observed in df67463; haven't fully excluded the possibility that this is user error (yet).

@pdurbin
Copy link
Member

pdurbin commented Apr 28, 2017

@pameyer sounds like a bug in our API Guide. Confusion over whatever we wrote there. A dataverse has an alias but not dataset does not. Here's an example of creating a dataset from https://github.com/IQSS/dataverse/blob/v4.6.1/scripts/search/tests/create-all-and-test#L10

curl -X POST -H "Content-type:application/json" -d @scripts/search/tests/data/dataset-finch1.json "http://localhost:8080/api/dataverses/finches/datasets/?key=$FINCHKEY"

Does that help? In the example above the alias of the dataverse is "finches".

@pameyer
Copy link
Contributor Author

pameyer commented Apr 28, 2017

@pdurbin - I don't think this is an API guide issue, because I was able to use the same scripts/JSON files to create datasets with a previous commit (I believe 4.6). I still have some troubleshooting to do to narrow down which change caused things to stop working (aka - possible bug vs problem on my end).

@pameyer
Copy link
Contributor Author

pameyer commented May 1, 2017

Additional investigation showed that this was user error (and that @pdurbin was on the right track).

For future reference, the reported error message occurs with valid JSON - but when the dataverse alias (under which the dataset will be created) is missing from the endpoint URL (in this case, due to typo-ing an environmental variable).

@pameyer pameyer closed this as completed May 1, 2017
@pdurbin
Copy link
Member

pdurbin commented May 1, 2017

@pameyer I'd still say that the API Guide could be improved and that that the error message could be more clear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants