I have a macro, how can I use it to create new pages and fill them with data?

public class printer implements Macro {

public String execute(Map<String, String> map,
                      String s,
                      ConversionContext conversionContext) throws MacroExecutionException {

What tools, libraries to use?
REST API? Please show me some simple example of creating new pages and filling them with information.
(Java Language)

   return "Excellent";
}

public BodyType getBodyType() {
    return BodyType.NONE;
}

public OutputType getOutputType() {
    return OutputType.BLOCK;
}

}