Asset Bundle migration API
tip
To learn about Asset Bundle migration via scripts, refer to the guide.
Authentication
Asset Bundle migration API uses form-based (login and password) authentication to ensure that it is only accessible to users with proper credentials.
Note that CSRF protection is added to REST endpoints. To make a REST call, add a CSRF token to the request header:
Before executing REST API requests, log in using the form URL:
POST method
POST /workfusion/api/dologin Content-Type: application/x-www-form-urlencoded j_username=usernamej_password=passwordwhere:
j_usernameis your username in Control Tower.j_passwordis your password in Control Tower.
The body of a successful request from the server looks like this:
{ "success": true, "csrfToken": <csrftoken>, "csrfHeaderName": <csrftokenname> }Get
JSESSIONIDfrom the Set-Cookie response header.When creating REST API requests:
- Set
JSESSIONIDto the Cookie header. - Set
application/x-www-form-urlencodedas the Content-Type header. - Set the received
<csrftoken>as the<csrftokenname>header.
- Set
For more information on the API security, see WorkFusion REST API documentation.
Using REST API with SSO
Whether you are using SSO or not determines which username or password import requests use. When importing Asset Bundle with SSO enabled, you cannot use your SSO ID and password. The recommended approach is as follows:
Log in to the installation server as the application user.
In the
INSTALL_DIR/workfusion/conf/workfusion.propertiesfile, change thewf.sso.saml.enableproperty to disable SSO:`wf.sso.saml.enable=false`.Restart Control Tower by running the
wfmanager restart workfusioncommand.Log in to Workfusion with the pre-SSO ID and password.
Create a special REST API user.
Grant the user required the Advanced Package Import and Import/Export permissions.
Go back to the Master server. In the
INSTALL_DIR/workfusion/conf/workfusion.propertiesfile, change thewf.sso.saml.enableproperty to enable SSO:wf.sso.saml.enable=true
Using REST API with LDAP
To enable using REST API with LDAP authentication, follow the steps below:
- In the
INSTALL_DIR/workfusion/conf/workfusion.propertiesfile, disable LDAP by changing theldap.enabled=falseproperty. - Restart Control Tower by running the
wfmanager restart workfusioncommand. - Log in to Workfusion with the pre-LDAP ID and password.
- Create a special REST API user and grant them the necessary permissions by assigning proper roles.
- In the
INSTALL_DIR/workfusion/conf/workfusion.propertiesfile, enable SSO by updating theldap.enabled=trueproperty. - Restart Control Tower by running the
wfmanager restart workfusioncommand.
Now, LDAP is enabled, and you can use it for REST API authentication the same way you use SSO.
POST /bundle-import
Uploads an Asset Bundle to a temporary folder, validates the bundle structure, and starts asynchronous import.
Returns the import UUID and status. The following statuses are possible:
- ACCEPTED: Successful start of the import
- UPLOAD_FAILED: Failed bundle upload to the temporary folder
- VALIDATION_FAILED: Incorrect checksum or bundle structure
- FAILED: Occurred errors
Parameters:
bundleFile: Path to the zip file representing the Asset Bundle. The acceptable size is up to 3 GB.checksum: Optional; md5 checksum of the Asset Bundle.type=text/plainis mandatory. Otherwise, the checksum is ignored.
Request example
curl --request POST \
--url https://demoserver.com/workfusion/api/v1/bundle-import/
--header 'X-CSRF-TOKEN: 87345da0-9ccb-475e-bdb6-f323f6d0a2d3 \
--header 'cache-control: no-cache' \
--header 'content-type: multipart/form-data' \
--form 'bundleFile=@/C:/V2_bundle.zip' \
--form checksum=8401f840cd7ab27d0829a47120dae341;type=text/plain
Successful response example
{
"uuid": "a91bc45a7-8acb-4466-bdb6-f434f6d1b3e4",
"bundleName": "V2_BUNDLE",
"importStatus": "ACCEPTED",
"errors": [],
"warnings": []
}
Failed response example
{
"uuid": null,
"bundleName": "V2_BUNDLE",
"importStatus": "VALIDATION_FAILED",
"errors": [
"Checksum not identical"
],
"warnings": []
}
GET /bundle-import/{uuid}
Checks the status of the import operation and returns the bundle import information, including:
- Status of the entire bundle
- Status of each component in a bundle, for instance, a Data Store, Business Process, and so on
- Statistics fields, for example, the count of in-progress assets, the number of failed assets, and so on
- Messages generated during import
Possible statuses for entire bundle import:
- RUNNING: Import in progress. Some components could be already imported with the SUCCEED or FAILED status.
- SUCCEED: Import of all components completed successfully.
- FAILED: Import of the bundle completed with errors, check error messages for failed components.
Possible statuses for component import:
- RUNNING: Import in progress.
- SUCCEED: Import completed successfully.
- FAILED: Import completed with errors, check the error messages for the component.
Request example
curl --request GET \
--url https://host/workfusion/api/v1/bundle-import/c5926adb-b669-46dc \
--header 'X-CSRF-TOKEN: 87345da0-9ccb-475e-bdb6-f323f6d0a2d3' \
--header 'cache-control: no-cache'
Response example
"status": "FAILED",
"inProgressCount": 0,
"importedCount": 1,
"failedToImportCount": 1,
"skippedCount": 0,
"infos": [
"[s3/doc-upload/QA_Regression_Docs/old-data-1.csv]: Submit asset for process",
"[s3/doc-upload/QA_Regression_Docs/old-data-1.csv]: Start handle asset by path",
"[s3/doc-upload/QA_Regression_Docs/old-data-1.csv]: Asset successfully submitted"
],
"warnings": [],
"errors": [
"[s3/empty-bucket-core2]: Asset Package requires configured S3 Context Map for the key: core2"
],
"name": "demo_Bundle_s3_all_in_one",
"validationErrorMessage": null,
"metaInfo": {
"author": "user user",
"description": "Some specific description for bundle",
"instance": "wfinst-307-92-ct1.workfusion.com",
"name": "pack name",
"packageDate": 1561703083000,
"targetVersion": "10.1.0.4",
"wfBranch": "bcb-intake-9.2.0.3",
"wfRevision": "bf19d7ff",
"wfVersion": "10.1.0.4",
"unknownProperties": {}
},
"components": [
{
"status": "FAILED",
"inProgressCount": 0,
"importedCount": 8,
"failedToImportCount": 8,
"skippedCount": 0,
"infos": [
"[s3/doc-upload/QA_Regression_Docs/old-data-1.csv]: Submit asset for process",
"[s3/doc-upload/QA_Regression_Docs/old-data-1.csv]: Start handle asset by path",
"[s3/doc-upload/QA_Regression_Docs/old-data-1.csv]: Asset successfully submitted"
],
"warnings": [],
"errors": [
"[s3/empty-bucket-core2]: Asset Package requires configured S3 Context Map for the key: core2"
],
"componentName": "S3"
}
]
}