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

Improvements on PR 10198 #10893

Open
DS-INRAE opened this issue Sep 30, 2024 · 0 comments
Open

Improvements on PR 10198 #10893

DS-INRAE opened this issue Sep 30, 2024 · 0 comments
Labels

Comments

@DS-INRAE
Copy link
Member

Following this PR :

Add the following small tweaks proposed by Phil, and convert the old style API docs to the new style with environment variables.

pdurbin@beamish dataverse % git diff --word-diff doc 
diff --git a/doc/sphinx-guides/source/api/native-api.rst b/doc/sphinx-guides/source/api/native-api.rst
index b16ea55bd2..9725602df4 100644
--- a/doc/sphinx-guides/source/api/native-api.rst
+++ b/doc/sphinx-guides/source/api/native-api.rst
@@ -5853,7 +5853,7 @@ Saved Search
~~~~~~~~~~~~

The Saved Search, Linked Dataverses, and Linked Datasets features are only accessible to superusers except for linking a dataset. The following API endpoints were added to help people with access to the "admin" API make use of these features in their current form. Keep in mind that they are partially experimental.
The update of all saved search is run by a timer once a week (See :ref:`saved-search-timer`) so if you just created a saved search, you can run manually {+the+} ``makelinks`` endpoint that will find new dataverses and datasets that match the saved search and then link the search results to the dataverse in which the saved search is defined.

List all saved searches. ::

@@ -5865,7 +5865,7 @@ List a saved search by database id. ::

Delete a saved search by database id.

The ``unlink=true`` query parameter unlinks all links (linked dataset or Dataverse collection) associated with the deleted saved search. Use of this parameter should be well considered as you cannot know if the links were created manually or by the saved search. After deleting a saved search with ``unlink=true``, we recommend running ``/makelinks/all`` just in case there was a dataset that was linked by another saved search. (Saved searches can link the same dataset.) Reindexing might be necessary as [-well.::-]{+well. ::+}

  DELETE http://$SERVER/api/admin/savedsearches/$id?unlink=true

pdurbin@beamish dataverse % git diff src            
diff --git a/src/main/java/edu/harvard/iq/dataverse/api/SavedSearches.java b/src/main/java/edu/harvard/iq/dataverse/api/SavedSearches.java
index 33a11a2df2..e6519c9ff3 100644
--- a/src/main/java/edu/harvard/iq/dataverse/api/SavedSearches.java
+++ b/src/main/java/edu/harvard/iq/dataverse/api/SavedSearches.java
@@ -181,7 +181,7 @@ public class SavedSearches extends AbstractApiBean {
         try {
             wasDeleted = savedSearchSvc.delete(doomedId, unlink);
         } catch (Exception e) {
-            return error(INTERNAL_SERVER_ERROR, "Problem while trying to unlink links of saved search id " + doomedId);
+            return error(INTERNAL_SERVER_ERROR, "Problem while trying to unlink links of saved search id " + doomedId + ". Exception: " + e.getLocalizedMessage());
         }
 
         if (wasDeleted) {
diff --git a/src/test/java/edu/harvard/iq/dataverse/api/SavedSearchIT.java b/src/test/java/edu/harvard/iq/dataverse/api/SavedSearchIT.java
index 90357596c2..cdcd92d930 100644
--- a/src/test/java/edu/harvard/iq/dataverse/api/SavedSearchIT.java
+++ b/src/test/java/edu/harvard/iq/dataverse/api/SavedSearchIT.java
@@ -22,7 +22,7 @@ public class SavedSearchIT {
 
     @BeforeAll
     public static void setUpClass() {
-
+        RestAssured.baseURI = UtilIT.getRestAssuredBaseUri();
     }
 
     @AfterAll
@@ -52,6 +52,7 @@ public class SavedSearchIT {
         createDatasetResponse2.prettyPrint();
         Integer datasetId2 = UtilIT.getDatasetIdFromResponse(createDatasetResponse2);
 
+        // TODO: put all these methods in UtilIT
         // missing body
         Response resp = RestAssured.given()
                 .contentType("application/json")
pdurbin@beamish dataverse % 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: 🕒 Planned Development
Development

No branches or pull requests

1 participant