Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The FAQs provide some examples and code snippets for common tasks when a third-party application wants to interact with the server.

...

Note

You can only insert into a feed that has an explicit owner, which is guaranteed above by getting the FormTypeFeed from the ApplicationEntry as opposed to getting a FormTypeFeed containing forms for all applications.

 


How do I download an existing form?

...

Here are the steps:

  1. Log in using the built-in admin:

Code Block
curl http://host:port/frevvo/web/admin/login -d username=admin@tenant -d password=admin_password -d lAction=Login  -X POST  -c cookies -H Content-Type:application/x-www-form-urlencoded  

...

Info

If your tenant is on the frevvo cloud server, and you see the error "Couldn't open file "users.csv", perform one of the following actions:

  • Update the trusted certificate authorities present on your client machine
  • Disable the certificate check with the cURL -k option:
 
Code Block
curl http://host:port/frevvo/web/admin/login -d username=admin@tenant -d password=admin_password -d lAction=Login  -X POST  -c cookies -H Content-Type:application/x-www-form-urlencoded -k


 

      3. Upload the users csv file:  

Code Block
curl http://host:port/frevvo/web/tn/tenant.id/allUsers  -F notificationEmailAddress=some_email_address -F usersFile=@users_file.csv  -X POST  -b cookies -H Content-Type:multipart/form-data

      4. Replace host, port, tenant.id, some_email_address and users_file.csv above as correct for your implementation. If users_file.csv is not in the current directory, adjust the path accordingly. For Live forms frevvo online, host=app.frevvo.com and port is optional. Change http to https.

...

Code Block
curl http://host:port/frevvo/web/tn/tenant.id/allUsers  -X GET  -b cookies

For Live forms frevvo online, host=app.frevvo.com and port is optional. Change http to https and add the -k option

...

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.

...

The same code works for either a form or workflow.  The code assumes the form/flow has an upload control with the name “upload”. 


Code Block
FormTypeEntry ftEntry = …;  // See other examples for ways to derive the form type entry of the form/flow

FormEntryBuilder builder = ftEntry.createInstanceBuilder();

// attach several files to a single upload control
InputStream in = …; // Get attachment file 1 as input stream somehow
builder.attachment("upload", "image/png", “some_filename_1.png", in);   // parameters: upload control name, mime content type, the file name, input stream

URL imageUrl = new URL("http://www.example.com/some_image.png”);        // get this one remotely
builder.attachment("upload", "image/png", imageUrl);   

// create the form/flow instance
FormEntry fEntry = builder.createInstance();

// get the form/flow url to show to the user
URL fEntryURL = new URL(fEntry.getFormUseLink().getHref());