PlatformApplicable to all products in Temenos Journey Manager. | Platform Developer | 21.05 This feature was introduced in 21.05.
Journey Manager comes with Fluent API enabling you to implement various complex business requirements. All you need to do is to write a Groovy scrip that calls required API methods and run it within your service. And it all will work. However, what happens when you want to invoke the same Fluent API outside Manager. Now, we have a solution for you!
Journey Manager | 21.05
This feature was introduced in 21.05. introduced a new service (com.avoka.fc.admin.service.FluentApiService.java
), which exposes some of Manager's Fluent API via RESTREST or RESTful API design (Representational State Transfer) is designed to take advantage of existing protocols. While REST can be used over nearly any protocol, it usually takes advantage of HTTP when used for Web APIs. end points. This service is simple to use and yet it provides you with ability to invoke rich in functionality Fluent API.
The Fluent API REST service is included in the Transact Manager WAR module, along with other REST services, so if you've installed or upgraded Journey Manager 21.05+, you have the Fluent API REST service available. The new service architecture is illustrated in the diagram below:
Let's take a look at the Fluent API REST call in detail.
You interaction with the Fluent API REST service starts by sending a REST request. Each Fluent API class and every of its methods (operations) form a single endpoint, which you call by sending a request to a URL in the following format:
https://{SERVER}/manager/secure/rest/fluentapi/{CLASSNAME}/{OPERATION}
Where:
SERVER
: your Manager server instance.CLASSNAME
: a case-insensitive name of Fluent API class, for example, txnupdater
for the TxnUpdater
class.OPERATION
: a case-insensitive name of a final method (operation) to be called on this API, for example, update
.We have chosen the combination of class names and methods to simplify the learning curve for developers, who are already familiar with our Fluent API.
You have to provide a body payload for an operation in a JSONJSON (JavaScript Object Notation) is an open standard file format and data interchange format that uses human-readable text to store and transmit data objects consisting of attribute–value pairs and arrays. format, where each set
method has its own entry in the JSON file. The Fluent API REST server processes the request and sends a response back with a response code and a payload, depending on an operation.
Let's illustrate it with a simple example. Suppose, you want to update a transaction delivery status from a Groovy script. For that, you use the TxnUpdater
class, as shown below.
import com.avoka.tm.svc.*
import com.avoka.tm.vo.*
new TxnUpdater(txn)
.setId​(733)
.setDeliveryStatus(Txn.DELIVERY_READY)
.update()
You can achieve the same result by executing this POST request with a payload:
POST https://{SERVER}/manager/secure/rest/fluentapi/txnupdater/update
Content-Type:application/json
Accept:application/json
{
"setId" : "733",
"setDeliveryStatus" : "Ready"
}
Let's examine the REST POST method:
txnupdater
is the TxnUpdater
class.update
is the last method to be called on the instance of TxnUpdater class, which is the update ()
method.setId
sets a transaction ID to be updated, which is the setId()
method.setDeliveryStatus
sets the Ready status of a transaction, which is the setDeliveryStatus()
method.You can see the REST method basically mimics the Fluent API call, which makes developer's life much easier.
Each Fluent API REST request has a corresponding response including an HTTP code and data in a JSON format or an error message. We've simplified and minimized the number of responses, so it's easy to use the service.
The Fluent API REST service returns the following HTTP response codes:
Manager has a new REST Fluent API core permission which you must assign to roles of users who will invoke the Fluent API REST service. The Administrator role has this permission set by default. We recommend creating a dedicated user with this permission.
Manager has the following CLASSNAMEs implemented:
http://<DOMAIN_NAME>/manager/secure/rest/fluentapi/clientbuilder/create
{
"setName": "workspaces",
"setCode": "workspaces",
"setStatus": "Active",
"addSpaceName": "Work Spaces",
"setDescription": "some description"
}
https://<DOMAIN_NAME>/manager/secure/rest/fluentapi/propertyquery/getValue
{
"setName" : "733",
"setTxn" : "{
"id": 439,
"attachmentsStatus": null,
"orgId": 7,
"clientCode": "dccu",
"orgName": "dccu",
"deliveryStatus": "Not Ready",
"deliveryChannel": null,
"deliveryMaxAttempts": null,
"deliveryMessage": null,
"deliveryMethod": null,
"deliveryProcessAttempts": null,
"emailAddress": null,
"emailVerificationStatus": null,
"formId": 54,
"formCode": "originationform",
"formName": "Origination Form",
"formStatus": "Completed",
"formType": "Maestro Form",
"groupNames": [],
"paymentStatus": null,
"paymentTotal": null,
"jobId": 21,
"jobActionId": 75,
"jobRefNumber": "VZTSF33",
"spaceId": 8,
"spaceName": "Work Space",
"receiptNumber": "VZTSF33",
"receiptStatus": "Completed",
"saveChallengeHash": null,
"saveChallengeFailures": null,
"saveChallengeLastFailure": null,
"saveChallengeTimeout": null
timeCreated": "24 Apr. 2019, 9:42 am",
"timeAbandoned": null,
"timeAbandonmentScheduled": null,
"timeUserLastModified": "24 Apr. 2019, 9:42 am",
"timeSubmitted": "24 Apr. 2019, 9:42 am",
"timeCompleted": "24 Apr. 2019, 9:43 am",
"timeDelivered": null,
"timeProcessUpdated": null,
"timePurgeDataScheduled": null,
"timePurgeDataActual": null,
"timePurgeRecordScheduled": null,
"timeRequested": "24 Apr. 2019, 9:42 am",
"timeSubmissionExpiry": null,
"timeTaskExpiry": null,
"timeTaskScheduled": null,
"timeTxnExpiry": null,
"dataDeleted": false,
"submitKey": "12345...",
"trackingCode": "VZTSF33",
"transRefNumber": null,
"userLoginName": null,
"userSaved": false,
"externalUserId": null,
"paymentGatewayTimestamp": null,
"paymentGatewayReceiptNo": null,
"paymentGatewayTxnNo": null,
"processStatus": null,
"formVersionId": 71,
"formVersionNumber": "1.0-develop",
"txnScore": null,
"userAgent": "Mozilla...",
"userAgentDeviceType": "Desktop",
"formAbandonmentType": null,
"formUrl": null,
"receiptUrl": "https://<DOMAIN_NAME>/workspace/servlet/FormReceipt.pdf?submitKey=12345...",
"checkpoints": null,
"formDataMap": {},
"propertyMap": {},
"milestones": [],
"formXml": "",
"receiptPdf": null,
"fileAttachList": [],
"deliveryFuncs": [],
"comments": [],
"commentList": []}"
}
https://<DOMAIN_NAME>/manager/secure/rest/fluentapi/txnbuilder/build
{
"setAddress" : "1 Street",
"setDatetimeExpiry" : "01/11/2024",
"setDatetimeScheduled" : "01/11/2024",
"setEmailSubject" : "Email subject",
"setEmailMessage" : "Email message",
"setFormDataXml" : "<FormData></FormData>",
"setFormCode" : "FRM-1234",
"setLatitude" : "40",
"setLoginName" : "login",
"setLongitude" : "50",
"setSequence" : "2",
"setSpaceName" : "space",
"setTaskMessage" : "taskMessage",
"setTaskSubject" : "taskSubject",
"setTaskType" : "Form",
"withUserDeletableFlag" : "true"
}
Query by ID
https://<DOMAIN_NAME>/manager/secure/rest/fluentapi/txnquery/firstValue
{
"setId" : "733"
}
https://<DOMAIN_NAME>/manager/secure/rest/fluentapi/userbuilder/create
{
"setEmail" : "[email protected]",
"setUserType" : "Local",
"setLoginName" : "loginName",
"setPassword" : "pAs3W0rd!@#"
}
https://<DOMAIN_NAME>/manager/secure/rest/fluentapi/useremailer/sendEmail
{
"setLoginName" : "loginName",
"setSpaceName" : "Work Space",
"setType" : "WELCOME"
}
To provide our customers with the best tools and options to ensure their solution is secure, there is support to the existing Journey Manager API endpoints enabling the use of different authentication methods, such as OAuth or JWTs. This allows setting a security manager for your API that is different to a security manager configured in the Transact Manager module, which is used for authenticating users accessing the Journey ManagerHome Dashboard. This is achieved by separating the APIs into a Manager API module. The module is deployed as the tm-manager-api.war
file and it is available in the installer. | 24.10This feature was updated in 24.10
To call the Journey Manager API, you need to use the URL defined in the Context Path of the Manager API module, for example, https://my-domain.com/manager-api/
.
Next, learn about Fluent Groovy services.