Skip to content

Update "change dataset citation date" curl examples#7294

Merged
kcondon merged 2 commits intodevelopfrom
7293-use-pid-for-dataset-citation-date-examples
Oct 6, 2020
Merged

Update "change dataset citation date" curl examples#7294
kcondon merged 2 commits intodevelopfrom
7293-use-pid-for-dataset-citation-date-examples

Conversation

@jggautier
Copy link
Copy Markdown
Contributor

Changes the curl examples for "Set Citation Date Field Type for a Dataset" and "Revert Citation Date Field Type to Default for Dataset" endpoints to use the dataset's persistentId instead of its database ID.

What this PR does / why we need it: A dataset's database ID can be a pain to get for users who just want to use an API endpoint to do something once, like change the year shown in their dataset's citation. This PR changes the curl examples in the API guide for the "Set Citation Date Field Type for a Dataset" and "Revert Citation Date Field Type to Default for Dataset" endpoints, so that they show how to use the dataset PID instead.

Which issue(s) this PR closes:

Closes #7293

Special notes for your reviewer:

Suggestions on how to test this: Check out the diff

Does this PR introduce a user interface change? If mockups are available, please link/include them here: No

Is there a release notes update needed for this change?: I don't think so

Additional documentation:

Changes the curl examples for "Set Citation Date Field Type for a Dataset" and "Revert Citation Date Field Type to Default for Dataset" endpoints to use the dataset's persistentId instead of its database ID.
@coveralls
Copy link
Copy Markdown

coveralls commented Oct 5, 2020

Coverage Status

Coverage remained the same at 19.469% when pulling 72b1ef1 on 7293-use-pid-for-dataset-citation-date-examples into c23d993 on develop.

Copy link
Copy Markdown
Member

@pdurbin pdurbin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--data ":dateOfDeposit" seems to be missing in one example

.. code-block:: bash

curl -H "X-Dataverse-key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" -X PUT https://demo.dataverse.org/api/datasets/24/citationdate --data ":dateOfDeposit"
curl -H "X-Dataverse-key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" -X PUT https://demo.dataverse.org/api/datasets/:persistentId/citationdate?persistentId=doi:10.5072/FK2/J8SJZB
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
curl -H "X-Dataverse-key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" -X PUT https://demo.dataverse.org/api/datasets/:persistentId/citationdate?persistentId=doi:10.5072/FK2/J8SJZB
curl -H "X-Dataverse-key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" -X PUT https://demo.dataverse.org/api/datasets/:persistentId/citationdate?persistentId=doi:10.5072/FK2/J8SJZB --data ":dateOfDeposit"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@jggautier
Copy link
Copy Markdown
Contributor Author

When I try the command with the colon in front of the field name, like ":dateOfDeposit", I get an error: "Dataset Field Type Name :dateOfDeposit not found."

When I remove the colon, "dateOfDeposit", the API works:

curl -H "X-Dataverse-key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" -X PUT https://demo.dataverse.org/api/datasets/:persistentId/citationdate?persistentId=doi:10.5072/FK2/J8SJZB --data "dateOfDeposit"

Before I change this PR, is there a reason why there's a colon in front of the field name? Should it not work if there's no colon?

@pdurbin
Copy link
Copy Markdown
Member

pdurbin commented Oct 5, 2020

@jggautier :publicationDate (with a colon) has special meaning (allowing you to reset the date back to the default, though I haven't tested this lately) but the other date field, as you observed, should be passed with no colon. Sorry to lead you astray. I was following what what in front of me. The colon for :dateOfDeposit got added under my watch in #6710. If you could take it out, I'd appreciate it. If you want to add any more examples of dates, they shouldn't have colons either.

Pull request #3000 is where this "change the date in the citation" feature was originally added. I only mention this because it was helpful for me to wrap my head around it.

Removed colon from field name "dateOfDeposit", and completed the curl examples.
@kcondon kcondon self-assigned this Oct 6, 2020
@kcondon kcondon merged commit fb772d1 into develop Oct 6, 2020
@djbrooke djbrooke added this to the 5.2 milestone Oct 6, 2020
@jggautier jggautier deleted the 7293-use-pid-for-dataset-citation-date-examples branch February 18, 2022 01:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

5 participants