Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
eb64cde
initial guestbook apis
stevenwinship Jan 22, 2026
1c93ba6
Merge branch 'develop' into 12001-api-support-termofuse-guestbook
stevenwinship Jan 22, 2026
789ed94
Merge branch 'develop' into 12001-api-support-termofuse-guestbook
stevenwinship Jan 27, 2026
7113b48
Merge branch 'develop' into 12001-api-support-termofuse-guestbook
stevenwinship Jan 28, 2026
38d67d4
adding guestbook response
stevenwinship Jan 28, 2026
1a1fead
validating response
stevenwinship Jan 28, 2026
6d16aae
validating response
stevenwinship Jan 28, 2026
411befd
Potential fix for code scanning alert no. 354: Information exposure t…
stevenwinship Jan 28, 2026
4833dd8
Potential fix for code scanning alert no. 355: Information exposure t…
stevenwinship Jan 28, 2026
bbea198
Potential fix for code scanning alert no. 356: Information exposure t…
stevenwinship Jan 28, 2026
2e9dd37
Merge branch 'develop' into 12001-api-support-termofuse-guestbook
stevenwinship Jan 28, 2026
1a73f06
code cleanup
stevenwinship Jan 28, 2026
b52b856
add -Ddataverse.files.guestbook-at-request=true for testing
stevenwinship Jan 29, 2026
6bbda52
fix test
stevenwinship Jan 30, 2026
969536a
Merge branch 'develop' into 12001-api-support-termofuse-guestbook
stevenwinship Jan 30, 2026
2b9c718
Merge branch 'develop' into 12001-api-support-termofuse-guestbook
stevenwinship Feb 4, 2026
b73b21e
Merge branch 'develop' into 12001-api-support-termofuse-guestbook
stevenwinship Feb 5, 2026
a630c9c
adding post for download datafile with guestbook response
stevenwinship Feb 6, 2026
9d68d33
fix
stevenwinship Feb 6, 2026
79c3eaa
add release note
stevenwinship Feb 9, 2026
b089324
new api and updated docs
stevenwinship Feb 9, 2026
7ab9c0a
updated docs
stevenwinship Feb 9, 2026
b6ec2ea
Merge branch 'develop' into 12001-api-support-termofuse-guestbook
stevenwinship Feb 9, 2026
13396f1
Merge branch 'develop' into 12001-api-support-termofuse-guestbook
stevenwinship Feb 9, 2026
6604ce5
Merge branch 'develop' into 12001-api-support-termofuse-guestbook
stevenwinship Feb 11, 2026
edf0a6e
refactor and add gb response checks to all download apis
stevenwinship Feb 12, 2026
e7bf66c
fix accessIT test
stevenwinship Feb 13, 2026
f47d9f6
Merge branch 'develop' into 12001-api-support-termofuse-guestbook
stevenwinship Feb 13, 2026
7c71e99
fix to zipper manifest to add NOT Authorized files
stevenwinship Feb 13, 2026
3466d4e
update docs
stevenwinship Feb 13, 2026
e3da730
Merge branch 'develop' into 12001-api-support-termofuse-guestbook
stevenwinship Feb 13, 2026
f9f2a21
Merge branch 'develop' into 12001-api-support-termofuse-guestbook
stevenwinship Feb 17, 2026
2dd0034
Merge branch 'develop' into 12001-api-support-termofuse-guestbook
stevenwinship Feb 18, 2026
649d7c5
Merge branch 'develop' into 12001-api-support-termofuse-guestbook
stevenwinship Feb 20, 2026
51facb9
Merge branch 'develop' into 12001-api-support-termofuse-guestbook
stevenwinship Feb 20, 2026
04e23a5
Merge branch 'develop' into 12001-api-support-termofuse-guestbook
stevenwinship Feb 23, 2026
ad22235
adding signed param to GET endpoints
stevenwinship Feb 25, 2026
2c5985d
Merge branch 'develop' into 12001-api-support-termofuse-guestbook
stevenwinship Feb 25, 2026
cedd4c2
add overwrite to name, email, institution, and position in guestbook …
stevenwinship Feb 25, 2026
917b3fa
Merge branch 'develop' into 12001-api-support-termofuse-guestbook
stevenwinship Feb 25, 2026
dc9f8bc
fix doc
stevenwinship Feb 25, 2026
d6aa29a
fix doc
stevenwinship Feb 25, 2026
72fce96
add email validation
stevenwinship Feb 25, 2026
cf2937b
add email validation
stevenwinship Feb 25, 2026
2c6d86d
Merge branch 'develop' into 12001-api-support-termofuse-guestbook
stevenwinship Feb 26, 2026
a9985d3
Merge branch 'develop' into 12001-api-support-termofuse-guestbook
stevenwinship Feb 26, 2026
a0ffae9
Merge branch 'develop' into 12001-api-support-termofuse-guestbook
stevenwinship Feb 27, 2026
35c2f75
allow guest to download with signedUrl
stevenwinship Mar 4, 2026
762642d
Merge branch 'develop' into 12001-api-support-termofuse-guestbook
stevenwinship Mar 4, 2026
c9831ad
remove signed= from docs
stevenwinship Mar 4, 2026
bc06e3b
fix getting file ids from csv
stevenwinship Mar 5, 2026
0f8bd28
fixing questbook response handling
stevenwinship Mar 6, 2026
60371d0
Merge branch 'develop' into 12001-api-support-termofuse-guestbook
stevenwinship Mar 6, 2026
fc0f003
add check for downloading thumbnails
stevenwinship Mar 9, 2026
726603f
add check for downloading thumbnails
stevenwinship Mar 9, 2026
5982c56
Merge branch 'develop' into 12001-api-support-termofuse-guestbook
stevenwinship Mar 9, 2026
00962b0
Update doc/sphinx-guides/source/api/native-api.rst
stevenwinship Mar 9, 2026
179d0ea
update docs
stevenwinship Mar 9, 2026
8e63f15
Update src/main/java/edu/harvard/iq/dataverse/util/UrlSignerUtil.java
stevenwinship Mar 9, 2026
faefe7f
update docs
stevenwinship Mar 9, 2026
90fd76d
add created sttaus checks to IT tests
stevenwinship Mar 9, 2026
efef793
create guestbook returns ok
stevenwinship Mar 9, 2026
f320a39
update docs
stevenwinship Mar 9, 2026
135542f
remove prettyPrints
stevenwinship Mar 9, 2026
42f9fcf
remove print statements
stevenwinship Mar 9, 2026
cf13f59
Merge branch 'develop' into 12001-api-support-termofuse-guestbook
stevenwinship Mar 10, 2026
910848a
Merge branch 'develop' into 12001-api-support-termofuse-guestbook
stevenwinship Mar 10, 2026
162a40f
add fix to access request test
stevenwinship Mar 10, 2026
561f24b
Merge branch 'develop' into 12001-api-support-termofuse-guestbook
stevenwinship Mar 10, 2026
c095efc
Merge branch 'develop' into 12001-api-support-termofuse-guestbook
stevenwinship Mar 11, 2026
b4fe522
Merge branch 'develop' into 12001-api-support-termofuse-guestbook
stevenwinship Mar 11, 2026
1addebd
adding check for missing 'answers' block in guestbook response
stevenwinship Mar 12, 2026
f6d5e8d
adding test for access request with gustbook response required but gu…
stevenwinship Mar 12, 2026
98e4820
Merge branch 'develop' into 12001-api-support-termofuse-guestbook
stevenwinship Mar 12, 2026
ac3fd32
fix signedurl with persistentId to replace it database id
stevenwinship Mar 12, 2026
8e8966d
another empty answers unit test
stevenwinship Mar 12, 2026
30be73c
typo
pdurbin Mar 12, 2026
0c7d3a6
Merge branch 'develop' into 12001-api-support-termofuse-guestbook
stevenwinship Mar 13, 2026
149ebde
fix typo guestbook_id to guestbookId in json
stevenwinship Mar 13, 2026
05a961e
adding to docs
stevenwinship Mar 13, 2026
879c465
give downloaders more hints to find the guestbookId #12001
pdurbin Mar 13, 2026
35a1eb2
add guestbookId to missing response message
stevenwinship Mar 13, 2026
b96efcf
Merge branch '12001-api-support-termofuse-guestbook' of https://githu…
stevenwinship Mar 13, 2026
d9b59ca
doc change
stevenwinship Mar 13, 2026
63db903
add guestbookId to request access error message
stevenwinship Mar 13, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions doc/release-notes/12001-api-support-termofuse-guestbook.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
## Feature Request: API to support Download Terms of Use and Guestbook

