import body.doc.DeParaTemplate;
import body.doc.DocFromTemplate;
import docs.DocRequests;
import response.DocResponse;
import services.JsonConverter;
import java.util.ArrayList;
String apiToken = "YOUR TOKEN";
DeParaTemplate deParaTemplateName = DeParaTemplate.deParaTemplateBuilder()
.de("{{FULL NAME}}")
.para("Full Name")
.build();
DeParaTemplate deParaTemplateNumber= DeParaTemplate.deParaTemplateBuilder()
.de("{{SOCIAL SECURITY NUMBER}}")
.para("Social Security Number")
.build();
DeParaTemplate deParaTemplateAddress = DeParaTemplate.deParaTemplateBuilder()
.de("{{FULL ADDRESS}}")
.para("Full address")
.build();
ArrayList<DeParaTemplate> deParaTemplates = new ArrayList<>();
deParaTemplates.add(deParaTemplateName);
deParaTemplates.add(deParaTemplateCpf);
deParaTemplates.add(deParaTemplateEnd);
DocFromTemplate docFromTemplate = DocFromTemplate.docFromTemplateBuilder()
.sandbox(false)
.brand_primary_color("#000000")
.lang("en")
.signer_name("My Signer for template")
.template_id("75a3a92b-...")
.data(deParaTemplates)
.build();
try {
DocResponse docResponse = new DocRequests(apiToken).createDocFromTemplate(docFromTemplate);
String jsonDocResponse = new JsonConverter().docResponseToJson(docResponse);
System.out.println(jsonDocResponse);
}
catch(Exception exceptionError) {
System.out.println(exceptionError.getMessage());
}
import body.doc.DeParaTemplate;
import body.doc.DocFromTemplate;
import docs.DocRequests;
import response.DocResponse;
import services.JsonConverter;
import java.util.ArrayList;
public class CreateDocFromTemplate {
public static void main(String[] args) throws Exception {
String apiToken = "YOUR TOKEN";
DeParaTemplate deParaTemplateName = DeParaTemplate.deParaTemplateBuilder()
.de("{{FULL NAME}}")
.para("Full Name")
.build();
DeParaTemplate deParaTemplateNumber= DeParaTemplate.deParaTemplateBuilder()
.de("{{SOCIAL SECURITY NUMBER}}")
.para("Social Security Number")
.build();
DeParaTemplate deParaTemplateAddress = DeParaTemplate.deParaTemplateBuilder()
.de("{{FULL ADDRESS}}")
.para("Full address")
.build();
ArrayList<DeParaTemplate> deParaTemplates = new ArrayList<>();
deParaTemplates.add(deParaTemplateName);
deParaTemplates.add(deParaTemplateCpf);
deParaTemplates.add(deParaTemplateEnd);
DocFromTemplate docFromTemplate = DocFromTemplate.docFromTemplateBuilder()
.sandbox(false)
.brand_primary_color("#000000")
.lang("en")
.signer_name("My Signer for template")
.template_id("75a3a92b-36d5-451f-95cd-5af9a927a392")
.data(deParaTemplates)
.build();
try {
DocResponse docResponse = new DocRequests(apiToken).createDocFromTemplate(docFromTemplate);
String jsonDocResponse = new JsonConverter().docResponseToJson(docResponse);
System.out.println(jsonDocResponse);
}
catch(Exception exceptionError) {
System.out.println(exceptionError.getMessage());
}
}
}