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.
| Attribute | Description |
|---|---|
| trackingCode | StringRequired (if trackingCode is not specified). A transaction tracking code. |
| submitKey | StringRequired (if submitKey is not specified). A transaction submit key. |
| assertions | objectsRequired. A list of assertion objects. |
| assertion | StringRequired. An assertion; one of the following: "equals", "notEquals", "equalsIgnoreCase", "notEqualsIgnoreCase", "contains", "notContains", "exists", "notExists", "greaterThan", "lessThan". |
| assertedValue | StringRequired. The assertion object value to be checked against the assertion. |
| path | StringRequired. The assertion object path, where to look up the value. |
| type | StringRequired. 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".
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.
{
"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.
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".
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"
}
]
}
{
"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"
}
]
}