-
Notifications
You must be signed in to change notification settings - Fork 477
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
Added tabulartags in files metadata for files metadata #10027
Added tabulartags in files metadata for files metadata #10027
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@saikiranpatil thanks for the PR!
I dug up what I had sent @MellyGray in Slack.
She wrote:
curl -H "X-Dataverse-key:1967e628-3bf4-4bc1-abe9-711f45b9b6b9" -X POST \ -F 'jsonData={"description":"My description bbb.","provFreeform":"Test prov freeform","tabularTags":["Survey"],"restrict":false}' \ "http://localhost:8000/api/files/1453/metadata"
And I said, please try dataFileTags
instead of tabularTags
in your JSON. That’s what I’m seeing here: https://github.com/IQSS/dataverse/blob/v5.14/src/main/java/edu/harvard/iq/dataverse/datasetutility/OptionalFileParams.java#L60
Pretty printed (easier to read), the fixed version looks like this:
{
"description": "My description bbb.",
"provFreeform": "Test prov freeform",
"dataFileTags": [
"Survey"
],
"restrict": false
}
(For this pull request, it's best to keep it on one line, though.)
Please make sure all JSON is valid and please watch the single quotes.
You can test against https://demo.dataverse.org if you like! If you have questions, please feel free to ask here or open a topic in #dev at https://chat.dataverse.org . Thanks!
"$SERVER_URL/api/files/:persistentId/metadata?persistentId=$PERSISTENT_ID" | ||
|
||
The fully expanded example above (without environment variables) looks like this: | ||
|
||
.. code-block:: bash | ||
|
||
curl -H "X-Dataverse-key:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" -X POST \ | ||
-F 'jsonData={"description":"My description bbb.","provFreeform":"Test prov freeform","categories":["Data"],"restrict":false}' \ | ||
-F 'jsonData={"description":"My description bbb.","provFreeform":"Test prov freeform","categories":["Data"],"restrict":false}', "dataFileTags":["Survey"]} \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The single quote on the right should be on the outside.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my bad, I should have rechecked before commit. i will correct them
@@ -3108,15 +3108,15 @@ A curl example using an ``ID`` | |||
export ID=24 | |||
|
|||
curl -H "X-Dataverse-key:$API_TOKEN" -X POST \ | |||
-F 'jsonData={"description":"My description bbb.","provFreeform":"Test prov freeform","categories":["Data"],"restrict":false}' \ | |||
-F 'jsonData={"description":"My description bbb.","provFreeform":"Test prov freeform","categories":["Data"],"restrict":false},"dataFileTags":["Survey"]}' \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not parse as valid JSON. Please try it (and the others) at https://jsonlint.com (or your favorite validator):
hey @pdurbin, i have made changes, are there any mistake in that? |
@saikiranpatil I haven't checked the JSON but overall I think it's looking better. Probably we'll want to keep the "categories" in the JSON because it's different that tabular tags. I can add it back if you want. Please just let me know. |
@saikiranpatil oh, also, do you want to try testing your curl commands at https://demo.dataverse.org ? To make sure they work? |
@pdurbin I added back "categories", I am not sure how to check commands at https://demo.dataverse.org/, but I checked JSON, it's in correct JSON format. |
@saikiranpatil to check the curl commands you would open a terminal and execute them. I know you have them in front of you but here's an HTML preview in case you haven't been building the HTML version: https://dataverse-guide--10027.org.readthedocs.build/en/10027/api/native-api.html#updating-file-metadata The demo server is already used in the example:
To get an API token you would create an account on https://demo.dataverse.org and follow these steps: Before running the curl command you'll want to create a dataset, upload a file, and figure out the file id (instead of Does that make sense? |
@pdurbin got it. Are there are any changes required in PR? |
@saikiranpatil I haven't tested it so I'm not sure. Did you test it? |
Huh. From a quick look it seems right. 🤔 Can you please try changing the jsonData? Maybe you could try simplifying it all the way down to just changing the description:
Another sanity check, using your API token, can you get the metadata for the files? Like this: curl -H "X-Dataverse-key:xxxxx" https://demo.dataverse.org/api/files/2102722/metadata You could also try a published file without a key: curl https://demo.dataverse.org/api/files/2102661/metadata gives me this:
|
Weird. You seem to be using https://reqbin.com/curl This one works for me: |
maybe, it's problem with my way of uploading file. |
When I get to a good stopping point, I'll play with it. Thanks and have a good weekend! |
@pdurbin if the changes made in documentation are working correctly, please merge PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't tested this but it should work. Sending to ready for QA.
@saikiranpatil merged! Thanks for the pull request! ❤️ |
What this PR does / why we need it:
correcting the API Guide for update Request where TabularTags is required in the Request Header
Which issue(s) this PR closes: