CRUD
Basics
When using GET and PUT to deal with resources, the body of HTTP requests contains the resource to handle.
GETThe request body is empty and response body contains resource.
[SINCE Orbeon Forms 4.5] The
Orbeon-Operationsresponse header lists the operations that the user can perform on the data (see Supporting permissions in your persistence API implementation).[SINCE Orbeon Forms 4.5] If the implementation of the persistence API supports form versioning, and the request is for a form definition, the
Orbeon-Form-Definition-Versionrequest header tells which version of the form definition is requested.
PUTThe request body contains the resource to store.
The
Content-Typemust contain the content-type of the resource to store. For XML in particular, passapplication/xml.The request response is empty.
If your implementation of the persistence API supports form versioning, then when storing a new document, you need to tell the persistence what version of the form definition was used to create this data, so the same version can then be used to subsequently edit the data. This is done by specifying the version in the
Orbeon-Form-Definition-Versionheader.
DELETEBoth request and response bodies are empty.
When the resource is an XML file (e.g. form.xhtml, data.xml), the persistence layer must return an appropriate XML content-type: application/xml, or application/xhtml+xml.
Examples using curl
The following examples use the curl command-line utility. They are indented on multiple lines for clarity but in practice each command must be written on a single line.
The service must be open for these examples to work. See Authorization of pages and services.
The general format of the a path to access form data is:
So with the following assumptions:
app name (
$app):acmeform name (
$form):orderdocument id (
$doc):fc4c32532e8d35a2d0b84e2cf076bb070e9c1e8e
then you can PUT form data as follows:
The following retrieves the data (the GET method is used implicitly by curl):
The same API is used by Form Builder to store in-progress (unpublished) form definitions under the orbeon/builder app/form names. So with the following assumptions:
app name (
$app):orbeonform name (
$form):builderdocument id (
$doc):7b55c9d6f9b058376293e61d9f0d4442e379f717
then you can PUT a form definition so that it's available to Form Builder:
The following retrieves the form definition (the GET method is used implicitly):
URL parameters
Supported by the persistence implementation
[SINCE Orbeon Forms 2017.1]
nonrelevantwhen using GET for data only
values
remove: remove all XML data elements with attributefr:relevant="false"keep: [SINCE Orbeon Forms 2018.1] do not remove XML data elementsmissing: do not remove XML data elements
NOTE: This property only operates properly on data stored with Orbeon Forms 2017.1 and newer, as only Orbeon Forms 2017.1 and newer stores data with the fr:relevant="false" annotation.
Passed by Form Runner
[SINCE Orbeon Forms 4.2]
The following URL parameters are set by Form Runner:
validpassed when data is stored using PUT only
values
true: data sent satisfies validation rulesfalse: data sent does not satisfy validation rules
This allows a persistence implementation to store this information if desired.
Example:
Publishing from Form Builder
When you create, edit, or read form definition with Form Builder, form definitions are stored as Form Builder data. That is, they are stored under:
/crud/orbeon/builder/data/[FORM_DATA_ID]
On the other hand, when Form Builder publishes a form definition, it stores it where Form Runner will find it, that is under:
For example, this is what happens when saving and publishing a form definition acme/order with a single attachment:
Save:
PUT /crud/orbeon/builder/data/7b55c9d6f9b058376293e61d9f0d4442e379f717/a29fd47011b2957ef44a62d92995adfdbae03fa9.bin
PUT /crud/orbeon/builder/data/7b55c9d6f9b058376293e61d9f0d4442e379f717/data.xml
Publish:
PUT /crud/acme/order/form/a29fd47011b2957ef44a62d92995adfdbae03fa9.bin
PUT /crud/acme/order/form/form.xhtml?document=7b55c9d6f9b058376293e61d9f0d4442e379f717
[SINCE Orbeon Forms 4.6]
When Form Builder publishes a form definition, if versioning is supported by the target persistence layer, it passes a Orbeon-Form-Definition-Version header with values:
next: to indicate that the form definition must be published under the next available versionor a specific version number: to indicate that the form definition must replace the given version
Deleting all data for an existing form
To remove all instances of form data, issue a DELETE to:
Last updated