Reading JSON to HTTP client processor

asked 2018-02-09 15:33:56 -0500

SD gravatar image

I am reading JSON messages from a file (Directory Origin) and using Http client Processor to post JSON messages to a REST API. How can I provide request messages from the directory origin to Request data in the HTTP client? I am looking to send dynamic requests using the Http Client Processor.

edit retag flag offensive close merge delete

Comments

What kind of dynamic requests in Http Client processor do you have in mind? Example: if you want to set Resource URL in Http Client process based on some value from origin JSON message, you can use expression language such as `http://localhost:3000/users/${record:value("/result/userId")}`

todd gravatar imagetodd ( 2018-02-14 07:36:14 -0500 )edit

Hi, how can I pass the whole record as json request body ? I am getting 400 error when I do ${record:value('/')}. I can read each field separate and build a new json there , but I want to pass the coming json object as is Thanks, Shafeek

shafeek gravatar imageshafeek ( 2019-02-07 09:58:30 -0500 )edit

Hi @shafeek - please post this as a new question. Hardly anyone will see it here.

metadaddy gravatar imagemetadaddy ( 2019-02-07 10:32:56 -0500 )edit

Thanks @metadaddy , bw I found the solution going through different threads. Basically used JSON Generator in between which resolved my issue. Thanks

shafeek gravatar imageshafeek ( 2019-02-07 10:42:39 -0500 )edit