Skip to content

Commit

Permalink
Add API access endpoints to ds-view
Browse files Browse the repository at this point in the history
Added for collections and bundles

resolves #18
  • Loading branch information
jordanpadams committed May 28, 2024
1 parent d17f60d commit dc3b6c7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/main/java/gov/nasa/pds/dsview/registry/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

package gov.nasa.pds.dsview.registry;

import java.util.Map;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* Class that holds constants used in ds-view.
*
Expand Down Expand Up @@ -202,6 +202,7 @@ public class Constants {
bundlePds4ToSearch.put("TYPE", "bundle_type");
bundlePds4ToSearch.put("DESCRIPTION", "description");
bundlePds4ToSearch.put("SEARCH/ACCESS DATA", "resource_ref");
bundlePds4ToSearch.put("API ACCESS", "api_ref");
}

public static final Map<String, String> bundleCitationPds4ToRegistry =
Expand Down Expand Up @@ -254,6 +255,7 @@ public class Constants {
collectionPds4ToSearch.put("TYPE", "collection_type");
collectionPds4ToSearch.put("DESCRIPTION", "description");
collectionPds4ToSearch.put("SEARCH/ACCESS DATA", "resource_ref");
collectionPds4ToSearch.put("API ACCESS", "api_ref");
}

public static final Map<String, String> documentPds4ToSearch = new LinkedHashMap<String, String>();
Expand Down
8 changes: 8 additions & 0 deletions src/main/webapp/pds/viewBundle.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,14 @@
}
} // end if (resourceRefs != null)
}
else if (tmpValue.equals("api_ref")) {
%>
<a href="https://pds.nasa.gov/api/search/1/products/<%=bundleLid%>" target="_new">/products/<%=bundleLid%></a><br>
<a href="https://pds.nasa.gov/api/search/1/products/<%=bundleLid%>/members" target="_new">/products/<%=bundleLid%>/members</a><br>
<a href="https://pds.nasa.gov/api/search/1/products/<%=bundleLid%>/members/members" target="_new">/products/<%=bundleLid%>/members/members</a><br>
<a href="https://nasa-pds.github.io/pds-api/guides/search.html" target="_new">API Documentation</a><br />
<%
}
else {
//out.println("tmpValue = " + tmpValue + "<br>");
List<String> values = pds4Search.getValues(doc, tmpValue);
Expand Down
8 changes: 7 additions & 1 deletion src/main/webapp/pds/viewCollection.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,13 @@
<%
}
} // end if (resourceRefs != null)
} else {
} else if (tmpValue.equals("api_ref")) {
%>
<a href="https://pds.nasa.gov/api/search/1/products/<%=collectionLid%>" target="_new">/products/<%=collectionLid%></a><br>
<a href="https://pds.nasa.gov/api/search/1/products/<%=collectionLid%>/members" target="_new">/products/<%=collectionLid%>/members</a><br>
<a href="https://nasa-pds.github.io/pds-api/guides/search.html" target="_new">API Documentation</a><br />
<%
} else {
//out.println("tmpValue = " + tmpValue + "<br>");
List<String> values = pds4Search.getValues(doc, tmpValue);
if (values!=null) {
Expand Down

0 comments on commit dc3b6c7

Please sign in to comment.