mulesoft-labs/raml-java-client-generator

post example with body request as json file

Closed this issue · 2 comments

Please provide a POST method example using body request.
is there a way to set the body request from a json file?

thanks in advance for your support and time.
regards
Edson

I found how to populate the POSTBody request from a json string
using ObjectMapper:

import com.fasterxml.jackson.databind.ObjectMapper;
        SubmitPOSTBody body;
    	String json = json();
        ObjectMapper mapper = new ObjectMapper();
        try {
        	body = mapper.readValue(json, SubmitPOSTBody.class);
                Response<SubmitPOSTResponseBody> result = 
                	Client.create().application.submit.post(body());

resolved how to populate body request from json file