REST TestCenter API
The TestCenter API provides a REST service for performing test operations in Journey Manager.
Security
To access the Tasks REST endpoint the caller needs to be authenticated using HTTP Basic Authentication. The authenticated user will need an user account on the Journey Manager server and this account will need to be active and have access to the Management Console module.
To be authorized to call the service the user account will also need the Management Console permission 'REST Test Center API
'.
You will also need to be either an administrator with global access or be associated with an organization to access its transaction
records.
URL Endpoint
The REST TestCenter API URL endpoint is as follows:
``` https://Service API
This section provides a description all the REST TestCenter API operations including:
POST
Perform post request with assertion statements.
URL Format
POST https://<tm server>/manager/secure/rest/test-center/v1/
POST Body
The POST request must contain body that contains a JSON structure pointing to transaction (by tracking code or submit key) and describing the assertions. Each assertion object has assertion path, type (properties, xml, txn, formDataMap) and value. Moreover, it specifies the assertion check (equals, notEquals, etc.).
The set of assertions in JSON attributes is listed below (all attributes are mandatory unless indicated otherwise):
Attribute | Type | Description |
---|---|---|
trackingCode | String | transaction tracking code (should be specified if no submit key) |
submitKey | String | transaction submit key (should be specified if no tracking code) |
assertions | List of assertion objects | list of assertion objects |
assertion | String | assertion [ equals | notEquals | equalsIgnoreCase | notEqualsIgnoreCase | contains | notContains | exists | notExists | greaterThan | lessThan ] |
assertedValue | String | assertion object value to be checked |
path | String | assertion object path where to look up the value |
type | String | assertion object type [ formDataMap | property | txn | xml ] |
Example: Test assertion for submit key
This example test transaction with submit key "a6eca4fa2cdce8f343a8a3e2047badda" for assertion:
- Transaction's delivery status equals to "Not Ready" (note that response assertion status is true)
POST <b>/manager/secure/rest/test-center/v1/</b> HTTP/1.1
Host: https://transact.maguire.com
Content-Type: application/json
{
"submitKey": "a6eca4fa2cdce8f343a8a3e2047badda",
"assertions": [
{
"assertedValue": "Not Ready",
"assertion": "equals",
"path": "deliveryStatus",
"type": "txn"
}
]
}
200 Response
{
"submitKey": "a6eca4fa2cdce8f343a8a3e2047badda",
"assertions": [
{
"assertedValue": "Not Ready",
"assertion": "equals",
"path": "deliveryStatus",
"status": true,
"type": "txn"
}
]
}
Example: Test not found transaction
This example test transaction with tracking code "1234567890" but it does not exist. ``` POST /manager/secure/rest/test-center/v1/ HTTP/1.1 Host: https://transact.maguire.com Content-Type: application/json{ "trackingCode": "1234567890", "assertions": [ { "assertedValue": "Completed", "assertion": "equals", "path": "deliveryStatus", "type": "txn" } ] }```
404 Not Found Response
Not found submission for the specified submitKey/trackingCode.
Example: Test several assertions
This example test transaction with tracking code "89AC4910" for four assertions:
- Form data map's path "FirstName" equals to "JeffJ"
- Transaction's delivery status equals to "Completed"
- Transaction's delivery status does not contain "Comp1"
- Form xml's revision number is greatner than "5"
POST <b>/manager/secure/rest/test-center/v1/</b> HTTP/1.1
Host: https://transact.maguire.com
Content-Type: application/json
{
"trackingCode": "YMQ8TN6",
"assertions": [
{
"assertedValue": "JeffJ",
"assertion": "equals",
"path": "FirstName",
"type": "formDataMap"
},
{
"assertedValue": "Completed",
"assertion": "equals",
"path": "deliveryStatus",
"type": "txn"
},
{
"assertedValue": "Comp1",
"assertion": "notContains",
"path": "deliveryStatus",
"type": "txn"
},
{
"assertedValue": "5",
"assertion": "greaterThan",
"path": "//RevisionNumber",
"type": "xml"
}
]
}
200 Response
{
"trackingCode": "YMQ8TN6",
"assertions": [
{
"assertedValue": "JeffJ",
"assertion": "exists",
"path": "FirstName",
"status": false,
"type": "formDataMap"
},
{
"actualValue": "Not Ready",
"assertedValue": "Completed",
"assertion": "equals",
"path": "deliveryStatus",
"status": false,
"type": "txn"
},
{
"assertedValue": "Comp1",
"assertion": "notContains",
"path": "deliveryStatus",
"status": true,
"type": "txn"
},
{
"actualValue": "1",
"assertedValue": "5",
"assertion": "greaterThan",
"path": "//RevisionNumber",
"status": false,
"type": "xml"
}
]
}