Created 02-29-2024 02:11 PM
Hello,
I am getting the data from GetMongo Processor then i am evaluating the JSON Path using EvaluateJSONPath where i am getting series_id and then I am doing in InvokeHTTP. I am able to send as json but i am not able to send as form-data. Can you please suggest me what i am doing wrong here.
Before invokeHTTP the data flow is
Created 02-29-2024 07:02 PM
hi @piyush7829 ,
Can you provide more info on what the issue is? Are you getting error messages in the failure , retry relationships? Are you not getting any response at all? Are you sure that your api takes the data as request body and not as post form data key value as the processor description indicates :
Also I dont see that you are setting the Request Content-Type property to: multipart/form-data
Here are some posts that might help get it working:
https://palindromicity.blogspot.com/2020/04/sending-multipart-form-data-with.html
https://stackoverflow.com/questions/51929208/how-to-send-multipart-form-data-via-invokehttp-nifi
If you find this is helpful please accept solution.
Thanks
Created 02-29-2024 06:47 PM
@piyush7829 Welcome to the Cloudera Community!
To help you get the best possible solution, I have tagged our NiFi experts @MattWho @mburgess who may be able to assist you further.
Please keep us updated on your post, and we hope you find a satisfactory solution to your query.
Regards,
Diana Torres,Created 02-29-2024 07:02 PM
hi @piyush7829 ,
Can you provide more info on what the issue is? Are you getting error messages in the failure , retry relationships? Are you not getting any response at all? Are you sure that your api takes the data as request body and not as post form data key value as the processor description indicates :
Also I dont see that you are setting the Request Content-Type property to: multipart/form-data
Here are some posts that might help get it working:
https://palindromicity.blogspot.com/2020/04/sending-multipart-form-data-with.html
https://stackoverflow.com/questions/51929208/how-to-send-multipart-form-data-via-invokehttp-nifi
If you find this is helpful please accept solution.
Thanks
Created 03-01-2024 01:35 AM
Hello @SAMSAL ,
Thanks that do work. But I have one more question related to same .
I have added as you suggested post:form:series_id : 323
But I need to display value dynamically. as I have shown in the above screenshot I am getting {"series_id" : 323} above InvokeHTTP. I want to send that series_id which is coming in the data flow in the form. I am not able to achieve that.
Created 03-01-2024 05:35 AM
Hi @piyush7829 ,
Glad it worked and you were able to do the post. If I understood your question correctly then you need to pass the series_id to the post:form:series_id multipart form property dynamically, right? If that is the case then its easy since the InvokeHttp multipart dynamic properties allows for expression language you can reference the series_id attribute you have extracted using the EvaluateJsonPath and assign it as follows:
post:form:series_id: ${series_id}
Every time the invokeHttp is triggered it would evaluate the series_id expression from the incoming flowfile and assign its value before making the api invokation.
Hope that helps.