How to configure a POST call for a NodeJS Target

Hi,

I am pretty new to Apigee, but so far I enjoy the user friendliness of the app. I have a basic question. I am trying to do a Service call out (say getDataSCO). Sequentially I have to make a call to a NodeJS target (njsTarget) which is on another Proxy in the same org.

I was able to make a GET call to test if this works as I have a path to handle it. so i used

<LocalTargetConnection> 
   <Path>/njsTarget/api/v1/solve</Path> 
</LocalTargetConnection>

This works for a GET call.

But, I need to pass on the response of the service callout (getDataSCO) as a request body in a POST method to my NodeJS target (njsTarget). How would I do that ? any suggestions please ?

Appreciate your help

Solved Solved
0 4 117
1 ACCEPTED SOLUTION

Not applicable

in your nodejs app

instead of

var express =require('express');
var app = express();
var fs =require("fs");

app.get('/Users',function(req, res){

do

app.post('/User',function(req, res){

In api call select POST in postman instead of GET

View solution in original post

4 REPLIES 4

Not applicable

in your nodejs app

instead of

var express =require('express');
var app = express();
var fs =require("fs");

app.get('/Users',function(req, res){

do

app.post('/User',function(req, res){

In api call select POST in postman instead of GET

Hi,

It is not about how to write a POST call in NodeJS. I have that part done already. That is not the issue. My question was,

How do you configure the Target to pass a response from a previous ServiceCallout and make a Post call to the NodeJS app.

Thanks

ok, I assumed wrong. In that case, you can extract the service callout response, frame that to request payload using assign message policy and in the same assign message policy set the Verb tag to POST.

this will send the request as POST to the local target.

Thank you.. that solved the issue.