## New Endpoints to download a file or files that required a Guestbook Response: POST
A post to these endpoints with the body containing a JSON Guestbook Response will save the response and return a signed URL to download the file(s)

`/api/access/datafile/{fileId:.+}`
`/api/access/datafiles/{fileIds}`
`/api/access/dataset/{id}`
`/api/access/dataset/{id}/versions/{versionId}`

A post to these endpoints with the body containing a JSON Guestbook Response will save the response before continuing the download.
No signed URL option exists.
`/api/access/datafiles`
`/api/access/datafile/bundle/{fileId}` POST returns BundleDownloadInstance after processing Guestbook Responses from body.

## New CRUD Endpoints for Guestbook:
Create a Guestbook: POST `/api/guestbooks/{dataverseIdentifier}`
Get a Guestbook: GET `/api/guestbooks/{id}`
Get a list of Guestbooks linked to a Dataverse Collection: GET `/api/guestbooks/{dataverseIdentifier}/list`
Enable/Disable a Guestbook: PUT `/api/guestbooks/{dataverseIdentifier}/{id}/enabled` Body: `true` or `false`
Note: There is no Update or Delete at this time. You can disable a Guestbook and create a new one.

## For Guestbook At Request:
When JVM setting -Ddataverse.files.guestbook-at-request=true is used a request for access may require a Guestbook Response.
PUT `/api/access/datafile/{id}/requestAccess` will now take a JSON Guestbook Response in the body.
23 changes: 23 additions & 0 deletions doc/sphinx-guides/source/api/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,29 @@ This API changelog is experimental and we would love feedback on its usefulness.
:local:
:depth: 1

