Create Requests :
To create a new Rest
request for a Transformer:
- Select the
Rest
type Transformer and click "New Request" on hover to create a request. - Navigate to the created request & select it to configure.
- User will see three tabs
L1, L2 & L3
.L1
represents dynamically generated transformer request url's, InL2
we put request & response rules and inL3
we provide client request & response body for client's url.
- Client url can be any valid url which will return the expected response.
- Now in
L1
provide necessary datamethod, parameters, content type, body, headers
. - Transformer rules scripts can be applied using
L2
tab. - In
L3
provide client url, content type, method, body etc.
- If client content type is ISO then it will need an endpoint, port & a spec file.
- Save the configured request and Start the Transformer.
Execute Rest Request
To test a Rest Transformer request:
- Copy the URL of the desired Rest request within the Transformer.
- Go to the API module and Paste the Transformer 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 Transformer after simulating a request.
Example :
We will simulate an Atm Transaction request, In which user will provide JSON payload and internally this request will execute client request with ISO payload data :
L1 request & response body :-
// L1 Request Body
{
"card_number": "1234567890123456789",
"amount_withdrawn": 100.00,
"transaction_type": "withdrawal"
}
// L1 Response Body
{
"transaction_id": "123456",
"status": "success"
}
L3 request & response body :-
- These below bodies have been used to create L3 request.
- User can use these body and simulate an L3 ISO request using PruTAN's Hostbox module.
// L3 Request Body
<isomsg>
<header/>
<field id="0" value="0200"/>
<field id="2" value="1234567890123456789"/>
<field id="3" value="000000"/>
<field id="4" value="000000010000"/>
</isomsg>
// L3 Response Body
<isomsg>
<header/>
<field id="0" value="0200"/>
<field id="2" value="1234567890123456789"/>
<field id="3" value="010000"/>
<field id="39" value="00"/>
</isomsg>
- Now follow above steps and execute this above simulated request in API module. User will get simulated response body as response after request execution.
- For a detailed analysis of Transformer requests, users can check the Transformer's Analytics submenu.
- Repeat these steps for different scenarios within the Transformer to thoroughly test your Rest APIs efficiently.
Table of Contents