on 2019 Nov 20 9:18 AM
Hi,
I am using an HTTP operator to make a POST request to an endpoint in a Data HUB pipeline as follows -
The POST request succeeds. I can verify that by checking the logs of the application to which the call is made. The application returns a transformed JSON of the POST request. I have verified the behavior using POSTMAN client as well.
The following is a snippet of the logs when the POST call from the pipeline is made -
The problem arises with the response from the HTTP Client. I have tried to see the response using a wiretap operator but nothing shows up in the wiretap console. I have also noticed that if I am making a GET call to an endpoint, then the response is captured in wiretap operator. Why is that ? Why am I not able to receive the POST request's response from the pipeline ?
Regards,
Boudhayan Dev
So, the HTTP Operator is designed to works as follows -
1. GET polling without consuming input.
2. POST call without producing output (in this case output = server's response).
In order to get around this restriction, we need to manually pass the request to the HTTP Client in it's inMessage(message) port. The response from the server will now be available in the outResponse(message) port.
The JS operator contains the following script -
$.addTimer("1000ms",sendPOST);
function sendPOST(ctx) {
$.outMessage({
Attributes: {
"http.url" : "https://example.com/map",
"http.method" : "POST",
"http.Content-Type" : "application/json"
},
Body: {
"CONTACT": "12344",
"EMAIL": "boudhayan.dev@test.com",
"FIRST_NAME": "Boudhayan",
"ID": 14,
"LAST_NAME": "Dev"
}
});
}
Regards,
Boudhayan Dev
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It looks like you're viewing the output port outMessage, have you tried checking the data from the out port?
Michael
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
64 | |
8 | |
8 | |
6 | |
6 | |
6 | |
6 | |
6 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.