v6.10
-----
- The following GET APIs will now return ``400`` if a required Guestbook Response is not supplied. A Guestbook Response can be passed to these APIs in the JSON body using a POST call. See the notes under :ref:`basic-file-access` and :ref:`download-by-dataset-by-version` for details.

- **/api/access/datafile/{fileId:.+}**

- **/api/access/datafiles/{fileIds}**

- **/api/access/dataset/{id}**

- **/api/access/dataset/{id}/versions/{versionId}**

- The following POST APIs will now return ``400`` if a required Guestbook Response is not supplied. A Guestbook Response can be passed to these APIs in the JSON body. See the note under :ref:`basic-download-by-dataset` for details.

- **/api/access/datafiles**

- **/api/access/datafile/bundle/{fileId}**

- The following PUT APIs will now return ``400`` if a required Guestbook Response is not supplied. When JVM setting -Ddataverse.files.guestbook-at-request=true is set a Guestbook Response may be required to be passed to these APIs in the JSON body. See the note under Configuration :ref:`dataverse.files.guestbook-at-request` for details.

- **/api/access/datafile/{id}/requestAccess**


v6.9
----

Expand Down
21 changes: 20 additions & 1 deletion doc/sphinx-guides/source/api/dataaccess.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,15 @@ Please note that in addition to the files from dataset, an additional file call

There are two forms of the "download by dataset" API, a basic form and one that supports dataset versions.

.. _basic-download-by-dataset:

Basic Download By Dataset
~~~~~~~~~~~~~~~~~~~~~~~~~

The basic form downloads files from the latest accessible version of the dataset. If you are not using an API token, this means the most recently published version. If you are using an API token with full access to the dataset, this means the draft version or the most recently published version if no draft exists.

