- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
How to add request headers and request body to the invokehttp post request
- Labels:
-
Apache NiFi
Created ‎09-01-2016 01:53 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, I'm trying to invoke a http post using invokehttp processor, the post request needs 2 things as part of headers, one is mime type and another one auth key, how can i set these parameters part of headers and also i have json to be send a request body, how can i do that.
Created ‎10-10-2016 05:02 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Where are you getting your JSON from? If it is a static value, you could use GenerateFlowFile -> ReplaceText to set the value for the body, if it comes from a file you can use GetFile or ListFile -> FetchFile. If the mime.type attribute is not already set for the flow file (containing the JSON response), you can use UpdateAttribute to set mime.type to "application/json", and your auth key (called maybe "auth.key") to your key. Then in InvokeHttp you can list mime.type,auth.key in the "Attributes to send" property, and make sure "Send Message Body" is true. These steps will ensure that the headers are sent and the JSON content from the flow file is sent as the body.
Created on ‎10-14-2016 03:42 PM - edited ‎08-19-2019 02:23 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am trying to follow the same steps to a get a Auth key from an 3rd party API and then subsequently use it in other calls.but still not able to connect to the rest api thri NiFi.
I could able to test it successfully thru their test site..here is how it looks..
and i am trying to do the same from NiFi .doing below..
ReplaceText processor
UpdateAttribute processor
InvokeHTTP
other properties of invokeHTTP
Content-Type ${mime.type}
Send Message Body true
is this the correct approach , if yes what am i doing wrong.??
Regards,Sai
Created ‎10-19-2016 03:19 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
