I am trying to use the HTTPconnector to run an API to extract a column and put it in a certain column in the database. I am able to do it successfully when I put the body of the call in "requestContent' for one call
$out.0.requestContent = 'https//whateverthelink';
I need to do this for hundreds of records. so I put the body of the call in a column and called the
"requestContent = '$in.0.TheColumn'
but this is not working, It is not reading the body of the call from the column, i think it is has something to do with the way httpconnector is set up, can someone kindly help me with this?
-
Hi Mahmood,
The HTTPConnector can work with dynamic input. However, the Request Content needs to be properly formatted according to the API you are using.
Let me give you an example using our REST API, specifically for creating a new sandbox.
The DataGenerator generates random codes for the sandboxes to be created. The crucial step is wrapping the input from the DataGenerator into the proper format in the Input Mapping of the HTTPConnector.
For our REST API, the format must follow the JSON structure, so the Request Content should be:
{
"code": "MyNewSandbox"
}
To achieve creating sandboxes dynamically using the DataGenerator inputs, the formula in HTTPConnector Input Mapping must be as follows to represent proper format of the request:
function integer transform() {
$out.0.requestContent = "{ \"code\": \"" + $in.0.sandboxName + "\"}";Keep in mind that if you want to include quotation marks inside a string, you need to use a backslash (
\
) as an escape character. This is necessary because quotation marks have a special meaning - they define the beginning and end of a string. The escape character ensures that the quotation marks are treated as part of the string and not as the end or beginning of the string.
Best regards, Tom.
Please sign in to leave a comment.
Comments 1