@POST
    public Response createTransaction(@PathParam("path") final String externalPath) throws URISyntaxException {

        if (batchService.exists(session.getId(), getUserPrincipal())) {
            LOGGER.debug("renewing transaction {}", session.getId());
            batchService.refresh(session.getId(), getUserPrincipal());
            final Response.ResponseBuilder res = noContent();
            session.getFedoraSession().getExpires().ifPresent(expires -> {
                res.expires(from(expires));
            });
            return res.build();
        }

        if (externalPath != null && !externalPath.isEmpty()) {
            return status(BAD_REQUEST).build();
        }

        batchService.begin(session.getFedoraSession(), getUserPrincipal());
        session.makeBatchSession();
        LOGGER.info("Created transaction '{}'", session.getId());

        final Response.ResponseBuilder res = created(
                new URI(translator().toDomain("/tx:" + session.getId()).toString()));
        session.getFedoraSession().getExpires().ifPresent(expires -> {
            res.expires(from(expires));
        });
        return res.build();
    }
@ POST public Response createTransaction ( @ PathParam ( "path" ) final String externalPath ) throws URISyntaxException { if ( batchService . exists ( session . getId ( ) , getUserPrincipal ( ) ) ) { LOGGER . debug ( "renewing transaction {}" , session . getId ( ) ) ; batchService . refresh ( session . getId ( ) , getUserPrincipal ( ) ) ; final Response . ResponseBuilder res = noContent ( ) ; session . getFedoraSession ( ) . getExpires ( ) . ifPresent ( expires -> { res . expires ( from ( expires ) ) ; } ) ; return res . build ( ) ; } if ( externalPath != null && ! externalPath . isEmpty ( ) ) { return status ( BAD_REQUEST ) . build ( ) ; } batchService . begin ( session . getFedoraSession ( ) , getUserPrincipal ( ) ) ; session . makeBatchSession ( ) ; LOGGER . info ( "Created transaction '{}'" , session . getId ( ) ) ; final Response . ResponseBuilder res = created ( new URI ( translator ( ) . toDomain ( "/tx:" + session . getId ( ) ) . toString ( ) ) ) ; session . getFedoraSession ( ) . getExpires ( ) . ifPresent ( expires -> { res . expires ( from ( expires ) ) ; } ) ; return res . build ( ) ; }
Create a new transaction resource and add it to the registry

@param externalPath the external path
@return 201 with the transaction id and expiration date
@throws URISyntaxException if URI syntax exception occurred