Is there any API can be used to getting the Form list?

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Is there any API can be used to getting the Form list?

Robin
Hi All,
Does the Orbeon have/support the API which can be use by client side to get existed Form data? (via Http call, without browser/webview)
E.g. client invoke the url "http://***/form/summary?format=xml(or json)", and the Orbeon server response the related data with the specified format.

Thanks,
Robin
Jez
Reply | Threaded
Open this post in threaded view
|

Re: Is there any API can be used to getting the Form list?

Jez
Hi Robin

You can use the search component of the Persistence API (http://wiki.orbeon.com/forms/doc/developer-guide/form-runner/persistence-api#TOC-Search) to return XML. Ie generate a query and POST to /fr/service/persistence/search/***/form

The format of the request and response are defined on that page.

Regards

Reply | Threaded
Open this post in threaded view
|

Re: Is there any API can be used to getting the Form list?

Robin
Hi Jez,
Thanks for your reply.
I had read the guide of the search component, it's a little complex. So, basically, I need prepare an xml formatted query string, and post to /fr/service/persistence/search/***/form, is that right? Or I need implement another API based on the Servlet to do that?
I try to access the URL "/fr/service/persistence/search/***/form", but still get 403 error. Does the API is internal use only, and can't be accessed by external?

Thanks advice.
Robin
Jez
Reply | Threaded
Open this post in threaded view
|

Re: Is there any API can be used to getting the Form list?

Jez
Hi Robin

My first reponse was based on retrieving the data you were after from within an Orbeon application. If you want the data from an external request, it's slightly more complex.

/fr/service/persistence is relative to the Orbeon root, so an external request will need to include the Orbeon context eg. http://localhost:8080/orbeon/fr/service/persistence

Orbeon Services, however, come with default protections for external requests (see http://wiki.orbeon.com/forms/doc/user-guide/form-runner-user-guide#TOC-Securing-Form-Runner). I'm out of my comfort zone on talking about that, all my stuff is internal.

Alternatively, you could go direct to the 'actual' persistence layer. If you are using the embedded exist then you can POST xquery directly to the eXist REST interface eg. http://localhost:8080/orbeon/exist/db/orbeon/fr/app-name/form-name. Again, this is protected by default but can be opened by modifying your web.xml (note disclaimer at http://wiki.orbeon.com/forms/doc/developer-guide/release-notes/40#TOC-Security-of-the-built-in-eXist-database).

Or (preferred) create your own standalone eXist database protected with your own security model, and modify your Orbeon properties-local.xml with the oxf.fr.persistence.exist.exist-uri property pointing to the standalone eXist REST interface.

Regards

Jez
Reply | Threaded
Open this post in threaded view
|

Re: Is there any API can be used to getting the Form list?

Robin
Hi Jez,
Thanks for your detailed reply!
Now I can use eXist REST API to access the data with few permission changes.

I found that the orbeon has also access to eXist REST API directly in their demo codes and form builder. Not sure currently the persistence layer is really implemented in orbeon or not.

anyway, the REST API can meet my requirements for now. Thanks again!

Robin
Reply | Threaded
Open this post in threaded view
|

Re: Is there any API can be used to getting the Form list?

Alessandro  Vernet
Administrator
Hi Robin,

I am glad you solved this problem, and regarding:

Robin wrote
I found that the orbeon has also access to eXist REST API directly in their demo codes and form builder. Not sure currently the persistence layer is really implemented in orbeon or not.
Yes, the persistence API is implemented in Orbeon Forms for eXist, but it calls the eXist REST API, and is thus pretty simple. If you're interested, the implementation consists of the files in this directory:

https://github.com/orbeon/orbeon-forms/tree/master/src/resources/apps/fr/persistence/exist

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Is there any API can be used to getting the Form list?

Robin
Hi Alex,
Thanks sharing the link.

Robin