Versions Compared

Key

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

...

 supports an additional way of logging into frevvo using the Data API: the loginAs() method. This new method allows you to login to frevvo as any of the existing tenant users provided you can pass in the tenant's admin user and password. This is quite convenient when you want login to frevvo using  using the same user that is logged into your application without having to know their password.

The following snippet shows how to login as a tenant user:<pre>

Code Block
    ...

...


    String tenantAdmin = getUsername() + '@' + getTenant();

...


    String tenantAdminPwd = getPassword();

...


    String username = getAsUsername();

...


    FormsService s = new FormsService(getProtocol(), getHost(), getPort(), null);

...


    s.loginAs(username, tenantAdmin, tenantAdminPwd);

...


    ...

</pre>The '''loginAsThe loginAs(String, String, String)''' usage  usage above assumes that you are logging in as a user that was previously created in the specific tenant.

When your tenant was configured with the '''DelegatingSecurityManager''', you can use the overloaded '''loginAs()''' method  method to automatically create virtual users in frevvo. For instance:<pre>

Code Block
    ...

...


    String tenantAdmin = getUsername() + '@' + getTenant();

...


    String tenantAdminPwd = getPassword();

...


    String username = getAsUsername();

...


    FormsService s = new FormsService(getProtocol(), getHost(), getPort(), null);

...


    s.loginAs(username, tenantAdmin, tenantAdminPwd, true, null, null, null, null,null

...

);
    ...

...

