/** * Create new application * * <p>Example: POST /applications * * @return device with new id (on create) */ @POST @Path("applications") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) public Application createApp(Application app) throws AppException { applicationRepository.saveOrUpdate(app); // return app back with an id return app; }
/** * Update application data * * <p>Example: PUT /applications/1 * * @return user with given id */ @PUT @Path("applications/{aid: \\d+}") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) public Application updateUser(@PathParam("aid") Integer aid, Application app) throws AppException { app.setId(aid); applicationRepository.saveOrUpdate(app); // return the user back with an id return app; }