Create a Form Space Resource

   Journey Manager (JM) The transaction engine for the platform. |   System Manager / DevOps |  24.10This feature was updated in 24.10

Manager allows you to create different types of resources to be hosted in a form space.

You can create a resource using one of following options:

Create Using UI

To create a resource:

  1. Select Forms > Form Spaces.
  2. Locate a form space and click Edit.
  3. Click the Resources tab and then click New.
    Note

    If the Resources tab is not shown, select the Content Editable checkbox in Configure a Form Space.

    Note

    You must have the Portal Content Edit permission to be able to create new resources.

    Manger create a new resource
  4. Enter a path of a new resource where it will be hosted. The path is relative to the form space context path, for example, resources/CSS/learning.css.
  5. Enter a content of the new resource. You can add content directly into the content text area for a CSS resource or any other textual resources, for example, a Word document.
  6. Click File Upload to attach a file as a resource, such as an image, translation CSV file and PDF file. You can upload files only if their file name extensions are white-listed in the Allowed File Name Extensions In JM deployment property.  |  24.04 This feature was introduced in 24.04
  7. Click Save to update the changes. This creates the resource.

Create Using Fluent API

The Journey Manager provides the Fluent API to create and update form space resources. The methods are create, update and createOrUpdate and they require either a form space ID or name to be set to create or modify a resource. This is illustrated below:

new SpaceResourceBuilder(txn)
    .setSpaceId​(733)
    .setSpaceName("workspaces")
    .setResourcePath("resources/html/test.html")
    .setFileData(new byte[] {1,2,5})
    .createOrUpdate

Create Using REST API

The Journey Manager REST API provides the endpoint URL to create and update form space resources.

To call this REST API, you need:

HTTP Request
Both HTTP and HTTPS protocols are supported:
http(s)://{JM_SERVER}/manager/secure/rest/fluentapi/spaceresourcebuilder/create
Parameters
Content-Type:application/json - a content type.
Accept:application/json - a data load in JSON format including setSpaceId, setResourcePath and setFileData.
Response
If successful, this operation returns the following response with a HTTP 200 OK status code:
fileSize - a size of a resource.
lastModified - when the resource was updated.
modifiedBy - a user who updated the resource.
space - a form space where the resource belongs to.
resourcePath - a relative path to the resource.
Example
A request:
curl --location --request POST ‘POST https://{JM_SERVER}/manager/secure/rest/fluentapi/spaceresourcebuilder/create \
Content-Type:application/json \
Accept:application/json \
{ \
   "setSpaceId" : "733", \
   "setResourcePath" : "resources/html/test.html", \
   "setFileData" : "the base64 converted string value of byte data" \
}’
A response:
{
    "fileSize": "1.00 KB",
    "lastModified": "Wed Sep 04 14:49:41 AEST 2024",
    "modifiedBy": "administrator",
    "space": "Work Spaces",
    "resourcePath": "/resources/html/test.html"
}

Next, learn how to configure a form space resource.