The requestEndPoint is accessible in the WebServiceBeforeOperationRule. It includes details such as the header, body, context URL, method type, response attribute map, and response code.
You can adjust the JSON body according to your needs. In your case, you can include the folderId in the JSON body.
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
Map requestMap = requestEndPoint.getBody();
// Assuming mapper is your ObjectMapper instance
String jsonBody = (String) requestMap.get("jsonBody");
JsonNode jsonNode = mapper.readTree(jsonBody);
// Create a new ObjectNode based on the existing jsonNode
ObjectNode updatedJsonNode = (ObjectNode) jsonNode.deepCopy();
String folderId = "yourFolderId"; // Replace with your actual folderId value
updatedJsonNode.put("folderId", folderId);
String updatedJsonBody = mapper.writeValueAsString(updatedJsonNode);
// Use updatedJsonBody as needed
requestMap.put("jsonBody",updatedJsonBody);
requestEndPoint.setBody(requestMap);