Skip to content
This repository was archived by the owner on Mar 4, 2021. It is now read-only.
Merged
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
Prev Previous commit
Next Next commit
Add URL target to allow adding events with a GET call
  • Loading branch information
ebukoski committed Nov 30, 2015
commit 1f0ed656dc8f362073ee93433601ac9f95e8bf74
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
Expand Down Expand Up @@ -72,6 +73,23 @@ public JanitorMonkeyResource(JanitorMonkey monkey) {
public JanitorMonkeyResource() {
this.monkey = MonkeyRunner.getInstance().factory(JanitorMonkey.class);
}

/**
* GET /api/v1/janitor/addEvent will try to a add a new event with the information in the url query string.
* This is the same as the regular POST addEvent except through a query string. This technically isn't
* very REST-ful as it is a GET call that creates an Opt-out/in event, but is a convenience method
* for exposing opt-in/opt-out functionality more directly, for example in an email notification.
*
* @param eventType eventType from the query string
* @param resourceId resourceId from the query string
* @return the response
* @throws IOException
*/
@GET @Path("addEvent")
public Response addEventThroughHttpGet( @QueryParam("eventType") String eventType, @QueryParam("resourceId") String resourceId) throws IOException {
String content = "{\"eventType\":\"" + eventType + "\",\"resourceId\":\"" + resourceId + "\"}";
return addEvent(content);
}

/**
* POST /api/v1/janitor will try a add a new event with the information in the url context.
Expand Down