Individual Form

Getting Form Schema Fields

(introduced: version 0.8)

For applications that do not rely on JavaRosa, it can be challenging to parse XForms XML into a simple schema structure. Because Central Backend already implements and performs such an operation for its own internal purposes, we also expose this utility for any downstream consumers which wish to make use of it.

While this may eventually overlap with the new OData JSON CSDL specification, we are likely to maintain this API as it more closely mirrors the original XForms data types and structure.

Central internally processes the XForms schema tree into a flat list of fields, and this is how the data is returned over this endpoint as well. It will always return fields in a depth-first traversal order of the original <instance> XML block in the XForm.

You may optionally add the querystring parameter ?odata=true to sanitize the field names and paths to match the way they will be outputted for OData. While the original field names as given in the XForms definition may be used as-is for CSV output, OData has some restrictions related to the domain-qualified identifier syntax it uses.

get/v1/projects/{projectId}/forms/{xmlFormId}/fields

Path parameters

projectIdnumber required

The numeric ID of the Project

xmlFormIdstring required

The xmlFormId of the Form being referenced.

Query parameters

odataboolean

If set to true, will sanitize field names.

Response

OK

namestring required
pathstring required
typestring required
binaryboolean

Example response

[
  {
    "name": "meta",
    "path": "/meta",
    "type": "structure"
  },
  {
    "name": "instanceID",
    "path": "/meta/instanceID",
    "type": "string"
  },
  {
    "name": "name",
    "path": "/name",
    "type": "string"
  },
  {
    "name": "age",
    "path": "/age",
    "type": "int"
  },
  {
    "name": "photo",
    "path": "/photo",
    "type": "binary",
    "binary": true
  }
]

Changes

Changed in 3 of the 54 revisions of this API.4

    • api operation id Getting Form Schema Fields removed and replaced with getFormSchemaFields

      api-operation-id-removed

    • removed the non-success response with the status 403

      response-non-success-status-removed

    • api operation id getFormSchemaFields removed and replaced with Getting Form Schema Fields

      api-operation-id-removed

    • added the non-success response with the status 403

      response-non-success-status-added

    This revision also has 11 changes that name no endpoint, such as unreferenced schemas being removed. See the revision's changelog