Skip to content

Commit

Permalink
Updated REST method addAttributeOption from PUT to POST
Browse files Browse the repository at this point in the history
  • Loading branch information
gasparez15 committed May 4, 2023
1 parent bfcbe2e commit ffc34aa
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.FormParam;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
Expand Down Expand Up @@ -40,12 +41,13 @@ public interface DocumentMetadataService {
*
* @throws Exception error in the server application
*/
@PUT
@POST
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
@Path("/addAttributeOption")
public void addAttributeOption(
@QueryParam("setId") long setId,
@QueryParam("attribute")
String attribute, @QueryParam("option") WSAttributeOption option)
@FormParam("setId") long setId,
@FormParam("attribute") String attribute,
@FormParam("option") WSAttributeOption option)
throws Exception;

/**
Expand All @@ -63,7 +65,7 @@ public void setAttributeOptions(@QueryParam("setId")
long setId, @QueryParam("attribute")
String attribute, @QueryParam("options")
WSAttributeOption[] options) throws Exception;

/**
* Saves the options for the given attribute with a POST method. This is
* useful for very large lists of values
Expand All @@ -80,8 +82,7 @@ public void setAttributeOptions(@QueryParam("setId")
public void setAttributeOptionsPOST(
@Multipart(value = "setId") Long setId,
@Multipart(value = "attribute") String attribute,
@Multipart(value = "options", type = "application/json") WSAttributeOption[] options) throws Exception;

@Multipart(value = "options", type = "application/json") WSAttributeOption[] options) throws Exception;

/**
* Create/Update an attribute set. You can completely customize the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.FormParam;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
Expand Down Expand Up @@ -171,7 +172,7 @@ public void setAttributeOptionsPOST(
// }

super.setAttributeOptions(sid, setId, attribute, options);
}
}

public class SetAttributeOptionsMultipartRequest {

Expand All @@ -185,10 +186,11 @@ public class SetAttributeOptionsMultipartRequest {
}

@Override
@PUT
@POST
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
@Path("/addAttributeOption")
@Operation(summary = "Adds a new attribute option with a POST method", description = "Adds the new option for the given attribute with a POST method.")
public void addAttributeOption(@QueryParam("setId") long setId, @QueryParam("attribute") String attribute, @QueryParam("option") WSAttributeOption option) throws Exception {
public void addAttributeOption(@FormParam("setId") long setId, @FormParam("attribute") String attribute, @FormParam("option") WSAttributeOption option) throws Exception {

// log.debug("addAttributeOption");

Expand Down

0 comments on commit ffc34aa

Please sign in to comment.