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

Add API access endpoints to ds-view #30

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
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
Loading