Skip to content

Commit

Permalink
api docu
Browse files Browse the repository at this point in the history
  • Loading branch information
florianthiery committed Dec 8, 2022
1 parent f52841c commit 1e577bf
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 0 deletions.
61 changes: 61 additions & 0 deletions src/main/java/de/rgzm/alligator/rest/AlligatorAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import de.rgzm.alligator.functions.Timeline;
import de.rgzm.alligator.log.Logging;
import de.rgzm.alligator.restconfig.ResponseGZIP;
import io.swagger.v3.oas.annotations.Hidden;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileOutputStream;
Expand All @@ -33,13 +34,15 @@
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import javax.ws.rs.QueryParam;

@Path("/")
public class AlligatorAPI {

@GET
@Path("/")
@Tag(name = "Info")
@Hidden
@Produces(MediaType.APPLICATION_JSON + ";charset=UTF-8")
@ApiResponse(
responseCode = "200",
Expand All @@ -63,6 +66,7 @@ public Response getInfo(@HeaderParam("Accept-Encoding") String acceptEncoding, @
@GET
@Path("/info")
@Tag(name = "Info")
@Hidden
@Produces(MediaType.APPLICATION_JSON + ";charset=UTF-8")
@ApiResponse(
responseCode = "200",
Expand Down Expand Up @@ -168,8 +172,19 @@ public Response loadCAgetMATRIXDIST(@HeaderParam("Accept-Encoding") String accep

@POST
@Path("/timeline")
@Tag(name = "Visualisation")
@Consumes(MediaType.TEXT_PLAIN)
@Produces(MediaType.APPLICATION_JSON + ";charset=UTF-8")
@ApiResponse(
responseCode = "200",
content = @Content(
mediaType = "application/json",
array = @ArraySchema(
schema = @Schema(implementation = String.class)
)
),
description = "get timeline as json"
)
public Response loadCAgetTIMELINEJSON(@HeaderParam("Accept-Encoding") String acceptEncoding, @HeaderParam("Accept") String acceptHeader, String tsv) throws IOException {
try {
String[] split = tsv.split("#data");
Expand Down Expand Up @@ -198,8 +213,19 @@ public Response loadCAgetTIMELINEJSON(@HeaderParam("Accept-Encoding") String acc

@POST
@Path("/graph")
@Tag(name = "Visualisation")
@Consumes(MediaType.TEXT_PLAIN)
@Produces(MediaType.APPLICATION_JSON + ";charset=UTF-8")
@ApiResponse(
responseCode = "200",
content = @Content(
mediaType = "application/json",
array = @ArraySchema(
schema = @Schema(implementation = String.class)
)
),
description = "get graph as json"
)
public Response loadCAgetGRAPHJSON(@HeaderParam("Accept-Encoding") String acceptEncoding, @HeaderParam("Accept") String acceptHeader, String tsv) throws IOException {
try {
String[] split = tsv.split("#data");
Expand Down Expand Up @@ -228,8 +254,19 @@ public Response loadCAgetGRAPHJSON(@HeaderParam("Accept-Encoding") String accept

@POST
@Path("/turtle")
@Tag(name = "Graph Data")
@Consumes(MediaType.TEXT_PLAIN)
@Produces(MediaType.TEXT_PLAIN + ";charset=UTF-8")
@ApiResponse(
responseCode = "200",
content = @Content(
mediaType = "application/json",
array = @ArraySchema(
schema = @Schema(implementation = String.class)
)
),
description = "get results as ttl"
)
public Response loadCAgetRDFFILE(@HeaderParam("Accept-Encoding") String acceptEncoding, @HeaderParam("Accept") String acceptHeader, String tsv) throws IOException {
try {
String[] split = tsv.split("#data");
Expand Down Expand Up @@ -258,8 +295,19 @@ public Response loadCAgetRDFFILE(@HeaderParam("Accept-Encoding") String acceptEn

@POST
@Path("/cypher")
@Tag(name = "Graph Data")
@Consumes(MediaType.TEXT_PLAIN)
@Produces(MediaType.TEXT_PLAIN + ";charset=UTF-8")
@ApiResponse(
responseCode = "200",
content = @Content(
mediaType = "application/json",
array = @ArraySchema(
schema = @Schema(implementation = String.class)
)
),
description = "get results as cypther"
)
public Response loadCAgetCYPHERFILE(@HeaderParam("Accept-Encoding") String acceptEncoding, @HeaderParam("Accept") String acceptHeader, String tsv) throws IOException {
try {
String[] split = tsv.split("#data");
Expand Down Expand Up @@ -288,8 +336,19 @@ public Response loadCAgetCYPHERFILE(@HeaderParam("Accept-Encoding") String accep

@POST
@Path("/amt")
@Tag(name = "Graph Data")
@Consumes(MediaType.TEXT_PLAIN)
@Produces(MediaType.TEXT_PLAIN + ";charset=UTF-8")
@ApiResponse(
responseCode = "200",
content = @Content(
mediaType = "application/json",
array = @ArraySchema(
schema = @Schema(implementation = String.class)
)
),
description = "get results as AMT ttl"
)
public Response loadCAgetAMTFILE(@HeaderParam("Accept-Encoding") String acceptEncoding, @HeaderParam("Accept") String acceptHeader, String tsv) throws IOException {
try {
String[] split = tsv.split("#data");
Expand Down Expand Up @@ -318,6 +377,7 @@ public Response loadCAgetAMTFILE(@HeaderParam("Accept-Encoding") String acceptEn

@POST
@Path("/amtrepo")
@Hidden
@Consumes(MediaType.TEXT_PLAIN)
@Produces(MediaType.TEXT_PLAIN + ";charset=UTF-8")
public Response loadCAgetAMTREPO(@HeaderParam("Accept-Encoding") String acceptEncoding, @HeaderParam("Accept") String acceptHeader, String tsv) throws IOException {
Expand Down Expand Up @@ -348,6 +408,7 @@ public Response loadCAgetAMTREPO(@HeaderParam("Accept-Encoding") String acceptEn

@POST
@Path("/turtlefile")
@Hidden
@Consumes(MediaType.TEXT_PLAIN)
@Produces("text/turtle;charset=UTF-8")
public Response loadCAgetRDF(@HeaderParam("Accept-Encoding") String acceptEncoding, @HeaderParam("Accept") String acceptHeader, String tsv) throws IOException {
Expand Down
1 change: 1 addition & 0 deletions src/main/webapp/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ <h1>alligator</h1>
<br>
<div><a href="rest/" target="_self">API</div></a>
<div><a href="rest/info" target="_self">API Documentation</div></a>
<div><a href="https://leiza-rse.github.io/api-docs/alligator/" target="_blank">API Documentation on GitHub</a></div>
<br>
<div>developed by Florian Thiery M.Sc. and Allard W. Mees (RGZM)</div>
</div>
Expand Down

0 comments on commit 1e577bf

Please sign in to comment.