-
Notifications
You must be signed in to change notification settings - Fork 534
Dataverse Featured Items support #11124
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
Merged
Merged
Changes from all commits
Commits
Show all changes
65 commits
Select commit
Hold shift + click to select a range
d796959
Stash: update featureItems endpoint PoC WIP
GPortas 755fd4d
Stash: CreateDataverseFeaturedItemCommand WIP
GPortas 67e3fe0
Changed: multiple featured item creation endpoint converted to single
GPortas b7352aa
Removed: unused/incorrect code
GPortas 0744c30
Removed: unused imports
GPortas 2c96f21
Added: persisting featured items in the database
GPortas 9cc6117
Added: new InvalidCommandArgumentsException and using it in CreateDat…
GPortas 11a0592
Added: endpoint for listing featured items
GPortas ec3b6f2
Added: returning imageUrl with new associated endpoint for retrieving…
GPortas ea798b8
Merge branch 'develop' of github.com:IQSS/dataverse into 10943-featur…
GPortas 160ffa5
Removed: wrongly committed files
GPortas f124f4a
Stash: relocating file-specific logic and unit tests in progress
GPortas 64ec37b
Fixed: exception handling when image file is invalid in a featured item
GPortas 98f3645
Added: tweaks and fixes for featured items
GPortas ea03a07
Added: flush call when saving DataverseFeaturedItem
GPortas ea388ba
Added: DeleteDataverseFeaturedItemCommand
GPortas 7ede831
Added: DataverseFeaturedItems API with delete method
GPortas d50a943
Added: DataverseFeaturedItems API with delete method IT
GPortas 220e02a
Added: DataverseFeaturedItemsIT assertion
GPortas 1bc2ba7
Added: testCreateFeaturedItem IT cases
GPortas f7d60c7
Added: handling image file optionality in dataverse featured items
GPortas 034cea4
Added: API endpoint for updating a dataverse featured item
GPortas 812ff0f
Stash: endpoint for create/update/delete all dv featured items at onc…
GPortas adfa095
Merge branch 'develop' of github.com:IQSS/dataverse into 10943-featur…
GPortas 791336c
Stash: updateFeaturedItems endpoint WIP. Updated the endpoint to retu…
GPortas d1c7a04
Changed: relocated flush call to avoid unnecessary call in DataverseF…
GPortas b8853b7
Fixed: delete featured item inconsistencies
GPortas 3df4723
Added: updateFeaturedItems working endpoint
GPortas b2c918a
Merge branch 'develop' of github.com:IQSS/dataverse into 10943-featur…
GPortas aabc4d3
Added: deleteDataverseFeaturedItems endpoint
GPortas b2eca4b
Added: featured item content validation
GPortas b4f5ce9
Added: order featured items results by display order and missing test…
GPortas 998cc6c
Merge branch 'develop' of github.com:IQSS/dataverse into 10943-featur…
GPortas e265ae8
Fixed: response message string formatting
GPortas bff8e94
Added: featured items deletion in DeleteDataverseCommand
GPortas 5c61511
Added: sanitizing featured item content property
GPortas f4b6e0c
Added: empty content validation for featured items
GPortas 107a16e
Changed: using advanced HTML sanitization for featured item content
GPortas b83f79c
Added: docs for listing and deleting all featured items
GPortas e006780
Added: API docs for creating a collection featured item
GPortas d386bc6
Merge branch 'develop' of github.com:IQSS/dataverse into 10943-featur…
GPortas a5b2687
Added: docs for updating a single featured item through API
GPortas 651347e
Added: docs for deleting a single featured item through API
GPortas 4503aa8
Fixed: Bundle.properties string format
GPortas a90b7e5
Merge branch 'develop' of github.com:IQSS/dataverse into 10943-featur…
GPortas 15568a8
Fixed: typos in Bundle.properties
GPortas 93c1eca
Added: API docs for updating all featured items
GPortas 13301be
Added: release notes for #10943
GPortas 38e7d88
Changed: API endpoint route
GPortas c4387d5
Changed: updated release notes
GPortas 17f523a
Changed: docs title format tweak
GPortas 6f182d2
Merge branch 'develop' of github.com:IQSS/dataverse into 10943-featur…
GPortas 69de6dd
Fixed: DataverseFeaturedItemsIT
GPortas e144767
Fixed: wrong endpoint path name
GPortas fb61d89
Added: docs for api/access/dataverseFeaturedItemImage/{ID}
GPortas e91524b
Refactor: package structure for dataverse featured items
GPortas a986a67
Added: new settings description to #10943 release notes
GPortas e0aeb2f
Fixed: DataversesIT featured items imageFileUrl assertion
GPortas d3726f8
Fixed: doc hierarchy
GPortas 29944a0
Changed: featured items docs hierarchy
GPortas 4004c26
Merge branch 'develop' of github.com:IQSS/dataverse into 10943-featur…
GPortas 497cc5d
Update doc/sphinx-guides/source/api/native-api.rst
GPortas 1799d70
Update doc/sphinx-guides/source/api/native-api.rst
GPortas 1aac2d5
Update doc/sphinx-guides/source/api/native-api.rst
GPortas a8d4a05
Update doc/sphinx-guides/source/api/native-api.rst
GPortas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| CRUD endpoints for Collection Featured Items have been implemented. In particular, the following endpoints have been implemented: | ||
|
|
||
| - Create a feature item (POST /api/dataverses/<dataverse_id>/featuredItems) | ||
| - Update a feature item (PUT /api/dataverseFeaturedItems/<item_id>) | ||
| - Delete a feature item (DELETE /api/dataverseFeaturedItems/<item_id>) | ||
| - List all featured items in a collection (GET /api/dataverses/<dataverse_id>/featuredItems) | ||
| - Delete all featured items in a collection (DELETE /api/dataverses/<dataverse_id>/featuredItems) | ||
| - Update all featured items in a collection (PUT /api/dataverses/<dataverse_id>/featuredItems) | ||
pdurbin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| New settings: | ||
|
|
||
| - dataverse.files.featured-items.image-maxsize - It sets the maximum allowed size of the image that can be added to a featured item. | ||
| - dataverse.files.featured-items.image-uploads - It specifies the name of the subdirectory for saving featured item images within the docroot directory. | ||
|
|
||
| See also #10943 and #11124. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1156,6 +1156,209 @@ Use the ``/settings`` API to enable or disable the enforcement of storage quotas | |
|
|
||
| curl -X PUT -d 'true' http://localhost:8080/api/admin/settings/:UseStorageQuotas | ||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree. I have restructured it by deleting |
||
| List All Collection Featured Items | ||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
|
||
| List the featured items configured for a given Dataverse collection ``id``: | ||
|
|
||
| .. code-block:: bash | ||
|
|
||
| export API_TOKEN=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx | ||
| export SERVER_URL=https://demo.dataverse.org | ||
| export ID=root | ||
|
|
||
| curl -H "X-Dataverse-key:$API_TOKEN" "$SERVER_URL/api/dataverses/$ID/featuredItems" | ||
|
|
||
| The fully expanded example above (without environment variables) looks like this: | ||
|
|
||
| .. code-block:: bash | ||
|
|
||
| curl -H "X-Dataverse-key:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" "https://demo.dataverse.org/api/dataverses/root/featuredItems" | ||
|
|
||
| Update All Collection Featured Items | ||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
|
||
| Updates all featured items in the given Dataverse collection ``id``. | ||
|
|
||
| The data sent to the endpoint represents the desired final state of the featured items in the Dataverse collection and overwrites any existing featured items configuration. | ||
|
|
||
| The parameters ``id``, ``content``, ``displayOrder``, and ``fileName`` must be specified as many times as the number of items we want to add or update. The order in which these parameters are repeated must match to ensure they correspond to the same featured item. | ||
|
|
||
| The ``file`` parameter must be specified for each image we want to attach to featured items. Note that images can be shared between featured items, so ``fileName`` can have the same value in different featured items. | ||
|
|
||
| The ``id`` parameter must be ``0`` for new items or set to the item's identifier for updates. The ``fileName`` parameter should be empty to exclude an image or match the name of a file sent in a ``file`` parameter to set a new image. ``keepFile`` must always be set to ``false``, unless it's an update to a featured item where we want to preserve the existing image, if one exists. | ||
pdurbin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| Note that any existing featured item not included in the call with its associated identifier and corresponding properties will be removed from the collection. | ||
|
|
||
| The following example creates two featured items, with an image assigned to the second one: | ||
|
|
||
| .. code-block:: bash | ||
|
|
||
| export API_TOKEN=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx | ||
| export SERVER_URL=https://demo.dataverse.org | ||
| export ID=root | ||
|
|
||
| export FIRST_ITEM_CONTENT='Content 1' | ||
| export FIRST_ITEM_DISPLAY_ORDER=1 | ||
|
|
||
| export SECOND_ITEM_IMAGE_FILENAME='image.png' | ||
| export SECOND_ITEM_CONTENT='Content 2' | ||
| export SECOND_ITEM_DISPLAY_ORDER=2 | ||
|
|
||
| curl -H "X-Dataverse-key:$API_TOKEN" \ | ||
| -X PUT \ | ||
| -F "id=0" -F "id=0" \ | ||
| -F "content=$FIRST_ITEM_CONTENT" -F "content=$SECOND_ITEM_CONTENT" \ | ||
| -F "displayOrder=$FIRST_ITEM_DISPLAY_ORDER" -F "displayOrder=$SECOND_ITEM_DISPLAY_ORDER" \ | ||
| -F "fileName=" -F "fileName=$SECOND_ITEM_IMAGE_FILENAME" \ | ||
| -F "keepFile=false" -F "keepFile=false" \ | ||
| -F "file=@$SECOND_ITEM_IMAGE_FILENAME" \ | ||
| "$SERVER_URL/api/dataverses/$ID/featuredItems" | ||
|
|
||
|
|
||
| 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 PUT \ | ||
| -F "id=0" -F "id=0" \ | ||
| -F "content=Content 1" -F "content=Content 2" \ | ||
| -F "displayOrder=1" -F "displayOrder=2" \ | ||
| -F "fileName=" -F "fileName=image.png" \ | ||
| -F "keepFile=false" -F "keepFile=false" \ | ||
| -F "file=@image.png" \ | ||
| "https://demo.dataverse.org/api/dataverses/root/featuredItems" | ||
|
|
||
| The following example creates one featured item and updates a second one, keeping the existing image it may have had: | ||
|
|
||
| .. code-block:: bash | ||
|
|
||
| curl -H "X-Dataverse-key:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" \ | ||
| -X PUT \ | ||
| -F "id=0" -F "id=1" \ | ||
| -F "content=Content 1" -F "content=Updated content 2" \ | ||
| -F "displayOrder=1" -F "displayOrder=2" \ | ||
| -F "fileName=" -F "fileName=" \ | ||
| -F "keepFile=false" -F "keepFile=true" \ | ||
| "https://demo.dataverse.org/api/dataverses/root/featuredItems" | ||
|
|
||
| Delete All Collection Featured Items | ||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
|
||
| Deletes the featured items configured for a given Dataverse collection ``id``: | ||
|
|
||
| .. code-block:: bash | ||
|
|
||
| export API_TOKEN=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx | ||
| export SERVER_URL=https://demo.dataverse.org | ||
| export ID=root | ||
|
|
||
| curl -H "X-Dataverse-key: $API_TOKEN" -X DELETE "$SERVER_URL/api/dataverses/$ID/featuredItems" | ||
|
|
||
| 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 DELETE "https://demo.dataverse.org/api/dataverses/root/featuredItems" | ||
|
|
||
| Create a Collection Featured Item | ||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
|
||
| Creates a featured item in the given Dataverse collection ``id``: | ||
|
|
||
| .. code-block:: bash | ||
|
|
||
| export API_TOKEN=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx | ||
| export IMAGE_FILENAME='image.png' | ||
| export CONTENT='Content for featured item.' | ||
| export DISPLAY_ORDER=1 | ||
| export SERVER_URL=https://demo.dataverse.org | ||
| export ID=root | ||
|
|
||
| curl -H "X-Dataverse-key:$API_TOKEN" -X POST -F "file=@$IMAGE_FILENAME" -F "content=$CONTENT" -F "displayOrder=$DISPLAY_ORDER" "$SERVER_URL/api/dataverses/$ID/featuredItems" | ||
|
|
||
| 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 "file=@image.png" -F "content=Content for featured item." -F "displayOrder=1" "https://demo.dataverse.org/api/dataverses/root/featuredItems" | ||
|
|
||
| A featured item may or may not contain an image. If you wish to create it without an image, omit the file parameter in the request. | ||
|
|
||
| Update a Collection Featured Item | ||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
|
||
| Updates a featured item given its ``id``: | ||
|
|
||
| .. code-block:: bash | ||
|
|
||
| export API_TOKEN=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx | ||
| export IMAGE_FILENAME='image.png' | ||
| export CONTENT='Content for featured item.' | ||
| export DISPLAY_ORDER=1 | ||
| export SERVER_URL=https://demo.dataverse.org | ||
| export ID=1 | ||
|
|
||
| curl -H "X-Dataverse-key:$API_TOKEN" -X PUT -F "file=@$IMAGE_FILENAME" -F "content=$CONTENT" -F "displayOrder=$DISPLAY_ORDER" "$SERVER_URL/api/dataverseFeaturedItems/$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 PUT -F "file=@image.png" -F "content=Content for featured item." -F "displayOrder=1" "https://demo.dataverse.org/api/dataverseFeaturedItems/1" | ||
|
|
||
| ``content`` and ``displayOrder`` must always be provided; otherwise, an error will occur. Use the ``file`` parameter to set a new image for the featured item. To keep the existing image, omit ``file`` and send ``keepFile=true``. To remove the image, omit the file parameter. | ||
|
|
||
| Updating the featured item keeping the existing image: | ||
|
|
||
| .. code-block:: bash | ||
|
|
||
| curl -H "X-Dataverse-key:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" -X PUT -F "keepFile=true" -F "content=Content for featured item." -F "displayOrder=1" "https://demo.dataverse.org/api/dataverseFeaturedItems/1" | ||
|
|
||
| Updating the featured item removing the existing image: | ||
|
|
||
| .. code-block:: bash | ||
|
|
||
| curl -H "X-Dataverse-key:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" -X PUT -F "content=Content for featured item." -F "displayOrder=1" "https://demo.dataverse.org/api/dataverseFeaturedItems/1" | ||
|
|
||
| Delete a Collection Featured Item | ||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
|
||
| Deletes a featured item given its ``id``: | ||
|
|
||
| .. code-block:: bash | ||
|
|
||
| export API_TOKEN=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx | ||
| export SERVER_URL=https://demo.dataverse.org | ||
| export ID=1 | ||
|
|
||
| curl -H "X-Dataverse-key:$API_TOKEN" -X DELETE "$SERVER_URL/api/dataverseFeaturedItems/$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 DELETE "https://demo.dataverse.org/api/dataverseFeaturedItems/1" | ||
|
|
||
| Get a Collection Featured Item Image | ||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
|
||
| Returns the image of a featured item if one is assigned, given the featured item ``id``: | ||
|
|
||
| .. code-block:: bash | ||
|
|
||
| export API_TOKEN=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx | ||
| export SERVER_URL=https://demo.dataverse.org | ||
| export ID=1 | ||
|
|
||
| curl -H "X-Dataverse-key:$API_TOKEN" -X GET "$SERVER_URL/api/access/dataverseFeaturedItemImage/{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 GET "https://demo.dataverse.org/api/access/dataverseFeaturedItemImage/1" | ||
|
|
||
| Datasets | ||
| -------- | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.

Uh oh!
There was an error while loading. Please reload this page.