Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

NiFi InvokeHTTP POST JSON

avatar
Explorer

I'm totally new to NiFi and learning as I go, but am against a hard deadline and need urgent assistance. I was tasked to create a data interface between two learning systems to send course completion data.

I'm creating a flow to send course completion data from one system to another and have a JSON formatted file (to send as HTTP body to send as a CURL post?)

This is the sample JSON data that I've created so far:
{"user_id":10042,"username":"de","course_id":"C00230","completed_on":"12-02-2020","SCORE":100}

The suggested HTTPS Curl request format is provided below.
curl -v -X POST -d "j_username=admin&j_password=admin&userID=MORRW001&crsID=C00565&dateCompleted=2020-11-16&testScore=100&courseType=a" https://lms.dev.test.net/jw/web/json/data/

How do I configure the InvokeHTTP processor to send it correctly? Do I need to reformat the JSON data so it's in the correct format for the curl format shown above?

 

Remember I'm just a NiFi novice, so details, including screenshots would be appreciated.

Thanks in advance!

3 ACCEPTED SOLUTIONS

avatar
Master Collaborator
hide-solution

This problem has been solved!

Want to get a detailed solution you have to login/registered on the community

Register/Login

avatar
Explorer
hide-solution

This problem has been solved!

Want to get a detailed solution you have to login/registered on the community

Register/Login

avatar
Super Guru
hide-solution

This problem has been solved!

Want to get a detailed solution you have to login/registered on the community

Register/Login
7 REPLIES 7

avatar
Master Collaborator
hide-solution

This problem has been solved!

Want to get a detailed solution you have to login/registered on the community

Register/Login

avatar
Super Guru

@justenji   Great response!

 

@GMAN  I have some templates that may help you get a head start:

 

https://github.com/steven-matison/NiFi-Templates

 

There are 2 InvokeHttp Examples.

avatar
Explorer
hide-solution

This problem has been solved!

Want to get a detailed solution you have to login/registered on the community

Register/Login

avatar
Explorer

@stevenmatisonI used your template and tried to assign attributes using EvaluateJSONPath as show here: EvaluateJSONPath.JPG

This is the JSON data entering the EvaluateJSONPath processor.

{"user_id":"68","course_id":"HA044","completed_on":"12-15-2020","score":null}

 

 

However only the "crsID" and "dateCompleted" attributes are showing as attributes in the queue after this processor and I don't understand why.  

EvaluateJSONPathqueue.JPG

 

 

avatar
Super Guru

Thats weird.. did you scroll the attributes list down (just in case its that simple)?   i cant see the full modal so not sure.

 

The config of each attribute looks okay so does the json.

avatar
Explorer

@stevenmatisonYou were correct as the other attributes were listed at the bottom of the Attribute Values.   I didjn't notice the scroll bar and needed to scroll down.  

 

Thanks again.

avatar
Super Guru
hide-solution

This problem has been solved!

Want to get a detailed solution you have to login/registered on the community

Register/Login