.. note:: Files that require a Guestbook Response will require an additional step to supply the Guestbook Response. A POST to the same endpoint with the Guestbook Response in the body can return a signed url that can be used to download the file(s) via a browser or download manager. To determine what information is required in the response you must first get the Guestbook for the Dataset whose file(s) you are trying to access along with any Custom Questions. Call ``GET http://$SERVER/api/guestbooks/{id}`` with the guestbookId from the Dataset (See :ref:`dataset-json-representation` to get the Dataset with guestbookId) to retrieve the Guestbook and Custom Questions. Build the JSON response with the information requested and add it to the body of the POST call within "guestbookResponse":{}. For more about guestbooks, see :ref:`dataset-guestbooks` in the User Guide.

A curl example using a DOI (no version):

.. code-block:: bash
Expand All @@ -48,6 +52,8 @@ The fully expanded example above (without environment variables) looks like this

curl -L -O -J -H X-Dataverse-key:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx https://demo.dataverse.org/api/access/dataset/:persistentId/?persistentId=doi:10.70122/FK2/N2XGBJ

.. _download-by-dataset-by-version:

Download By Dataset By Version
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand All @@ -59,6 +65,8 @@ The second form of the "download by dataset" API allows you to specify which ver
* ``x.y`` a specific version, where ``x`` is the major version number and ``y`` is the minor version number.
* ``x`` same as ``x.0``

.. note:: Files that require a Guestbook Response will require an additional step to supply the Guestbook Response. A POST to the same endpoint with the Guestbook Response in the body can return a signed url that can be used to download the file(s) via a browser or download manager. To determine what information is required in the response you must first get the Guestbook for the Dataset whose file(s) you are trying to access along with any Custom Questions. Call ``GET http://$SERVER/api/guestbooks/{id}`` with the guestbookId from the Dataset (See :ref:`dataset-json-representation` to get the Dataset with guestbookId) to retrieve the Guestbook and Custom Questions. Build the JSON response with the information requested and add it to the body of the POST call within "guestbookResponse":{}. For more about guestbooks, see :ref:`dataset-guestbooks` in the User Guide.

A curl example using a DOI (with version):

.. code-block:: bash
Expand All @@ -78,6 +86,8 @@ The fully expanded example above (without environment variables) looks like this

curl -O -J -H X-Dataverse-key:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx https://demo.dataverse.org/api/access/dataset/:persistentId/versions/2.0?persistentId=doi:10.70122/FK2/N2XGBJ

.. _basic-file-access:

Basic File Access
-----------------

Expand All @@ -91,6 +101,11 @@ Basic access URI:

GET http://$SERVER/api/access/datafile/:persistentId?persistentId=doi:10.5072/FK2/J8SJZB

.. note:: Files that require a Guestbook Response will require an additional step to supply the Guestbook Response. A POST to the same endpoint with the Guestbook Response in the body can return a signed url that can be used to download the file(s) via a browser or download manager. For more about guestbooks, see :ref:`dataset-guestbooks` in the User Guide. In the following JSON example please note that the `name`, `email`, `institution`, and `position` fields will default to the User's account information if not included in the response. Call ``GET http://$SERVER/api/guestbooks/{id}`` with the guestbookId from the Dataset (See :ref:`dataset-json-representation` to get the Dataset with guestbookId) to retrieve the Guestbook and Custom Questions. Build the JSON response with the information requested and add it to the body of the POST call within "guestbookResponse":{}.

Example ::

POST http://$SERVER/api/access/datafile/:persistentId?persistentId=doi:10.5072/FK2/J8SJZB&signed=true -d '{"guestbookResponse": {"name": "My Name", "email": "myemail@example.com", "institution": "Harvard","position": "Staff", "answers": [{"id": 123,"value": "Good"},{"id": 124,"value": ["Multi","Line"]},{"id": 125,"value": "Yellow"}]}}'

Parameters:
~~~~~~~~~~~
Expand Down Expand Up @@ -198,6 +213,8 @@ Returns the files listed, zipped. As of v6.7 the name of the zipped bundle will

.. note:: If any of the datafiles have the ``DirectoryLabel`` attributes in the corresponding ``FileMetadata`` entries, these will be added as folders to the Zip archive, and the files will be placed in them accordingly.