This will automatically create a new, '''non-designer''' user  user (i.e. will be able to participate in flows but not create forms/flows), if it doesn't yet exist. If you want frevvo to auto create a new virtual user that is also a '''designer''' you designer you need to pass in the '''frevvo.Designer''' role  role when calling loginAs(). For instance:<pre>

Code Block
    ...

...


    String tenantAdmin = getUsername() + '@' + getTenant();

...


    String tenantAdminPwd = getPassword();

...


    String username = getAsUsername();

...


    List<String> roles = new ArrayList<String>();

...


    roles.add("frevvo.Designer");

...


    FormsService s = new FormsService(getProtocol(), getHost(), getPort(), null);

...


    s.loginAs(username, tenantAdmin, tenantAdminPwd, true, roles, null, null,null,null);

...


    ...

</pre>==== .Net Client API ====

TBD=====

.Net Client API FAQ

...

For a list of Frequently Asked question about common tasks using the API with frevvo server, please see the [[frevvo API .Net Client FAQ]] topic.=====

Logging In and Out of the

...

Live Forms Server

When interacting with frevvo , an application first needs to establish a session using the Data API. See the C# code snipped below for an example.<pre>

Code Block
    FormsService service = new FormsService("http://localhost:8082", "yourappname");

...


    service.Login("myuser", "mypassword");

...



    // interact with

...

 frevvo

    service.Logout();

</pre>Since there is some overhead associated with logging in and out, you need to keep the FormsService instance around for as long as you need to interact with frevvo before  before logging out. Logging out ensures that frevvo will  will release any unneeded resources and the user count will be decremented, as the number of users is affected by your frevvo license license.===

Browser URL API

...

The client libraries are built on top of the browser API. However since these URLs can be used directly from your browser, it is a great way to experiment with the frevvo API  API before you start writing code.

This section describes the basic protocol used to interact with frevvo Data  Data APIs including examples of what Atom requests may look like, what kind of responses to expect, and so on. It is intended for anyone wanting an understanding the general idea of the format and protocol used by the frevvo Data  Data API and it assumes that you understand the basics of XML, namespaces, Atom feeds, and the main HTTP requests GET, POST, PUT and DELETE, as well as the RESTful concept of a resource. Using the API at this level your client application can interact with the frevvo Server  Server using any programming language that lets you issue HTTP requests and consume XML-based responses.

You can use the Resource URIs listed [[Browser_API_Reference_Guide | Browser API Reference Guide]] in  in the browser address bar when you're logged into Live Forms . The  The URIs return data from the frevvo server as either web pages or XML files. To use the URIs, you edit the URL in the address bar when you're logged into a Live Forms tenant to include the URI of the resource feed you want to use. For example:*

  • FormTypeFeed: ../frevvo/web/tn/{tenantId

...

  • /api/formtypes?ownerId={appId}

...

...

  • FormTypeEntry: ../frevvo/web/tn/{tenantId}

...

  • /api/formtype/{id}

...

The browser URL API provides:* A

  •  A useful tool for debugging

...

  •  An easy way to try out the API without having to write code

...

  •  A way to experiment with and learn the API

This example shows how to use the '''formtypes''' feed formtypes feed to have the frevvo server return a list of all the forms belonging to the user who's currently logged in.#

  1. After logging in, edit the frevvo URL in the browser address bar to insert

...

  1. api/formtypes

...

  1.  immediately after the tenant name - which in this example is

...

  1. monahan.com

...

  1. .

...

  1. So in this example, we change the URL ''from:'' http: //localhost:8082/frevvo/web/tn/monahan.com

...

  1. user/david/app

...

...

  1. to:

...

  1.  http: //localhost:8082/frevvo/web/tn/monahan.com/

...

  1. api/formtypes

...

  1. , and press

...

  1. Enter

...

  1. .

The browser returns the page below.

[[Image:browserAPI_formtypes.png]]Image Added

If you click on the '''Address Book''' link  link and either open or save the XML file, you see the XML for the form, the first portion of which is shown below.[[Image:18px-Attention_niels_epting.svg.png]] '''NOTE:'''

Warning

Depending on which browser you're using, the browser may return the XML rather than the page in the illustration above.

...

Code Block
<entry xmlns:fd="http://schemas.frevvo.com/fdata/2008"

...


        xmlns="http://www.w3.org/2005/Atom"

...


        xml:lang="en"

...


        xml:base="http://localhost:8082">

...


    <id>_fNScEK4rEeCMGZK99v93jw!_W0jPga4rEeCMGZK99v93jw!david</id>

...


    <title type="text">Address Book</title>

...


    <summary type="text">David - July 2011</summary>

...


    <updated>2011-07-22T11:23:25.326</

...

updated>
    <category scheme="http://schemas.frevvo.com/fdata/2008#kind" term="FORM"/>

...


    <link type="application/atom+xml"

...


        href="/frevvo/web/tn/monahan.com/api/formtype/_fNScEK4rEeCMGZK99v93jw!_W0jPga4rEeCMGZK99v93jw!david"/>

...


    <link rel="self" type="application/atom+xml"

...


        href="/frevvo/web/tn/monahan.com/api/formtype/_fNScEK4rEeCMGZK99v93jw!_W0jPga4rEeCMGZK99v93jw!david"/

...

> 
    <link rel="edit" type="application/atom+xml"

...


        href="/frevvo/web/tn/monahan.com/api/formtype/_fNScEK4rEeCMGZK99v93jw!_W0jPga4rEeCMGZK99v93jw!david"/>

</pre>This example shows how to use the '''controltypes''' feed controltypes feed to get a list of all the control types that belong to the currently logged-in user, regardless of which forms they're used in.#

  1. After logging in, edit the

...

  1.  URL in the browser address bar to insert

...

  1. api/controltypes

...

  1.  immediately after the tenant name - which in this example is

...

  1. monahan.com

...

  1. .

...

  1. So in this example, we change the URL

...

  1. from:

...

  1.  http: //localhost:8082/frevvo/web/tn/monahan.com/

...

  1. user/david/app

...

...

  1. to:

...

  1. http: //localhost:8082/frevvo/web/tn/monahan.com/

...

  1. api/controltypes

...

  1. , and press

...

  1. Enter

...

  1. .

The browser returns the page below. Scroll though the page to see all the controls in all the user's forms.

[[Image:browserAPI_controltypesAll.png]]Image Added

This example shows how to use the '''controltypes?ownerId={formTypeId}''' feed   feed to get a list of the control types in a specific form - in this case the Address Book form in the example above.#

  1. After logging in, edit the

...

  1.  URL in the browser address bar to insert

...

  1. api/controltypes?ownerId={formTypeId}

...

  1.  immediately after the tenant name - which in this example is

...

  1. monahan.com

...

  1. .

...

  1. So in this example, we change the URL

...

  1. from:

...

  1.  http: //localhost:8082/frevvo/web/tn/monahan.com/

...

  1. user/david/app

...

...

  1. to:

...

  1. http: //localhost:8082/frevvo/web/tn/monahan.com/

...

  1. api/controltypes?ownerId=_fNScEK4rEeCMGZK99v93jw!_W0jPga4rEeCMGZK99v93jw!david

...

  1. , and press

...

  1. Enter

...

  1. .
Note

Note that the value of the

...

ownerId=

...

parameter is the form type definition for the

...

Address Book

...

form shown in the XML example above, including the ID (david) of the user who created the form.

The browser returns the page below.

[[Image:browserAPI_controltypes.png]]Image Added

If you click on the RequiredFieldPrompt link and either open or save the XML file, you see the XML for the control, which is shown below.

...