On this page:
How do I login/logout to/from a Form server?
...
Code Block |
---|
IDictionary<string,string> customParams = new Dictionary<string, string>();
customParams.Add("autoLogin", "true");
//customParams.Add("autoLoginupdateNonDesigners", "true"); string[] roles = { //if user is not a frevvo.Designer, this must be set for user to be officially 'created' otherwise user is truly virtual/temporary
string[] roles = { "frevvo.Designer" };
FormsService service = new FormsService("http://localhost:8082", "yourappname");
service.LoginAs(
"newUserName",
"tenantAdminUserName@myTenantName",
"tenantAdminPassword",
true,
roles, //optional param – may be null. Specified roles will be created if necessary. When null, a non-designer user (able to participate in flows but not create flows/forms) will be created if necessary.
"newUserFirstName", //optional param – may be null
"newUserLastName", //optional param – may be null
"newUserEmailName@EmailServer.com", //optional param – may be null
customParams);
UserEntry user = service.GetUser("newUserName");
// interact with frevvo
service.Logout();
|
...
Code Block |
---|
FormsService service = ...;
FormTypeQuery query = service.CreateFormTypeQuery(null);
FormTypeFeed themesformTypes = service.Query(query);
foreach (ThemeEntryFormTypeEntry formType in formTypes.Entries)
{
Console.WriteLine("Form Type: " + formType.Title.Text);
} |
How do I get the list of all forms for a given application?
...
There are three options when uploading a Flow or Form: Insert, Copy or Replace. You can use a Stream or a file path location when uploading.
Code Block |
---|
string fileName = ....;
bool isForm = ....;
ApplicationEntry appEntry = ....;
// If an entry with the same id already exists, it will be replaced.
// Otherwise, the archive will be uploaded with the same id.
FormTypeEntry entry = appEntry. FormTypeFeed.UploadAndInsertFormType(filename, isForm);
// If an entry with the same id already exists, a copy will be made.
// Otherwise, the archive will be uploaded with the same id.
FormTypeEntry entry = appEntry.FormTypeFeed.UploadAndCopyFormType(filename, isForm);
// If an entry with the same id already exists, it will be replaced.
// Otherwise, the archive will be uploaded with the same id.
FormTypeEntry entry = appEntry.FormTypeFeed.UploadAndReplaceFormType(filename, isForm);
Stream appStream = ....;
bool isForm = ....;
ApplicationEntry appEntry = ....;
// If an entry with the same id already exists, it will be replaced.
// Otherwise, the archive will be uploaded with the same id.
FormTypeEntry entry = appEntry. FormTypeFeed.UploadAndInsertFormType(appStream,isForm);
// If an entry with the same id already exists, a copy will be made.
// Otherwise, the archive will be uploaded with the same id.
FormTypeEntry entry = appEntry.FormTypeFeed.UploadAndCopyFormType(appStream, isForm);
// If an entry with the same id already exists, it will be replaced.
// Otherwise, the archive will be uploaded with the same id.
FormTypeEntry entry = appEntry.FormTypeFeed.UploadAndReplaceFormType(appStream, isForm); |
...
Note |
---|
The updates listed here are only available in .net client API version 6.1.2 or later. |
...
Code Block |
---|
|
FormsService myFormsService = ....;
FormTypeEntry publicFormType = ....; //may be created by any user as long as
//visibility is Visibility.PublicTenant
FormEntryBuilder fbe = new FormEntryBuilder(publicFormType);
fbe.Document("form","form.xml");fbe.WetSignature(sigControlId, "signature.png");
fbe.DigitalSignature("DigitalSignatures.xml");
fbe.Data("Name","Dudley");
fbe.Data("Description","DooWright");
FormEntry formEntry = fbe.CreateFormEntry(test2UserService);
|
Addition of required fileName parameter to stream-based FormEntryBuilder methods:
The filename attribute for stream-based methods for digital/wet signatures and documents is required. Methods without the filename parameter are deprecated.
Add a Document to the builder from a given stream
Section |
---|
Column |
---|
| Code Block |
---|
/// Add a Document to this builder from a given stream
public FormEntryBuilder Document(string partName, Stream inputStream, string
contentType, string fileName)
|
|
Column |
---|
| Note |
---|
This method deprecates the previous method:
public FormEntryBuilder Document(string partName, Stream inputStream, string contentType) |
|
|
Add a wet signature image to this builder from a given stream
Section |
---|
Column |
---|
| Code Block |
---|
/// Add a wet signature image to this builder from a given stream
public FormEntryBuilder WetSignature(string id, Stream inputStream, string contentType,
string fileName)
|
|
Column |
---|
| Note |
---|
This method deprecates the previous method: public FormEntryBuilder WetSignature(string id, Stream inputStream, string contentType) |
|
|
Add a Digital signature to this builder from a given stream
Section |
---|
Column |
---|
| Code Block |
---|
/// Add an xml signature to this builder from a given stream
public FormEntryBuilder DigitalSignature(Stream inputStream, string contentType, string
fileName)
|
|
Column |
---|
| Note |
---|
This method deprecates the previous method: public FormEntryBuilder DigitalSignature(Stream inputStream, string contentType) |
|
|
Get the Raw Link to the form/flow from the FormTypeEntry:
Code Block |
---|
FormTypeEntry fte = ….;
//Get Raw Link
AtomLink rawLink = fte.GetFormTypeLink(null); |
Add convenience method to upload schema file(s) in zip form:
Code Block |
---|
ApplicationEntry testApplication = ....;
SchemaEntry testSchema = ....;
string zipFileName = "\path\to\myschema.zip";
testSchema =
testApplication.SetupSchemaZip(zipFileName, "rootXSDFileName.xsd",
"schemaName-optional "); |
Added convenience method to upload Schema file(s) in .xsd file form:
Code Block |
---|
ApplicationEntry testApplication = ....;
SchemaEntry testSchema = ....;
string xsdFileName = "\path\to\myschema.xsd";
testSchema =
testApplication.SetupSchema(xsdFileName, "schemaName-optional"); |
Added convenience method to upload Schema file(s) in MediaSource form:
Code Block |
---|
ApplicationEntry testApplication = ....;
SchemaEntry testSchema = ....;
string fileName = "\path\to\myschema.xsd";
MediaFileSource source = new MediaFileSource(fileName, SchemaFeed.MEDIA_SOURCE_TYPE);
testSchema = testApplication.SetupSchema(source, "schemaName-required"); |
Functions only available in the .net api for v6.1.5 or later:
Note |
---|
The updates listed here are only available in .net client API version 6.1.5 or later. |
How do I batch upload users from the api?
Note |
---|
The format of the users csv file is the same as that used through the UI users load feature. |
Users csv upload is through HTTP.
The users csv upload is available directly through HTTP. One way to do this is using cURL, but other ways are possible. Here are the steps:
- Log in:
Code Block |
---|
curl http://host:port/frevvo/web/login -d username=admin@tenant -d password=admin_password -d lAction=Login -X POST -c cookies -H Content-Type:application/x-www-form-urlencoded |
2. Replace host, port, username and password above as correct for your implementation. For Live forms online, host=app.frevvo.com and the port is optional. Change http to https.
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 online, host=app.frevvo.com and port is optional. Change http to https.
5. Check the some_email_address for incoming email with the results of the load.
6. (Optional) Get the user csv back from frevvo. It will have all users, including all that were loaded:
Code Block |
---|
curl http://host:port/frevvo/web/tn/tenant.id/allUsers -X GET -b cookies |
7. The response will be the users csv data.
Users csv upload through the .net client api
The users csv upload is available through the .net client api in Live Forms v6.1.5. Here is the code snippet:
Code Block |
---|
Stream userCsvData = // Obtain a stream to your user csv file – ex: FileStream.
FormsService service = // Obtain form service logged in as tenant admin user
UserQuery userFeedQuery = service.CreateUserQuery(null);
UserFeed userFeed = service.Query(userFeedQuery);
stringnotificationEmailAddress = // some email address
userFeed.UploadUsersCsv(userCsvData, notificationEmailAddress);
//now check for the email with results |
To get the users csv data from frevvo:
Code Block |
---|
Stream is = userFeed.GetUsersCsv(); |
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 attached file, results.csv, will contain the details.