.. note:: If Guestbook Responses are required they can be included in the body along with the file ids as JSON: ``{"fileIds" :[1,2,3], {"guestbookResponse": {"answers": []}}}``. For more about guestbooks, see :ref:`dataset-guestbooks` in the User Guide.

Parameters:
~~~~~~~~~~~

Expand Down Expand Up @@ -378,7 +395,9 @@ This method requests access to the datafile whose id is passed on the behalf of
A curl example using an ``id``::

curl -H "X-Dataverse-key:$API_TOKEN" -X PUT http://$SERVER/api/access/datafile/{id}/requestAccess


.. note:: Some installations of Dataverse may require you to provide a Guestbook Response when requesting access to certain restricted files. The response can be passed in the body of this call. See "Get a Guestbook for a Dataverse Collection" in the :doc:`native-api`.

Grant File Access:
~~~~~~~~~~~~~~~~~~

Expand Down
96 changes: 96 additions & 0 deletions doc/sphinx-guides/source/api/native-api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1168,6 +1168,100 @@ The fully expanded example above (without environment variables) looks like this

curl -H "X-Dataverse-key:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" "https://demo.dataverse.org/api/dataverses/root/guestbookResponses?guestbookId=1" -o myResponses.csv

.. _guestbook-api:

Guestbooks
~~~~~~~~~~

Create a Guestbook for a Dataverse Collection
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

For more about guestbooks, see :ref:`dataset-guestbooks` in the User Guide.

Create a Guestbook that can be selected for a Dataset.
You must have "EditDataverse" permission on the Dataverse collection.

.. code-block:: bash

export API_TOKEN=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
export SERVER_URL=https://demo.dataverse.org
export ID=root
export JSON='{"name": "my test guestbook","enabled": true,"emailRequired": true,"nameRequired": true,"institutionRequired": false,"positionRequired": false,"customQuestions": [{"question": "how is your day","required": true,"displayOrder": 0,"type": "text","hidden": false}]}'

curl -POST -H "X-Dataverse-key:$API_TOKEN" "$SERVER_URL/api/guestbooks/{ID}" -d "$JSON"

The fully expanded example above (without environment variables) looks like this:

.. code-block:: bash

curl -POST -H "X-Dataverse-key:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" "https://demo.dataverse.org/api/guestbooks/root" -d '{"name": "my test guestbook","enabled": true,"emailRequired": true,"nameRequired": true,"institutionRequired": false,"positionRequired": false}'

Get a list of Guestbooks for a Dataverse Collection
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

For more about guestbooks, see :ref:`dataset-guestbooks` in the User Guide.

Get a list of Guestbooks for a Dataverse Collection
You must have "EditDataverse" permission on the Dataverse collection.

.. 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/guestbooks/{ID}/list"`

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/guestbooks/root/list"

Get a Guestbook for a Dataverse Collection
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

For more about guestbooks, see :ref:`dataset-guestbooks` in the User Guide.

Get a Guestbook by its id

.. code-block:: bash

export API_TOKEN=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
export SERVER_URL=https://demo.dataverse.org
export ID=1234

curl -H "X-Dataverse-key:$API_TOKEN" "$SERVER_URL/api/guestbooks/{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" "https://demo.dataverse.org/api/guestbooks/1234"

Enable or Disable a Guestbook for a Dataverse Collection
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

For more about guestbooks, see :ref:`dataset-guestbooks` in the User Guide.

Use this endpoint to enable or disable the Guestbook. A Guestbook can not be deleted or modified since there may be responses linked to it.
You must have "EditDataverse" permission on the Dataverse collection.

.. code-block:: bash

export API_TOKEN=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
export SERVER_URL=https://demo.dataverse.org
export dataverseIdentifier=root
export ID=1234

curl -X PUT -d 'true' -H "X-Dataverse-key:$API_TOKEN" "$SERVER_URL/api/guestbooks/{dataverseIdentifier}/{ID}/enabled"

The fully expanded example above (without environment variables) looks like this:

.. code-block:: bash

curl -X PUT -d 'true' -H "X-Dataverse-key:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" "https://demo.dataverse.org/api/guestbooks/root/1234"

