Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

Section
Column

This tutorial will walk-through a few API scenarios focusing on the design-time integration such as creating new forms, listing and managing applications, launching the designer for a flow, downloading schemas, applications, forms and flows, download the XSD for a form/flow, uploading custom XSDs, using forms and flows.

...

Column
width240px

On this page:

Table of Contents
maxLevel1

 

What are we going to build?

...

Nothing. We have pre-created a simple application that shows the different usages of the API using an interactive command-line approach. Think of this app as the command-line version of the web-base frevvo UI but stripped of all the irrelevant details, libraries, etc., so you can inspect the different API usages as simply as possible using live code with sources included.

Although this approach makes it a bit harder to piece together a given API usage since it will be comprised of a set of different paths through the sources, we believe it will provide for a better learning tool since you will be able to inspect the sources, which will be running sources, or even debug the app if needed, after all this is an API we are talking about. We have also chosen an interactive command-line application format so that we would be able to reduce the code footprint to a bare minimum increasing the clarity needed to understand it. Besides, this tutorial should be the guide through the different API usages that may not be obvious by simply inspecting the source code.==

Downloading the command-line client

...

The client is packaged as an executable Java JAR that includes all of the required dependencies and you can download the [http://test.frevvo.com/bucket/com.frevvo.forms.cli.jar binaries] from here and the [http://test.frevvo.com/bucket/com.frevvo.forms.cli-sources.jar sources] from here.== binaries  from here and the sources from here.

Running the command-line client

...

Assuming that you have a Java Runtime Environment (JRE or JDK) version installed, version 1.5 or greater, you can run the client as follows:<pre>

Code Block
java -jar com.frevvo.forms.cli.jar

</pre>This should show you usage information:<pre>

Code Block
usage: com.frevvo.forms.cli.Main

...


-s,--server <arg> serverl url (e.g. http://localhost:8082)

...


-t,--tenant <arg> tenant (optional, e.g. doe.com)

</pre>So you if you want to connect to a frevvo install  install running on localhost you can do as follows:<pre>

Code Block
java -jar com.frevvo.forms.cli.Main -s http://localhost:8082

...

And you should see the command line prompt:<pre>

Code Block
localhost:

...

8082> 

This means that you are up and running, but not yet connected. First you need to log in to a frevvo account. Be sure to create at least one tenant and one user for the tenant before you try to log in. See [[DataAPI_DesigntimeIntegration#Connect_to_a_frevvo_Server_and_Log_In | Connect to a frevvo Server and Log In]] below  below for instructions.==

How are the sources organized?

...

The key concept you need to know to understand the sources is the '''Shell'''. Each feed and entry described in the previous diagram will have a corresponding '''Shell''' class Shell class (with the exception of FormTypeTemplateFeed/Entry) that is used to plug into the command line interface the different commands available. The commands available in the app at any given point in time are defined based on what '''Shell''' is Shell is active. When you issue commands in the prompt, you may remain in the same Shell or navigate the Shell tree and change the active Shell. Changing the active '''Shell''' changes Shell changes the available commands at the prompt.

Some commands are not specific to a given shell, but are common across all shells. They are:* '''

  • ?list

...

  •  - This command will print out a list of all the currently available commands with a brief description and the number of arguments it expects, if it expects any.

...

  • exit - This is how exit the current shell and 'back up' and and return to the previous one (some commands you execute may activate a new shell). Exiting from the last shell will exit the app.

Here are the shells you can find in this app (all located in the '''com.frevvo.forms.cli.shell.*''' package):* '''

  • com.frevvo.forms.cli.shell.ApplicationEntryShell

...

...

  • com.frevvo.forms.cli.shell.ApplicationFeedShell

...

...

  • com.frevvo.forms.cli.shell.ControlTypeEntryShell

...

...

  • com.frevvo.forms.cli.shell.ControlTypeFeedShell

...

...

  • com.frevvo.forms.cli.shell.DocumentTypeFeedShell

...

  • com.frevvo.forms.cli.shell.DocumentTypeEntryShell

...

...

  • com.frevvo.forms.cli.shell.FormTypeEntryShell

...

...

  • com.frevvo.forms.cli.shell.FormTypeFeedShell

...

...

  • com.frevvo.forms.cli.shell.SchemaEntryShell

...

...

  • com.frevvo.forms.cli.shell.SchemaFeedShell

...

...

  • com.frevvo.forms.cli.shell.SubmissionEntryShell

...

...

  • com.frevvo.forms.cli.shell.SubmissionFeedShell

...

...

  • com.frevvo.forms.cli.shell.TaskEntryShell

...

...

  • com.frevvo.forms.cli.shell.TaskFeedShell

...

...

  • com.frevvo.forms.cli.shell.ThemeEntryShell

...

...

  • com.frevvo.forms.cli.shell.ThemeFeedShell

...

...

  • com.frevvo.forms.cli.shell.UserEntryShell

...

...

  • com.frevvo.forms.cli.shell.UserFeedShell

...

...

  • com.frevvo.forms.cli.shell.FormInstanceShell

...

Note

The FormInstanceShell has no corresponding feed/entry in the Data API. It is used to provide a context for commands that interact with a form instance (e.g. submitting a form, resetting a form, etc)

If you inspect the sources for each of these classes you will notice some methods are annotated with a special '''Command''' metadata Command metadata: this is where we specify what is the command's name in the command-prompt and it's description (used by '''?print''' described  described above).

Now let's move on to some usage scenarios.==

Usage Scenarios

...

The following topics show how to log in to the frevvo server  server and use the command line API to interact with the server, applications, and forms and flows.===

Connect to

...

a Server and Log In

...

The example below shows how to log in to a local frevvo server server. In this example, the login user name is '''david''', the name of the tenant is '''monahan.com''', and the user password is '''david''' david (e.g., '''login david@monahan.com david''').Note that to

Note

To login, you must first create a tenant on the server (other than the default

...

d

...

tenant). You should also create a user such as a

...

frevvo.designer

...

or an

...

admin

...

user.

...

Code Block
Directory of D:\frevvo v4.1.4

...



08/05/2011 08:59a <DIR> .

...


08/05/2011 08:59a <DIR> ..

...


08/05/2011 08:59a 3,044,609 com.frevvo.forms.cli.jar

...


07/12/2011 09:20a <DIR>

...

 frevvo
        1 File(s) 3,044,609

...

 bytes
        3 Dir(s) 7,803,990,016 bytes free

...



D:\frevvo v4.1.4>java -jar com.frevvo.forms.cli.jar

...



usage: com.frevvo.forms.cli.Main

...


-s,--server <arg> serverl url (e.g. http://localhost:8082)

...


-t,--tenant tenant (optional, e.g. doe.com)

...



D:\frevvo v4.1.4>java -jar com.frevvo.forms.cli.jar -s http://localhost:8082

...



localhost:

...

8082> ?list

...


Name     Abbr     ArgNum     Descr

...


login     l         1        login(username:String) : String

...


login     l         2        login(username:String, password:String) : String

...


login-as  la        2        loginAs(username:String, tenantAdmin:String) : String

...


login-as  la        3        loginAs(username:String, tenantAdmin:String, tenantAdminPassword:String) : String

...


print     p         0         print() : String

...


localhost:

...

8082> login david@monahan.com david

...


----------------------------------------------------------------------------------------

...


        ID  | david
        URL | http://localhost:8082/frevvo/web/tn/monahan.com/api/user/david

...


    UPDATED | 2011-08-05T09:52:45.510-04:00

...


       NAME | david
DESCRIPTION | null
----------------------------------------------------------------------------------------

...

After you've logged in, use '''?list''' to display  to display commands you can use in the server. For example, you can use '''apps''' to apps to work with the applications on the server.<pre>

Code Block
localhost:8082/david@monahan.

...

com> ?list

...



Name     Abbr     ArgNum     Descr
apps                0        SELECT apps for this user (e.g. 'apps')

...


subs                0        SELECT subs for this user (e.g. 'subs') you

...


tasks               0        SELECT tasks for this user (e.g. 'tasks')

...


themes              0        SELECT themes for this user (e.g. 'themes')

...


link      l         1        OPEN a link in the browser (e.g. 'link {link#}')

...


descr     d         1        UPDATE this entry's description (e.g. 'descr {newDescription}')

...


links     l         0        SHOW all entry links (e.g. 'links')

...


links     li        1        SHOW feed links for given rel attr (e.g. 'links {relAttr}')

...


name      n         1        UPDATE this entry's name (e.g. 'name {newName}')

...


print     p         0        PRINT this entry (e.g. 'print')

...


delete    d         0        DELETE this entry (e.g. 'delete')

...


refresh

...

   r         0        REFRESH this entry (e.g. 'refresh')

...

The frevvo UI  UI displays the applications belonging to the user ''david@monahan.com'' on  on the applications home page.

[[Image:api-pix_UI_AppsList.png]]Image Added

The '''apps''' command apps command displays a list of the applications in the tenant on the server — ''DTM July 2011'' and ''DTM  DTM August 2011'' in  in this example.<pre>

Code Block
localhost:8082/david@monahan.

...

com> apps

...


----------------------------------------------------------------------------------------

...


URL ! http://localhost:8082/frevvo/web/tn/monahan.com/api/apps

...


    # | NAME                                   | DESCRIPTION

...


1 | DTM July 2011                              | Group of test forms created by DTM.

...


2 | DTM August 2011                            | Forms started in August.

...


----------------------------------------------------------------------------------------

...

Now that you're in '''apps''' ('' apps (../monahan.com/api/apps''), use the '''?list''' command  command to see what you can do.<pre>

Code Block
localhost:8082/david@monahan.com/

...

apps> ?list

...


Name    Abbr

...

     ArgNum     Descr
up                 1        UPLOAD an application (e.g. 'up /var/contacts_apps.zip')

...


down               0        DOWNLOAD ALL applications into temp folder (e.g.: 'download')

...


link     l         1        OPEN a link in the browser (e.g. 'openLink {link#}')

...


links    li        1        SHOW feed links for given rel attr (e.g. 'links {relAttr}')

...


links    l         0        SHOW all feed links (e.g. 'links')

...


next     n         0        NEXT feed page (e.g. 'next')

...


prev     p         0        PREVIOUS feed page (e.g. 'previous')

...


print    pr        0        PRINT current feed (e.g.: 'print')

...


delete

...

   d         1        DELETE an entry (e.g. 'delete {entry#}')

...


create   c         1        CREATE a new entry (e.g.: 'create {name}')

...


refresh  r         0        REFRESH current feed (e.g.: 'refresh')

...


select   s         1        SELECT an entry (e.g.: 'entry {entry#}')

...

...

Downloading and Uploading Applications

...

You can use the '''apps > down''' and '''up''' commands to  and up commands to download applications to a local drive and upload them to the frevvo server server.====

Download

...

In the frevvo UI UI, you can download applications individually, and select the destination directory.

[[Image:api-pix_Download-Icon.png]]Image Added

In this example, '''down''' downloads down downloads all the applications in the tenant to a directory on the local machine. Since '''down''' takes down takes no arguments, the target directory depends on your local machine settings.[[Image:Lightbulb.png]] '''Note:'''

Note

To download a single application, you must first select it. See the

...

Downloading and Uploading a Form/Flow

...

topic for instructions for selecting and application.

...

Code Block
localhost:8082/david@monahan.com/

...

apps> down

Downloaded 2 application(s):

...


        Downloaded application DTM July 2011: C:\DOCUME~1\esposito\LOCALS~1\Temp\DTMJuly2011_8805120088410548632_app.zip

...


        Downloaded application DTM August 2011: C:\DOCUME~1\esposito\LOCALS~1\Temp\DTMAugust2011_7848214203496988467_app.zip

...

[http://static.frevvo.com/resources/docs/site/4.1.5/com.frevvo.forms.cli/xref/com/frevvo/forms/cli/shell/ApplicationEntryShell.html Source Code Example]

[http://static.frevvo.com/resources/docs/com.frevvo.forms.java-4.1.4-javadoc/com/frevvo/forms/client/ApplicationEntry.html Java Docs]

==== Upload ====

...



Source Code Example
Java Docs
 

Upload

In the  UI, you can upload applications from the applications page.

[[Image:api-pix_Upload-Icon.png]]

In this example, '''up''' uploads

Image Added

In this example, up uploads a single application into the tenant. Note that we moved the ZIP files we downloaded in the previous step to a different directory before using '''up'''.<pre>

Code Block
localhost:8082/david@monahan.com/

...

apps> up d:\downloads\DTMAugust2011_7848214203496988467_app.zip

...


-----------------------------------------------------------------------------------------

...


                ID | _5Crikb-LEeCP198_WwQSNw!david

...


               URL | http://localhost:8082/frevvo/web/tn/monahan.com/api/app/_5Crikb-LEeCP198_WwQSNw!david

...


           UPDATED | 2011-08-05T15:48:41.218-04:00

...

   
              NAME | DTM August 2011
       DESCRIPTION | Forms started in August.
-----------------------------------------------------------------------------------------

...


localhost:8082/david@monahan.com/apps/DTM August 2011>

</pre>

...

Note

After the upload, the command prompt now includes the name of the uploaded application (''../apps/DTM August 2011''). Use the

...

?list

...

command to see what you can do with the application.

[http://static.frevvo.com/resources/docs/site/4.1.5/com.frevvo.forms.cli/xref/com/frevvo/forms/cli/shell/ApplicationFeedShell.html Source Code Example]

[http://static.frevvo.com/resources/docs/com.frevvo.forms.java-4.1.4-javadoc/com/frevvo/forms/client/ApplicationFeed.html Java Docs]

===  

Java Docs

Downloading and Uploading a Form/Flow

...

You can use the '''forms > down''' and '''up''' commands  and up commands to download forms and flows to a local drive and upload them to the frevvo server.

Before you can use the commands, you have to select the application whose forms you want to work with. In this example, we use the '''apps''' command apps command to list the applications in the tenant, and then '''select''' to select to select the application we want (e.g., '''select 1''' —  — select the first application in the list).<pre>

Code Block
localhost:8082/david@monahan.

...

com> apps

...


-----------------------------------------------------------------------------------------

...


URL ! http://localhost:8082/frevvo/web/tn/monahan.com/api/apps

...


    # | NAME                                 | DESCRIPTION

...


    1 | DTM July 2011                        | Group of test forms created by DTM.

...


    2                                        | DTM August 2011 | Forms started in August.
-----------------------------------------------------------------------------------------

...


localhost:8082/david@monahan.com/

...

apps> ?list

...



Name     Abbr    ArgNum     Descr
up                  1       UPLOAD an application (e.g. 'up /var/contacts_apps.zip')

...


...

...


...

...


...

...


select    s         1       SELECT an entry (e.g.: 'entry {entry#}')

...


localhost:8082/david@monahan.com/

...

apps> select 1

...


-----------------------------------------------------------------------------------------

...


                     ID | _W0jPga4rEeCMGZK99v93jw!david

...


                    URL | http://localhost:8082/frevvo/web/tn/monahan.com/api/app/_W0jPga4rEeCMGZK99v93jw!david

...


                UPDATED | 2011-08-08T09:00:41.319-04:00

...


                   NAME | DTM July 2011
            DESCRIPTION | Group of test forms created by DTM.
-----------------------------------------------------------------------------------------

...


localhost:8082/david@monahan.com/apps/DTM July 2011>

</pre>

The command prompt now includes the selected application — ''DTM July 2011''. Use the '''forms''' command forms command to see a list of the forms and flows in the application, and then use '''?list''' to  to see what you can do with them.<pre>

Code Block
localhost:8082/david@monahan.com/apps/DTM July 2011> forms

...


-----------------------------------------------------------------------------------------

...


URL ! http://localhost:8082/frevvo/web/tn/monahan.com/api/formtypes

...


    # | UPDATED                    | KIND | READONLY | VISIBILITY   | NAME

...


    1 | 2011-07-25T14:31:47.118    | FORM | false    | PUBLICTENANT | Address Book

...


    2 | 2011-07-15T10:51:30.137    | FORM | false    | PUBLICTENANT | TitleDepartment

...


    3 | 2011-07-18T17:04:13.255    | FORM | false    | PUBLICTENANT | Dinner Selections

...


    4 | 2011-07-25T16:24:51.003    | FLOW | false    | PRIVATE      | Flow 42

...


-----------------------------------------------------------------------------------------

...


localhost:8082/david@monahan.com/apps/DTM July 2011/forms> ?list

...


Name     Abbr     ArgNum     Descr

...


up                  1        UPLOAD an application (e.g. 'upload /var/contacts_apps.zip')

...


down                0        DOWNLOAD ALL forms into temp folder (e.g.: 'down')

...


link      l         1        OPEN a link in the browser (e.g. 'openLink {link#}')

...


links     li        1        SHOW feed links for given rel attr (e.g. 'links {relAttr}')

...


links     l         0        SHOW all feed links (e.g. 'links')

...


next      n         0        NEXT feed page (e.g. 'next')

...


prev      p         0        PREVIOUS feed page (e.g. 'previous')

...


print     pr        0        PRINT current feed (e.g.: 'print')

...


delete    d         1        DELETE an entry (e.g. 'delete {entry#}')

...


create

...

    c         1        CREATE a new entry (e.g.: 'create {name}')

...


refresh   r         0        REFRESH current feed (e.g.: 'refresh')

...


select    s         1        SELECT an entry (e.g.: 'entry {entry#}')

...

...

Download

...

As with downloading applications, in the frevvo UI UI, you can download individual forms and flows and select the destination directory when you're editing an application on the applications home page.

[[Image:api-pix_UI_EditApps_Up-DownloadIcons.png]]Image Added

In this example, '''down''' downloads down downloads all the forms and flows in the tenant to a directory on the local machine. You can't choose which forms to download, and since '''down''' takes no down takes no arguments, the target directory depends on your local machine settings. Since the command downloads<pre>

Code Block
localhost:8082/david@monahan.com/apps/DTM July 2011/forms> down

...



Downloaded 4 formtypes(s):

...


        Downloaded formtype AddressBook : C:\DOCUME~1\esposito\LOCALS~1\Temp\AddressBook_4797270872242921600_form.zip

...


        Downloaded formtype TitleDepartment : C:\DOCUME~1\esposito\LOCALS~1\Temp\TitleDepartment_3726241829360563162_form.zip

...


        Downloaded formtype DinnerSelections : C:\DOCUME~1\esposito\LOCALS~1\Temp\DinnerSelections_2704862938519552036_form.zip

...


        Downloaded formtype Flow42 : C:\DOCUME~1\esposito\LOCALS~1\Temp\Flow42_105859113596495447_form.zip

...



localhost:8082/david@monahan.com/apps/DTM July 2011/forms>

...

[http://static.frevvo.com/resources/docs/site/4.1.5/com.frevvo.forms.cli/xref/com/frevvo/forms/cli/shell/FormTypeEntryShell.html Source Code Example]

[http://static.frevvo.com/resources/docs/com.frevvo.forms.java-4.1.4-javadoc/com/frevvo/forms/client/FormTypeEntry.html Java Docs]

==== Upload ====

As with uploading applications, in the frevvo UI, you can upload forms and flows from the applications page when you're editing an application.

In this example, '''up''' uploads a single form — the ''TitleDepartment'' form — into the tenant. Note that we moved the ZIP files we downloaded in the previous step to a different directory before using '''up'''.

<pre>
localhost:8082/david@monahan.com/apps/DTM July 2011/forms> up d:\downloads\TitleDepartment_3726241829360563162_form.zip

 

Source Code Example

Java Docs

Upload

As with uploading applications, in the frevvo UI, you can upload forms and flows from the applications page when you're editing an application.

In this example, up uploads a single form — the ''TitleDepartment'' form — into the tenant. Note that we moved the ZIP files we downloaded in the previous step to a different directory before using '''up'''.

Code Block
localhost:8082/david@monahan.com/apps/DTM July 2011/forms> up d:\downloads\TitleDepartment_3726241829360563162_form.zip
-----------------------------------------------------------------------------------------

...


                              ID | _hEahgK5GEeCMGZK99v93jw!_W0jPga4rEeCMGZK99v93jw!david

...


                             URL | http://localhost:8082/frevvo/web/tn/monahan.com/api/formtype/_hEahgK5GEeCMGZK99v93jw!_W0jPga4rEeC

...

 MGZK99v93jw!david

...


                         UPDATED | 2011-08-08T11:29:18.522

...


                            NAME | TitleDepartment
                     DESCRIPTION | Edit the form to change this description.
                            KIND | FORM
                        READONLY | false
                      VISIBILITY | PUBLICTENANT
-----------------------------------------------------------------------------------------

...

localhost:8082/david@monahan.com/apps/DTM July 2011/forms/TitleDepartment>
</pre>

Note that after the upload, the command prompt now includes the name of the uploaded form (''../forms/TitleDepartment'').

[http://static.frevvo.com/resources/docs/site/4.1.5/com.frevvo.forms.cli/xref/com/frevvo/forms/cli/shell/FormTypeFeedShell.html Source Code Example]

[http://static.frevvo.com/resources/docs/com.frevvo.forms.java-4.1.4-javadoc/com/frevvo/forms/client/FormTypeFeed.html Java Doc]

=== Creating a Form/Flow ===

...


localhost:8082/david@monahan.com/apps/DTM July 2011/forms/TitleDepartment>
Note

After the upload, the command prompt now includes the name of the uploaded form (''../forms/TitleDepartment'').

Source Code Example

Java Doc

Creating a Form/Flow

You can use the forms> create command to create a new form or a flow. You first select the application to which you want to add the new form, list its forms, and then create the form.

 <pre>

Code Block
localhost:8082/david@monahan.

...

com> apps

...


-----------------------------------------------------------------------------------------

...


URL ! http://localhost:8082/frevvo/web/tn/monahan.com/api/apps

...


    # | NAME

...

                                 | DESCRIPTION
    1 | DTM July 2011                        | Group of test forms created by DTM.
    2 | DTM August 2011                      | Forms started in August.
-----------------------------------------------------------------------------------------

...


localhost:8082/david@monahan.com/

...

apps> select 2

...


-----------------------------------------------------------------------------------------

...


            ID | _5Crikb-LEeCP198_WwQSNw!david

...


           URL | http://localhost:8082/frevvo/web/tn/monahan.com/api/app/_5Crikb-LEeCP198_WwQSNw!david

...


       UPDATED | 2011-08-10T10:22:56.851-04:00

...


          NAME | DTM August 2011
   DESCRIPTION | Forms started in August.
-----------------------------------------------------------------------------------------

...


localhost:8082/david@monahan.com/apps/DTM August 2011> forms

...


-----------------------------------------------------------------------------------------

...


URL ! http://localhost:8082/frevvo/web/tn/monahan.com/api/formtypes

...


    # | UPDATED                 | KIND | READONLY | VISIBILITY | NAME

...


    1 | 2011-08-05T13:54:58.628 | FORM | false    | PRIVATE    | Contact Form

...


    2 | 2011-08-09T15:29:47.477 | FORM | false    | PRIVATE    | NewForm

...


    3 | 2011-08-09T15:56:23.552 | FORM | false    | PRIVATE    | LodgingMeals

...


-----------------------------------------------------------------------------------------

...


localhost:8082/david@monahan.com/apps/DTM August 2011/forms> create 'TestForm'

...


-----------------------------------------------------------------------------------------

...


            ID | _X9B3YMNcEeCRfoJ9kSWZ1Q!_5Crikb-LEeCP198_WwQSNw!david

...


           URL | http://localhost:8082/frevvo/web/tn/monahan.com/api/formtype/_X9B3YMNcEeCRfoJ9kSWZ1Q!_5Crikb-LEeC

...

 P198_WwQSNw!david

...


       UPDATED | 2011-08-10T10:23:53.442

...


          NAME | TestForm
   DESCRIPTION | Edit the form to change this description.
          KIND | FORM
      READONLY | false
    VISIBILITY | PRIVATE
----------------------------------------------------------------------------------

...

localhost:8082/david@monahan.com/apps/DTM August 2011/forms/TestForm>
</pre>

Note that command prompt includes the new form name (''../forms/TestForm>''), so you can [[DataAPI_DesigntimeIntegration#Editing_a_Form.2FFlow | edit the form]] from the command line at this point.

...

[http://static.frevvo.com/resources/docs/com.frevvo.forms.java-4.1.4-javadoc/com/frevvo/forms/client/FormTypeFeed.html Java Docs]

...

-------
localhost:8082/david@monahan.com/apps/DTM August 2011/forms/TestForm>
Note

The command prompt includes the new form name (''../forms/TestForm>''), so you can Downloading and Uploading a Form/Flow from the command line at this point.

Source Code Example

Java Docs

Editing a Form/Flow

To edit a form, you first select the application the form belongs to, and then select the form you want. See [[DataAPI_DesigntimeIntegration#Downloading_and_Uploading_a_Form.2FFlow | Downloading and Uploading a Form/Flow]] for  for instructions on selecting an application.

Once you've gotten to the application you want, you can use the '''forms''' command forms command to see what forms it contains and use '''?list''' to  to see what you can do with them. In the example below, we use '''select 1''' to  to select the first form in the list (''Address Book'').<pre>

Code Block
localhost:8082/david@monahan.com/apps/DTM July 2011> forms

...


-----------------------------------------------------------------------------------------

...


URL ! http://localhost:8082/frevvo/web/tn/monahan.com/api/formtypes

...


    # | UPDATED                 | KIND | READONLY | VISIBILITY   | NAME

...


    1 | 2011-07-25T14:31:47.118 | FORM | false    | PUBLICTENANT | Address Book

...


    2 | 2011-07-18T17:04:13.255 | FORM | false    | PUBLICTENANT | Dinner Selections

...


    3 | 2011-08-08T11:29:18.522 | FORM | false    | PUBLICTENANT | TitleDepartment

...


    4 | 2011-07-25T16:24:51.003 | FLOW | false    | PRIVATE      | Flow 42

...


-----------------------------------------------------------------------------------------

...


localhost:8082/david@monahan.com/apps/DTM July 2011/forms> ?list

...



Name     Abbr      ArgNum     Descr
up                   1        UPLOAD an application (e.g. 'upload /var/contacts_apps.zip')

...


...

...


...

...


...

...


select    s          1        SELECT an entry (e.g.: 'entry {entry#}')

...



localhost:8082/david@monahan.com/apps/DTM July 2011/forms> select 1

...


-----------------------------------------------------------------------------------------

...


            ID | _fNScEK4rEeCMGZK99v93jw!_W0jPga4rEeCMGZK99v93jw!david

...


           URL | http://localhost:8082/frevvo/web/tn/monahan.com/api/formtype/_fNScEK4rEeCMGZK99v93jw!_W0jPga4rEeC

...

 MGZK99v93jw!david

...


       UPDATED | 2011-07-25T14:31:47.118

...


          NAME | Address Book
   DESCRIPTION | David - July 2011
          KIND | FORM
      READONLY | false
    VISIBILITY | PUBLICTENANT
-----------------------------------------------------------------------------------------

...


localhost:8082/david@monahan.com/apps/DTM July 2011/forms/Address Book>

...

If you want, use

...

 ?list

...

 to see what you can do with the form.

...

Code Block
Name     Abbr      ArgNum     Descr

...


edit                 0        EDIT form (e.g. 'edit')

...


schema               0        LIST form controls (e.g. 'controls')

...


...

...


...

...


...

...


print     p          0        PRINT this entry (e.g. 'print')

...


delete    d          0        DELETE this entry (e.g. 'delete')pe

...


refresh   r          0        REFRESH this entry (e.g. 'refresh')

...



localhost:8082/david@monahan.com/apps/DTM July 2011/forms/Address Book>

</pre>To edit the form, type '''edit''' and press '''Enter''' edit and press Enter. The command line displays the response below, and frevvo launches the form designer and displays the form you selected.<pre>

Code Block
localhost:8082/david@monahan.com/apps/DTM July 2011/forms/Address Book> edit

...



Editing form: http://localhost:8082/frevvo/web/tn/monahan.com/user/david/app/_W0jPga4rEeCMGZK99v93jw/formtype/_fNScEK4rE

...


eCMGZK99v93jw?edit=true&embed=true&_method=post&apikey=IIGGTVxO1DtiDmUSnIiLzmXQjd6SGJ5c%252FpLVUNm%252FKE8AWzjV0xakncsLK

...


l2aocCYxj3lHuYWNr5q4Su8O%252FQlyQ%253D%253D

...



localhost:8082/david@monahan.com/apps/DTM July 2011/forms/Address Book>

...

[[Image:api-pix_FormDesigner-EditForm.png]]

Image Added

You can edit the form in the designer as if you had logged in through the UI. Make any changes you want to the form, and then click '''Finish''' or '''Cancel''' to Finish or Cancel to exit the designer. You return to the UI login page.

[http://static.frevvo.com/resources/docs/site/4.1.5/com.frevvo.forms.cli/xref/com/frevvo/forms/cli/shell/FormTypeEntryShell.html Source Code Example]

[http://static.frevvo.com/resources/docs/com.frevvo.forms.java-4.1.4-javadoc/com/frevvo/forms/client/FormTypeFeed.html Java Doc]

=== Source Code Examples

Java Doc

Using a Form/Flow

...

Once you've selected a form, you can use it; this is, you can run the form as an end-user would. See the [[DataAPI_DesigntimeIntegration#Editing_a_Form.2FFlow | Editing a Form/Flow topic]] above  above for instruction on selecting a form. Then simply type '''use''' at use at the command prompt and press '''Enter'''. frevv opens  opens the form or flow in your browser.<pre>

Code Block
localhost:8082/david@monahan.com/apps/DTM July 2011/forms/Address Book> use

...



Using form: http://localhost:8082/frevvo/web/tn/monahan.com/user/david/app/_W0jPga4rEeCMGZK99v93jw/formtype/_fNScEK4rEeC

...


MGZK99v93jw?embed=true&_method=post&apikey=IIGGTVxO1DtiDmUSnIiLzmXQjd6SGJ5c%252FpLVUNm%252FKE8AWzjV0xakncsLKl2aocCYxj3lH

...

localhost:8082/david@monahan.com/apps/DTM July 2011/forms/Address Book>
</PRE>

[http://static.frevvo.com/resources/docs/site/4.1.5/com.frevvo.forms.cli/xref/com/frevvo/forms/cli/shell/FormTypeEntryShell.html Source Code Example]

[http://static.frevvo.com/resources/docs/com.frevvo.forms.java-4.1.4-javadoc/com/frevvo/forms/client/FormTypeEntry.html Java Doc]

...


uYWNr5q4Su8O%252FQlyQ%253D%253D

localhost:8082/david@monahan.com/apps/DTM July 2011/forms/Address Book>

Source Code Example

Java Doc

Display a List of the Controls in a Form

...

After you select a form, you can display a list of all the controls in the form. See the [[DataAPI_DesigntimeIntegration#Editing_a_Form.2FFlow | Editing a Form/Flow topic]] above  above for instruction on selecting a form. Then simply type '''controls''' at controls at the command prompt and press '''Enter'''. You see the list of controls.<pre>

Code Block
localhost:8082/maggie@monahan.com/apps/Sand Box/forms/Order Form> controls

...


-----------------------------------------------------------------------------------------

...


URL ! http://localhost:8082/frevvo/web/tn/monahan.com/api/controltypes?ownerId=_bQdBsLSPEeCTSNrzu9T5_w!_PpnhcbSPEeCTSNrz

...

 u9T5_w!maggie

...


    # | CONTROL TYPE         | DISPLAY TYPE | READONLY | REQUIRED | COMMENTS? | NAME

...


    1 | InputControlType     | Text         | false    | true     | false     | Name
    2 | PanelControlType     | Panel        | false    | true     | false     | AddressPhone
    3 | InputControlType     | Text         | false    | true     | false     | Address1
    4 | InputControlType     | Text         | false    | false    | false     | Address12
    5 | InputControlType     | Text         | false    | true     | false     | City
    6 | InputControlType     | Text         | false    | true     | false     | State
    7 | InputControlType     | Text         | false    | true     | false     | ZipPostalCode
    8 | InputControlType     | Phone        | false    | false    | false     | HomePhone
    9 | InputControlType     | Phone        | false    | false    | false     | MobilePhone
   10 | PanelControlType     | Panel        | false    | true     | false     | Date_OrderNum
   11 | InputControlType     | Date         | false    | true     | false     | OrderDate
   12 | InputControlType     | Text         | false    | true     | false     | OrderNumber
   13 | PanelControlType     | Panel        | false    | true     | false     | OrderDesc
   14 | TextareaControlType  | TextArea     | false    | false    | false     | Description
   15 | SubmitControlType    | null         | false    | true     | false     | Submit
   16 | SubmitControlType    | null         | false    | true     | false     | Cancel
-----------------------------------------------------------------------------------------

...


localhost:8082/maggie@monahan.com/apps/Sand Box/forms/Order Form/controls>

...

Once you display the list, you can select a control and rename it, edit its description, or even delete it.<pre>

Code Block
localhost:8082/maggie@monahan.com/apps/Sand Box/forms/Order Form/controls> select 11

...



-----------------------------------------------------------------------------------------

...


            ID | _6rHRwbSPEeCTSNrzu9T5_w!_bQdBsLSPEeCTSNrzu9T5_w!_PpnhcbSPEeCTSNrzu9T5_w!maggie

...


           URL | http://localhost:8082/frevvo/web/tn/monahan.com/api/controltype/_6rHRwbSPEeCTSNrzu9T5_w!_bQdBsLSP

...

 EeCTSNrzu9T5_w!_PpnhcbSPEeCTSNrzu9T5_w!maggie

...


       UPDATED | 2011-08-10T13:04:20.275-04:00

...


          NAME | OrderDate
   DESCRIPTION | Order Date
  CONTROL TYPE | InputControlType
  DISPLAY TYPE | Date
      READONLY | false
      REQUIRED | true
     COMMENTS? | false
-----------------------------------------------------------------------------------------

...


localhost:8082/maggie@monahan.com/apps/Sand Box/forms/Order Form/controls/OrderDate> ?list

...



Name     Abbr     ArgNum     Descr
link      l         1        OPEN a link in the browser (e.g. 'link {link#}')

...


descr     d         1        UPDATE this entry's description (e.g. 'descr {newDescription}')

...


links

...

     l         0        SHOW all entry links (e.g. 'links')

...


links     li        1        SHOW feed links for given rel attr (e.g. 'links {relAttr}')

...


name      n         1        UPDATE this entry's name (e.g. 'name {newName}')

...


print     p         0        PRINT this entry (e.g. 'print')

...


delete    d         0        DELETE this entry (e.g. 'delete')

...


refresh   r         0        REFRESH this entry (e.g. 'refresh')

...



localhost:8082/maggie@monahan.com/apps/Sand

...

[http://static.frevvo.com/resources/docs/site/4.1.5/com.frevvo.forms.cli/xref/com/frevvo/forms/cli/shell/FormTypeEntryShell.html Source Code Example]

[http://static.frevvo.com/resources/docs/com.frevvo.forms.java-4.1.4-javadoc/com/frevvo/forms/client/FormTypeEntry.html Java Docs]

...

 Box/forms/Order Form/controls/OrderDate>

Source Code Example

Java Docs

Downloading and Uploading an XSD

...

You can download and upload the schema (XSD file) for a form. In the frevvo UI, you download a form schema from the application page when you're editing an application; you upload a schema from the schema page.====

Download

...

To download a form schema, you first select the form you want and then use the '''[form name]> schema''' command command.<pre>

Code Block
localhost:8082/maggie@monahan.com/apps/Sand Box> forms

...


-----------------------------------------------------------------------------------------

...


URL ! http://localhost:8082/frevvo/web/tn/monahan.com/api/formtypes

...


    # | UPDATED                 | KIND | READONLY | VISIBILITY   | NAME

...


    1 | 2011-08-10T10:47:24.210 | FORM | false    | PUBLICTENANT | Order Form

...


-----------------------------------------------------------------------------------------

...


localhost:8082/maggie@monahan.com/apps/Sand Box/forms> select

...

 1
-----------------------------------------------------------------------------------------

...


            ID | _bQdBsLSPEeCTSNrzu9T5_w!_PpnhcbSPEeCTSNrzu9T5_w!maggie

...


           URL | http://localhost:8082/frevvo/web/tn/monahan.com/api/formtype/_bQdBsLSPEeCTSNrzu9T5_w!_PpnhcbSPEeC

...

 TSNrzu9T5_w!maggie

...


       UPDATED | 2011-08-10T10:47:24.210

...


          NAME | Order Form
   DESCRIPTION | Mail Order Form
          KIND | FORM
      READONLY | false
    VISIBILITY | PUBLICTENANT
--------------------------------

...

localhost:8082/maggie@monahan.com/apps/Sand Box/forms/Order Form> schema

Downloaded formtype schema: D:\downloads\OrderForm_7212269303367570502_form.xsd

localhost:8082/maggie@monahan.com/apps/Sand Box/forms/Order Form>
</pre>

[http://static.frevvo.com/resources/docs/site/4.1.5/com.frevvo.forms.cli/xref/com/frevvo/forms/cli/shell/FormTypeEntryShell.html Source Code Example]

[http://static.frevvo.com/resources/docs/com.frevvo.forms.java-4.1.4-javadoc/com/frevvo/forms/client/FormTypeEntry.html Java Doc]

==== Upload ====

TBD

[http://static.frevvo.com/resources/docs/site/4.1.5/com.frevvo.forms.cli/xref/com/frevvo/forms/cli/shell/SchemaFeedShell.html Source Code Example]

[http://static.frevvo.com/resources/docs/com.frevvo.forms.java-4.1.4-javadoc/com/frevvo/forms/client/SchemaFeed.html Java Doc]

...

---------------------------------------------------------
localhost:8082/maggie@monahan.com/apps/Sand Box/forms/Order Form> schema
Downloaded formtype schema: D:\downloads\OrderForm_7212269303367570502_form.xsd
localhost:8082/maggie@monahan.com/apps/Sand Box/forms/Order Form>

Source Code Example

Java Doc

Upload

TBD

Source Code Example

Java Doc

Creating a Form Instance from XML

After you select a form in an application, you can use the '''[form-name]> newXml''' command  command to create an instance of the form and fill the form with data values from an XML file. You can then submit the form, or reset it to remove the XML data.<pre>

Code Block
localhost:8082/david@monahan.com/apps/DTM July 2011/forms> select 3

...


-----------------------------------------------------------------------------------------

...


             ID | _hEahgK5GEeCMGZK99v93jw!_W0jPga4rEeCMGZK99v93jw!david

...


            URL | http://localhost:8082/frevvo/web/tn/monahan.com/api/formtype/_hEahgK5GEeCMGZK99v93jw!_W0jPga4rEeCMGZK99v93jw!david

...


        UPDATED | 2011-08-08T11:29:18.522

...


           NAME | TitleDepartment
    DESCRIPTION | Edit the form to change this description.
           KIND | FORM
       READONLY | false
     VISIBILITY | PUBLICTENANT
-----------------------------------------------------------------------------------------

...


localhost:8082/david@monahan.com/apps/DTM July 2011/forms/TitleDepartment> newXml d:\downloads\Maggie-FormData.xml

...


-----------------------------------------------------------------------------------------

...


FORM instance #1 [name=TitleDepartment, url=http://localhost:8082/frevvo/web/tn/monahan.com/user/david/app/_W0jPga4rEeCM

...


GZK99v93jw/form/_SwqY48UMEeCW_YwbL7w9ig?typeId=_hEahgK5GEeCMGZK99v93jw&locale=&embed=true&apikey=lF4OpTMA66sWnh7Z6i0tfT%

...


252BVZJd72Q91e2GaqWNwTmcP1kRYuNeW%252Bk1CC9%252BSdXGWNKQcoNY7FyU2WdcYtRs95w%253D%253D]

...


-----------------------------------------------------------------------------------------

...


localhost:8082/david@monahan.com/apps/DTM July 2011/forms/TitleDepartment/Instance #1> ?list

...



Name     Abbr     ArgNum     Descr
print               0        PRINT this instance URL (e.g. 'print')

...


reset               0        RESET this form instance (e.g. 'reset')

...


submit              0        SUBMIT this form instance (e.g. 'submit')

...



localhost:8082/david@monahan.com/apps/DTM July 2011/forms/TitleDepartment/Instance #1>

</pre>If you paste the form URL into your browser address bar, you can open the form instance and see the XML values in the form fields. You can Submit of Cancel the form from the browser, or you can use '''Instance #1> submit''' or '''Instance #1> reset''' from the command line.[[Image:Api-pix_FormFromXML.png]][http://static.frevvo.com/resources/docs/site/4.1.5/com.frevvo.forms.cli/xref/com/frevvo/forms/cli/shell/FormTypeEntryShell.html Source Code Example]

[http://static.frevvo.com/resources/docs/com.frevvo.forms.java-4.1.4-javadoc/com/frevvo/forms/client/FormTypeEntry.html Java Doc]

===  or Instance #1> reset from the command line.

Image Added

Source Code Example

Java Doc

Using a Custom XSD in a Form

...

You can use an XSD schema file to populate a form with controls. You can add the entire XSD schema to the form or individual controls. This example uses the API to upload a custom schema to an applicatio, add one of the top-level XSD elements to a form and then shows the result in the designer UI.====

Upload a custom XSD

...

The first step is to upload a custom XSD into an application. The following commands will list the existing schemas in the current application and then upload a new one (this assumes that there is an XSD named purchaseorder.xsd located in the /xsd folder):<pre>

Code Block
localhost:8080/admin@test/apps/Sand Box> schemas

...


-----------------------------------------------------------------------------------------

...


URL ! http://localhost:8080/frevvo/web/tn/test

...

/api/schemas 
    # | NAME                                   | DESCRIPTION
-----------------------------------------------------------------------------------------

...


localhost:8080/admin@test/apps/Sand Box> up /xsd/purchaseorder.xsd

...


-----------------------------------------------------------------------------------------

...


            ID | _XX4VQQvREeGt8aM2YoQyaQ!_-4fOMQvQEeGt8aM2YoQyaQ!admin

...

 
           URL | http://localhost:8080/frevvo/web/tn/test/api/schema/_XX4VQQvREeGt8aM2YoQyaQ!_-4fOMQvQEeGt8aM2YoQyaQ!admin

...


       UPDATED | 2011-11-10T14:22:44.754-05:00

...

 
          NAME | http://tempuri.org/po.xsd

...

 
   DESCRIPTION | http://tempuri.org/po.xsd

...


-----------------------------------------------------------------------------------------

...


localhost:8080/admin@test/apps/Sand Box/schemas/http://tempuri.org/po.xsd> 

Upload Source Code

Now, the purchaseorder.xsd has been upload and you can verify that this is the case by going directly to the frevvo UI  UI in Applications->Schemas.====


Add an new XSD data source to a form

...

First, let's create a new form.<pre>

Code Block
localhost:8080/admin@test/apps/Sand Box/schemas/http://tempuri.org/po.

...

xsd> exit

...


Schema http://tempuri.org/po.xsd successfully uploaded

...


localhost:8080/admin@test/apps/Sand Box/schemas> exit

...


localhost:8080/admin@test/apps/Sand Box> forms

...


-----------------------------------------------------------------------------------------

...


URL ! http://localhost:8080/frevvo/web/tn/test/api/formtypes?ownerId=_-4fOMQvQEeGt8aM2YoQyaQ!admin

...


  # | UPDATED                  | KIND    | READONLY | VISIBILITY    | NAME

...



-----------------------------------------------------------------------------------------

...


localhost:8080/admin@test/apps/Sand Box/forms> create PurchaseOrder

...


-----------------------------------------------------------------------------------------

...


            ID | _leQIIAvTEeGt8aM2YoQyaQ!_-4fOMQvQEeGt8aM2YoQyaQ!admin

...

 
           URL | http://localhost:8080/frevvo/web/tn/test/api/formtype/_leQIIAvTEeGt8aM2YoQyaQ!_-4fOMQvQEeGt8aM2YoQyaQ!admin

...


       UPDATED | 2011-11-10T14:38:37.863

...

 
          NAME | PurchaseOrder 
   DESCRIPTION | Edit the form to change this description. 
          KIND | FORM 
      READONLY | false 
    VISIBILITY | PRIVATE
-----------------------------------------------------------------------------------------

...


localhost:8080/admin@test/apps/Sand Box/forms

...

/PurchaseOrder> 

Now that we have a new form, we need to add a new XSD data source to the form using the API, which is the equivalent to adding a new data source in the designer by clicking the '''Data Sources''' panel  panel and then clicking '''New from XSD''' as  as shown in the following screenshots.

[[Image:api-pix_Form-fromXSD-1.png]]frevvo displays Image Added

 displays the available schemas in the current application. You can then click [[Image:Add.png]] to Image Added to select the XSD you want to use. frevvo adds  adds it to the Data Sources panel.[[Image:api-pix_Form-fromXSD-2.png]]


Image Added

Here is how to add a new data source using the API.<pre>

Code Block
localhost:8080/admin@test/apps/Sand Box/forms/PurchaseOrder> docs

...


-----------------------------------------------------------------------------------------

...



URL ! http://localhost:8080/frevvo/web/tn/test/api/doctypes

...

?ownerId=_leQIIAvTEeGt8aM2YoQyaQ!_-4fOMQvQEeGt8aM2YoQyaQ!admin
    # | NAME                                   | DESCRIPTION 
1 | http://www.frevvo.com/schemas/_leQIIAvTEeGt8aM2YoQyaQ#form | null

...



-----------------------------------------------------------------------------------------

...


localhost:8080/admin@test/apps/Sand Box/forms/PurchaseOrder/docs>

...

 

There should be only one element in the docs feed for the default, from-palette schema. Now we need to add the '''purchaseOrder''' element purchaseOrder element from the '''http://tempuri.org/po.xsd''' XSD  XSD targetNamespace to the form:<pre>

Code Block
localhost:8080/admin@test/apps/Sand Box/forms/PurchaseOrder/docs> add purchaseOrder http://tempuri.org/po.xsd

...


DocumentType (http://tempuri

...

.org/po.xsd#purchaseOrder) added to form PurchaseOrder
localhost:8080/admin@test/apps/Sand Box/forms/PurchaseOrder/docs>

Source Code

Let's open the designer to see the result:<pre>

Code Block
localhost:8080/admin@test/apps/Sand Box/forms/PurchaseOrder/docs> exit

...


localhost:8080/admin@test/apps/Sand Box/forms/PurchaseOrder> edit

...


Editing form: http://localhost:8080/frevvo/web/tn/test/user/admin/app/_-4fOMQvQEeGt8aM2YoQyaQ/formtype/_leQIIAvTEeGt8aM2YoQyaQ?edit=true&embed=true&_method=post&apikey=bxZrlQFZvJ%252Fj02XW1RpzECYR0i7Fu3fbdBSDDn4XovH2wLbv9H8FagSHYFOUEk%252F%252FcMlX08rSOAnPE0HHk8TQFQ%253D%253D

...


localhost:8080/admin@test/apps/Sand Box/forms/PurchaseOrder> 

...

Note

It is not possible to auto-generate controls from '''Data Sources''' schemas. So the form designer would still have to perform this step manually.

Click [[Image:Add.png]] next to '''form''' to Image Added next to form to add all the controls to the new form, or click the individual controls you want. frevvo adds them to the form. Click '''Finish''' when Finish when you're done to exit the UI.

[[Image:api-pix_Form-fromXSD-3.png]Image Added]

You can now use the new form from the command line.<pre>

Code Block
localhost:8080/admin@test/apps/Sand Box/forms/PurchaseOrder> use

...


Using form: http://localhost:8080/frevvo/web/tn/test/user/admin/app/_-4fOMQvQEeGt8aM2YoQyaQ/formtype/_leQIIAvTEeGt8aM2YoQyaQ?embed=true&_method=post&apikey=bxZrlQFZvJ%252Fj02XW1RpzECYR0i7Fu3fbdBSDDn4XovH2wLbv9H8FagSHYFOUEk%252F%252FcMlX08rSOAnPE0HHk8TQFQ%253D%253D

...


localhost:8080/admin@test/apps/Sand Box/forms/PurchaseOrder>

...