I want to display info about Subdepartments using multiple id's provided.This is what I have. Now, what would an example of url with multiple parameters? I tried comma, slash but didnt work
@Path( "{id: .*}" )
@GET
public Collection< SubDepartmentDTO > findMultiple ( @PathParam ( "id" ) List<Integer> idList ) {
Map< Integer, SubDepartmentDTO > subList = new LinkedHashMap<>();
int index = 0;
while( index < idList.size() ){
subList.put( idList.get(index), SubDepartmentDAO.findOne ( idList.get(index) ) );
index++;
}
return subList.values();
}
You cant use an array as path parameter, see the docs, in particular:
If what you are trying to achieve
/resource/id/subid/subsubid
then answer to this question will help you.However, if this hierarchy doesn't make sense in your case and you want to get list of departments on the same level (i.e. subid1, subid2, etc), maybe you want to use query parameter instead of path parameter.