The FAQs provide some examples and code snippets for common tasks when a third-party application wants to interact with the server.
...
Code Block |
---|
/ formTypeID of your form. You can get the formTypeId of a form by looking at its Share URL. For example, if your forms Raw URL is: http://localhost:8082/frevvo/web/tn/qa/user/fd/app/_S5QyQQ8GEeKoZPV3UpCRog/formtype/_W03sMA8GEeKoZPV3UpCRog?_method=post&embed=true&locale=, then the part of this URL between formtype/ and ?_method is your formTypeId. String formTypeId = "_W03sMA8GEeKoZPV3UpCRog"; // Get the Forms Service. FormsService service = new FormsService("http", "localhost", 8082, null); service.login("designer@tutorial", "designerpswd"); // Get Submission Feed SubmissionQuery q = new SubmissionQuery(service.getFeedURL(SubmissionFeed.class)); q.setFilter("$formTypeId eq " + formTypeId); q.setOrderby("$updated"); SubmissionFeed sFeed = service.getFeed(q, SubmissionFeed.class); int counter = 1; // Download PDF for each submission for (SubmissionEntry contact : sFeed.getEntries()) { // re-instantiate the form from the submission URL fUrl = contact.createFormInstance(null, null); // Construct the URL which will generate the PDF String pdfUrl = fUrl.toString() + "&print=true&format=pdf"; String filename = "E:\\myFormPDF" + counter + ".PDF"; BufferedInputStream in = null; FileOutputStream fout = null; try { MediaSource source = service.getMedia(pdfUrl); in = new BufferedInputStream(new URL(pdfUrl).openStreamsource.getInputStream()); fout = new FileOutputStream(filename); byte data[] = new byte[1024]; int count; while ((count = in.read(data, 0, 1024)) != -1) { fout.write(data, 0, count); } } finally { if (in != null) in.close(); if (fout != null) fout.close(); } counter ++; // Cancel the instance Helper.cancelInstance(service, fUrl); } |
...
You can specify who receives an email reporting the upload status when it is done through the API. The email is sent to the "notificationEmailAddress" that is passed in the API. The email may say something like this if there are errors during the upload:
Code Block |
---|
Validation occurred with errors. Users data NOT loaded. Refer to attached CSV data file for validation and/or loading result details. |
...