Asset Bundle migration API
tip
- To explore Asset Bundle migration via scripts, refer to the guide.
- To make API requests on a Windows 10 machine shipped with cURL, refer to the Windows 10 cURL example section.
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—APP or INT, depending on the topology—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.
Import
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": "FIS_V2_BUNDLE",
"importStatus": "ACCEPTED",
"errors": [],
"warnings": []
}
Failed response example
{
"uuid": null,
"bundleName": "FIS_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": "SUCCEEDED",
"inProgressCount": 0,
"importedCount": 5,
"failedToImportCount": 0,
"skippedCount": 0,
"infos": [
"[business-process/KYC+remediation_+negative+news+v10.1.zip]: Submit asset for process",
"[business-process/KYC+remediation_+negative+news+v10.1.zip]: Start handle asset by path",
"[business-process/KYC+remediation_+negative+news+v10.1.zip]: Business process successfully imported, full import log: https://core2-workfusion-lb1.workfusion.com:443/workfusion/secure/file/download?uuid=1ff9562e-fad8-45e1-9f46-1763f516127d",
"[artifactory-dependency/bcb/com/workfusion/gorilla/google-translate-bcb/10.1/google-translate-bcb-10.1.jar]: Submit asset for process",
"[artifactory-dependency/bcb/com/workfusion/gorilla/google-translate-bcb/10.1/google-translate-bcb-10.1.jar]: Start handle asset by path",
"[artifactory-dependency/bcb/com/workfusion/gorilla/google-translate-bcb/10.1/google-translate-bcb-10.1.jar]: Asset successfully submitted",
"[artifactory-dependency/bcb/com/workfusion/gorilla/negativenews-input-bcb/10.1/negativenews-input-bcb-10.1.jar]: Submit asset for process",
"[artifactory-dependency/bcb/com/workfusion/gorilla/negativenews-input-bcb/10.1/negativenews-input-bcb-10.1.jar]: Start handle asset by path",
"[artifactory-dependency/bcb/com/workfusion/gorilla/negativenews-input-bcb/10.1/negativenews-input-bcb-10.1.jar]: Asset successfully submitted",
"[artifactory-dependency/bcb/com/workfusion/gorilla/negativenews-output-bcb/10.1/negativenews-output-bcb-10.1.jar]: Submit asset for process",
"[artifactory-dependency/bcb/com/workfusion/gorilla/negativenews-output-bcb/10.1/negativenews-output-bcb-10.1.jar]: Start handle asset by path",
"[artifactory-dependency/bcb/com/workfusion/gorilla/negativenews-output-bcb/10.1/negativenews-output-bcb-10.1.jar]: Asset successfully submitted",
"[artifactory-dependency/bcb/com/workfusion/gorilla/negativenews-processing-bcb/10.1/negativenews-processing-bcb-10.1.jar]: Submit asset for process",
"[artifactory-dependency/bcb/com/workfusion/gorilla/negativenews-processing-bcb/10.1/negativenews-processing-bcb-10.1.jar]: Start handle asset by path",
"[artifactory-dependency/bcb/com/workfusion/gorilla/negativenews-processing-bcb/10.1/negativenews-processing-bcb-10.1.jar]: Asset successfully submitted"
],
"warnings": [],
"errors": [],
"name": "artifactory-dependency",
"validationErrorMessage": null,
"metaInfo": {
"author": "dgorodetski",
"description": "",
"instance": "rcm-3162-v2-workfusion-lb1.workfusion.com",
"name": "KYC remediation: negative news v10.1",
"packageDate": 1570083971000,
"targetVersion": "10.0.0; 10.1.0.0",
"wfBranch": "master",
"wfRevision": "9a351d4c",
"wfVersion": "10.1.0.0",
"unknownProperties": {}
},
"components": [
{
"status": "SUCCEEDED",
"inProgressCount": 0,
"importedCount": 1,
"failedToImportCount": 0,
"skippedCount": 0,
"infos": [
"[business-process/KYC+remediation_+negative+news+v10.1.zip]: Submit asset for process",
"[business-process/KYC+remediation_+negative+news+v10.1.zip]: Start handle asset by path",
"[business-process/KYC+remediation_+negative+news+v10.1.zip]: Business process successfully imported, full import log: https://core2-workfusion-lb1.workfusion.com:443/workfusion/secure/file/download?uuid=1ff9562e-fad8-45e1-9f46-1763f516127d"
],
"warnings": [],
"errors": [],
"componentName": "BUSINESS_PROCESS",
"importDetails": {
"business-process/KYC+remediation_+negative+news+v10.1.zip": {
"uuid": "de30aba3-0c8d-44a8-b6ef-bdef5830a0ef"
}
}
},
{
"status": "SUCCEEDED",
"inProgressCount": 0,
"importedCount": 4,
"failedToImportCount": 0,
"skippedCount": 0,
"infos": [
"[artifactory-dependency/bcb/com/workfusion/gorilla/google-translate-bcb/10.1/google-translate-bcb-10.1.jar]: Submit asset for process",
"[artifactory-dependency/bcb/com/workfusion/gorilla/google-translate-bcb/10.1/google-translate-bcb-10.1.jar]: Start handle asset by path",
"[artifactory-dependency/bcb/com/workfusion/gorilla/google-translate-bcb/10.1/google-translate-bcb-10.1.jar]: Asset successfully submitted",
"[artifactory-dependency/bcb/com/workfusion/gorilla/negativenews-input-bcb/10.1/negativenews-input-bcb-10.1.jar]: Submit asset for process",
"[artifactory-dependency/bcb/com/workfusion/gorilla/negativenews-input-bcb/10.1/negativenews-input-bcb-10.1.jar]: Start handle asset by path",
"[artifactory-dependency/bcb/com/workfusion/gorilla/negativenews-input-bcb/10.1/negativenews-input-bcb-10.1.jar]: Asset successfully submitted",
"[artifactory-dependency/bcb/com/workfusion/gorilla/negativenews-output-bcb/10.1/negativenews-output-bcb-10.1.jar]: Submit asset for process",
"[artifactory-dependency/bcb/com/workfusion/gorilla/negativenews-output-bcb/10.1/negativenews-output-bcb-10.1.jar]: Start handle asset by path",
"[artifactory-dependency/bcb/com/workfusion/gorilla/negativenews-output-bcb/10.1/negativenews-output-bcb-10.1.jar]: Asset successfully submitted",
"[artifactory-dependency/bcb/com/workfusion/gorilla/negativenews-processing-bcb/10.1/negativenews-processing-bcb-10.1.jar]: Submit asset for process",
"[artifactory-dependency/bcb/com/workfusion/gorilla/negativenews-processing-bcb/10.1/negativenews-processing-bcb-10.1.jar]: Start handle asset by path",
"[artifactory-dependency/bcb/com/workfusion/gorilla/negativenews-processing-bcb/10.1/negativenews-processing-bcb-10.1.jar]: Asset successfully submitted"
],
"warnings": [],
"errors": [],
"componentName": "ARTIFACTORY_DEPENDENCY",
"importDetails": {}
}
]
}
Export
POST /bundle-export/trained-model
Triggers the export process that creates an Asset Bundle for a specified trained model.
The export procedure returns the export UUID and the ACCEPTEDexport status in case of a successful export. In case any errors occur, the export status is FAILED. Exact errors are listed in the errors property.
Parameters
modelName: UUID of a trained model to be exportedname: Optional, name of the bundle to be exporteddescription: Optional, description of the exported bundle
Request example
curl --request POST \
--url https://host/workfusion/api/v1/bundle-export/trained-model/ \
--header 'X-CSRF-TOKEN: 60bec5f5-29ce-4bdc-bb0b-3c352265ef50'
--header 'cache-control: no-cache'
--data modelName=assignment_property_10
Successful response example
{
"uuid": "a91bc45a7-8acb-4466-bdb6-f434f6d1b3e4",
"status": "ACCEPTED",
"errors": [],
"warnings": []
}
Failed response example
{
"uuid": null,
"status": "FAILED",
"errors": ["Trained model with specified model name is not found assignment_property_10"],
"warnings": []
}
GET /bundle-export/{uuid}
Looks up for the export status. Returns the bundle export status information.
Request example
curl --request GET \
--url http://host/workfusion/api/v1/bundle-export/c6771931-70bd-49c5-bff0-addc990e9e40 \
--header 'X-CSRF-TOKEN: a74cda5f-cd3b-4a32-a8e5-074a2ad5664a' \
--header 'cache-control: no-cache'
Successful response example
{
"uuid": "d29ce4e6-a1c0-4c42-8550-eacc59b3a5de",
"status": "SUCCEEDED",
"path": "d29ce4e6-a1c0-4c42-8550-eacc59b3a5de/deed_seller_10.zip",
"errorMessage": null
}
GET /bundle-export/download/{uuid}
Downloads Asset Bundles. Returns 404 in case an Asset Bundle is not ready.
Request example
curl --request GET \
--url https://host/workfusion/api/v1/bundle-export/download/f57aa7ac-3f2f-48bb-bbe7-6dd958ff44e4
--header 'X-CSRF-TOKEN: 60bec5f5-29ce-4bdc-bb0b-3c352265ef50'
--header 'cache-control: no-cache'
--output 'output.zip'
Windows 10 cURL example
Windows 10 is shipped with the cURL utility, but its syntax differs from that of Linux commands. The example below shows how to execute cURL requests on a Windows machine:
Log in. Make sure you can create and edit the file inside the target location without Administrator rights. It is created automatically.
curl -X POST -d "j_username=username&j_password=password" -H "Connection: keep-alive" -c "C:/Users/user1/cookie.txt" https://workfusion-lb.wf.tc.ab.zz/workfusion/api/dologinTo import an Asset Bundle, insert the token you received from the previous response instead of
<token>:curl -X POST -H "X-CSRF-TOKEN: <token>" -H "Connection: keep-alive" -H "cache-control: no-cache" -H "content-type: multipart/form-data" -b "C:/Users/user1/cookie.txt" -F "bundleFile=@C:/Users/user1/usecase-package-21.09.017.zip" https://<instance-name>/workfusion/api/v1/bundle-import/To check the import status, insert the import UUID you received from the previous response instead of
<import_uuid>.curl -X GET -H "X-CSRF-TOKEN: 9f4a4ca1-6d32-4c66-acd7-c157892c56df" -H "Connection: keep-alive" -H "cache-control: no-cache" -b "C:/user1/060156/cookie.txt" https://<instance-name>/workfusion/api/v1/bundle-import/<import_uuid>