Create Requests
To create a new Rest request for a Sandbox:
- Select the
Resttype Sandbox and click "New Request" to create a named request. - After request creation, click on the Sandbox to see the created request.
- Click on the request to select it and view the dynamically created URL in the URL Input Box.
- Choose the appropriate HTTP method.
- Provide necessary data (parameters, body, headers, rules) if required.
- Save the request.
- After saving the request, click the
Startbutton to start the Sandbox.
Example :
We will simulate a POST Create Payment request inside a sample collection. The simulated incoming request body and outgoing response body look like this:
// Incoming Request Body
{
"cardholderInformation": {
"cardholderName": "John Doe",
"companyName": "SP Ltd"
},
"contactDetails": {
"phoneNumber": "+18663197450",
"email": "moneris@moneris.com"
},
"billingAddress": {
"unitNumber": "123A",
"streetNumber": "3300",
"streetName": "Bloor Street West",
"city": "Toronto",
"province": "ON",
"postalCode": "M8X 2X2",
"country": "CA"
},
"paymentMethodSource": "CARD",
"card": {
"cardNumber": "4111111111111111",
"expiryMonth": "12",
"expiryYear": "27",
"cardSecurityCode": "123"
}
}
// Outgoing Response Body
{
"paymentMethodId": "0105ARZ3NDEKTSV4RRFFQ69G5FAV",
"merchantId": "0123456789101",
"cardholderInformation": {
"cardholderName": "John Doe",
"companyName": "SP Ltd"
},
"contactDetails": {
"phoneNumber": "+18663197450",
"email": "moneris@moneris.com"
},
"billingAddress": {
"unitNumber": "123A",
"streetNumber": "3300",
"streetName": "Bloor Street West",
"city": "Toronto",
"province": "ON",
"postalCode": "M8X 2X2",
"country": "CA"
},
"paymentMethodInformation": {
"paymentMethodType": "CARD",
"paymentMethodSource": "CARD",
"cardInformation": {
"bankIdentificationNumber": "123456"
}
}
}The Sandbox auto-generates a routable URL that you can copy and call from the Studio module.
- REST requests in PruTAN support both JSON and XML payloads. Switch the request's Content Type to
application/xmlto work with XML.
XML payload (same scenario):
The same simulated request and response can also be expressed as XML. Just change the Content Type to application/xml and provide the body in XML form:
<!-- Incoming Request Body -->
<paymentRequest>
<cardholderInformation>
<cardholderName>John Doe</cardholderName>
<companyName>SP Ltd</companyName>
</cardholderInformation>
<paymentMethodSource>CARD</paymentMethodSource>
<card>
<cardNumber>4111111111111111</cardNumber>
<expiryMonth>12</expiryMonth>
<expiryYear>27</expiryYear>
<cardSecurityCode>123</cardSecurityCode>
</card>
</paymentRequest>
<!-- Outgoing Response Body -->
<paymentResponse>
<paymentMethodId>0105ARZ3NDEKTSV4RRFFQ69G5FAV</paymentMethodId>
<merchantId>0123456789101</merchantId>
<status>Success</status>
</paymentResponse>The Sandbox flow is identical for XML — define the incoming request and outgoing response, save it, start the Sandbox, then send the request from the Studio module to receive the simulated XML response.
Execute Rest Request
To test a Rest Sandbox request:
- Copy the URL of the desired Rest request within the Sandbox.
- Go to the Studio module and paste the Sandbox request's URL.
- Provide any required data (body, method parameters, headers, etc.).
- Send the request.
- Compare the actual response to the expected response.
- Make sure to start the Sandbox after simulating a request.
Follow the above steps and execute the simulated request in the Studio module. You will receive the simulated response body after request execution — for our example, a 200 OK response containing the paymentMethodId, merchantId, and the echoed cardholder, contact, and billing details.
Repeat these steps for different requests within the Sandbox to thoroughly test your REST APIs efficiently.