Question
Retrieve a JSON response and use it as a REST request body
Hello,
I need to create a REST Connector "GetJSON" with a GET method. It will return a JSON.
Then I should retrieve this JSON and put it as Request body JSON for another REST connector "CreateCM" that uses a POST method.
Normally, when I have JSON response, it is to later use the properties generated, which is automatically done with Pega.
And if we need a JSON as a request body, then we attach a json file in the creation of the connector: in the Rest connector wizard. And the properties we want are also automatically generated.
But, in this case, it is different, because I need the response of "GetJSON" connector to be the request body of "CreateCM" connector; which means I didn't attach the file at the beginning while using the Rest connector wizard.
How can I implement this use case?
Thank you,
So your requirement is to first conenct to a REST endpoint which returns a JSON and use that JSON to make a POST call to another service.
Normally, for the first call i think you can use the map to as clipboard and map it to a property, this would map the entire content of the JSON to that property.
then assuming you are using a activity for this you could have the reverse mapping for the second connector to have the mapFrom as clipboard and mapFromKey as the same property used earlier in first conenctor.
so you would need 2 connectors , first do a get call and retrieve the json string and map it to the same prperty which would be picked by the second connector.