.. _collection-attributes-api:

Change Collection Attributes
Expand Down Expand Up @@ -1774,6 +1868,8 @@ In all commands below, dataset versions can be referred to as:
* ``x.y`` a specific version, where ``x`` is the major version number and ``y`` is the minor version number.
* ``x`` same as ``x.0``

.. _dataset-json-representation:

Get JSON Representation of a Dataset
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down
1 change: 1 addition & 0 deletions docker-compose-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ services:
-Ddataverse.pid.fake.label=FakeDOIProvider
-Ddataverse.pid.fake.authority=10.5072
-Ddataverse.pid.fake.shoulder=FK2/
#-Ddataverse.files.guestbook-at-request=true
#-Ddataverse.lang.directory=/dv/lang
ports:
- "8080:8080" # HTTP (Dataverse Application)
Expand Down
17 changes: 17 additions & 0 deletions scripts/api/data/guestbook-test-response.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{"guestbookResponse": {
"answers": [
{
"id": @QID1,
Copy link
Member

Choose a reason for hiding this comment

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

This is invalid JSON:

jq: parse error: Invalid numeric literal at line 4, column 24

You have to put the value in quotes.

Copy link
Contributor Author

@stevenwinship stevenwinship Mar 9, 2026

Choose a reason for hiding this comment

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

this is a template that get replaced with a long value so quotes are not needed

Copy link
Member

Choose a reason for hiding this comment

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

Interesting. I don't love it (seems like a code smell), but thanks for explaining.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Every time you run the test the IDs change so they need to be injected

Copy link
Member

Choose a reason for hiding this comment

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

Sure. I get it. I dunno, maybe you could rename it to guestbook-test-response-template.json or something. Obviously, if we could put comments in JSON, this would be a good place for them! 😄

No need to make any changes now. (We're on a time crunch to get 6.10 out.) Maybe the next time we crack open this code.

"value": "Good"
},
{
"id": @QID2,
"value": ["Multi","Line"]
},
{
"id": @QID3,
"value": "Yellow"
}
]
}
}
49 changes: 49 additions & 0 deletions scripts/api/data/guestbook-test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"name": "my test guestbook",
"enabled": true,
"emailRequired": true,
"nameRequired": true,
"institutionRequired": false,
"positionRequired": false,
"customQuestions": [
{
"question": "how's your day",
"required": true,
"displayOrder": 0,
"type": "text",
"hidden": false
},
{
"question": "Describe yourself",
"required": false,
"displayOrder": 1,
"type": "textarea",
"hidden": false
},
{
"question": "What color car do you drive",
"required": true,
"displayOrder": 2,
"type": "options",
"hidden": false,
"optionValues": [
{
"value": "Red",
"displayOrder": 0
},
{
"value": "White",
"displayOrder": 1
},
{
"value": "Yellow",
"displayOrder": 2
},
{
"value": "Purple",
"displayOrder": 3
}
]
}
]
}
13 changes: 11 additions & 2 deletions src/main/java/edu/harvard/iq/dataverse/CustomQuestion.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package edu.harvard.iq.dataverse;
import java.io.Serializable;
import java.util.List;

import jakarta.persistence.*;
import jakarta.validation.constraints.NotBlank;

import java.io.Serializable;
import java.util.List;
import java.util.stream.Collectors;

/**
*
* @author skraffmiller
Expand Down Expand Up @@ -92,6 +95,12 @@ public void setQuestionString(String questionString) {
public List<CustomQuestionValue> getCustomQuestionValues() {
return customQuestionValues;
}

public List<String> getCustomQuestionOptions() {
return customQuestionValues.stream()
.map(CustomQuestionValue::getValueString)
.collect(Collectors.toList());
}

public String getCustomQuestionValueString(){
String retString = "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
*/
package edu.harvard.iq.dataverse;

import java.io.Serializable;
import java.util.List;
import jakarta.faces.model.SelectItem;
import jakarta.persistence.*;

import java.io.Serializable;
import java.util.List;

/**
*
* @author skraffmiller
Expand Down
Loading
Loading