Skip to main content

Version: 22.10

TestCenter POST

Perform post request with assertion statements.

Request​

HTTP request​

The TestCenter REST API endpoint URL is:

POST https://<TM_SERVER>/manager/secure/rest/test-center/v1/

Request body​

The POST request body must contain a JSON structure pointing to a transaction (by trackingCode or submitKey) and describing the assertions. Each assertion object has an operator (assertion) and value (assertedValue) defining the assertion to check, a path to check against, and an object type.

The set of assertions in JSON attributes is listed below. All attributes are optional unless otherwise indicated.

AttributeDescription
trackingCodeString
Required (if trackingCode is not specified). A transaction tracking code.
submitKeyString
Required (if submitKey is not specified). A transaction submit key.
assertionsobjects
Required. A list of assertion objects.
assertionString
Required. An assertion; one of the following: "equals", "notEquals", "equalsIgnoreCase", "notEqualsIgnoreCase", "contains", "notContains", "exists", "notExists", "greaterThan", "lessThan".
assertedValueString
Required. The assertion object value to be checked against the assertion.
pathString
Required. The assertion object path, where to look up the value.
typeString
Required. The assertion object type; one of the following: "formDataMap", "property", "txn", "xml".

Response​

If successful, this operation returns a response with a HTTP 200 OK status code.

Examples​

Submit key​

This example test transaction with submit key "a6eca4fa2cdce8f343a8a3e2047badda" for the assertion:

  • Transaction's delivery status is equal to "Not Ready".
Example request
POST /manager/secure/rest/test-center/v1/ HTTP/1.1
Host: https://transact.maguire.com
Content-Type: application/json

{
"submitKey": "a6eca4fa2cdce8f343a8a3e2047badda",
"assertions": [
{
"assertedValue": "Not Ready",
"assertion": "equals",
"path": "deliveryStatus",
"type": "txn"
}
]
}

Note that the response assertion "status" is true.

Example response
{
"submitKey": "a6eca4fa2cdce8f343a8a3e2047badda",
"assertions": [
{
"assertedValue": "Not Ready",
"assertion": "equals",
"path": "deliveryStatus",
"status": true,
"type": "txn"
}
]
}

Transaction not found​

This example tests for a transaction with tracking code "1234567890", but no such transaction exists.

Example request
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"
}
]
}

This request returns a 404 Not Found response.

Not found submission for the specified submitKey/trackingCode.

Several assertions​

This example tests the transaction with tracking code "YMQ8TN6" against these four assertions:

  • The Form data map path "FirstName" is equal to "JeffJ".
  • Transaction's delivery status is equal to "Completed".
  • Transaction's delivery status does not contain "Comp1".
  • Form XML's revision number is greater than "5".
Example request
POST /manager/secure/rest/test-center/v1/ 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"
}
]
}
Example 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"
}
]
}