IM Policy Xpress - Using "REST Base Query"

Document ID : KB000012728
Last Modified Date : 14/02/2018
Show Technical Document Details

This how-to is illustrated by using JSONPlaceholder which is a simple fake REST API for testing and prototyping. 



By instance creating a resource using curl can be done as following: 

curl -X POST -d "userId=1&title=foo&body=bar" 

This will return: 

{ "userId": 1, "title": "foo", "body": "bar", "id": 101 } 


From one IM Policy Xpress, How to pass the data ("userId=1&title=foo&body=bar") to this REST API service?


You need to set those data into the Request Body, here with a json format.


You can run the test from a Data Element with the following settings:

    Category:Data Sources

    Type: REST Base Query

    Function: Basic Auth Invoke

    Base URL:

    Operation: POST

    User Name: dummy

    Password: dummy

    Request Body: {"userId":1,"title":"foo","body": "bar"}


This test will return the following:

Confirmation:   The test has run successfully with following string representational output: "{"id":101,"title":"foo","body":"bar","userId":1}".

This demonstrates that you have properly passed the parameters since they have been processed with success.