code: @POST
     @Consumes({"script/groovy"})
     @Path("add/{repository}/{workspace}/{path:.*}")
     public Response addScript(InputStream stream, @Context UriInfo uriInfo, @PathParam("repository") String repository,
        @PathParam("workspace") String workspace, @PathParam("path") String path)
     {
        Session ses = null;
        try
        {
           ses =
              sessionProviderService.getSessionProvider(null).getSession(workspace,
                 repositoryService.getRepository(repository));
           Node node = (Node)ses.getItem(getPath(path));
           createScript(node, getName(path), false, stream);
           ses.save();
           URI location = uriInfo.getBaseUriBuilder().path(getClass(), "getScript").build(repository, workspace, path);
           return Response.created(location).build();
        }
        catch (PathNotFoundException e)
        {
           String msg = "Path " + path + " does not exists";
           LOG.error(msg);
           return Response.status(Response.Status.NOT_FOUND).entity(msg).entity(MediaType.TEXT_PLAIN).build();
        }
        catch (Exception e)
        {
           LOG.error(e.getMessage(), e);
           return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(e.getMessage())
              .type(MediaType.TEXT_PLAIN).build();
        }
        finally
        {
           if (ses != null)
           {
              ses.logout();
           }
        }
     }
docs: This method is useful for clients that can send script in request body
  without form-data. At required to set specific Content-type header
  'script/groovy'.
  
  @param stream the stream that contains groovy source code
  @param uriInfo see javax.ws.rs.core.UriInfo
  @param repository repository name
  @param workspace workspace name
  @param path path to resource to be created
  @return Response with status 'created'
  @request
  {code}
  "stream" : the input stream that contains groovy source code
  {code}
  @LevelAPI Provisional