Wowza Community

Cannot start recorder getting 400 error

Hi,

I have an old wowza app that was originaly for 3.X wowza I am using 4.5 now. Before I was connecting via a rtmp client to start recording my streams. It was not working on wowza 4.5 so I decided to update it anyways and start using the Rest Api.

This is my code

public void grabar(final String streamName) throws InterruptedException {
System.out.println("Empezar a grabar");
        clientREST = new ResteasyClientBuilder().build();
        clientREST.register(new BasicAuthentication(userWowza, passWowza));
        String targetStr = "http://" + host + ":" + portEndpoint + endPoint + app + "/instances/_definst_/streamrecorders/"+streamName;
        //http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/live/instances/_definst_/streamrecorders/myStream 
        System.out.println("target: " + targetStr);

        ResteasyWebTarget target = clientREST.target(targetStr);

        target.register(new BasicAuthentication(userWowza, passWowza));
        
        StreamRecorderConfigDTO recorder = new StreamRecorderConfigDTO();
        
        recorder.setRecorderName(streamName);
        recorder.setCurrentSize(0);
        recorder.setStartOnKeyFrame(true);
        recorder.setRecordData(false);
        recorder.setSegmentSize(0);
        recorder.setDefaultRecorder(false);
        recorder.setMoveFirstVideoFrameToZero(false);
        recorder.setSplitOnTcDiscontinuity(false);
        recorder.setSegmentDuration(0);
        recorder.setBackBufferTime(0);
        recorder.setCurrentDuration(0);
        
          
        Response response = target.request().accept("application/json").
                post(Entity.entity(recorder, "application/json; charset=utf-8"));//target.request().accept("application/json").g

        if (response.getStatus() != 200) {
            throw new RuntimeException("Failed : HTTP error code : " + response.getStatus());
        }

        response.close();
}

StreamRecorderConfigDto is an object based from the docs. I get the following error

Caused by: java.lang.RuntimeException: Failed : HTTP error code : 400.

The streamName does exist. I dont know if I should send more data or less stuff

I am basing my example from this

[https://www.wowza.com/docs/stream-recording-query-examples](http://wowza stream recording examples)