Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
sushantV
Creator
Creator

Making Django REST API POST/PUSH call - How to automatically create JASON object?

 

I had few complex ETL jobs which are working fine. However, instead of directly hitting the DB, I wish to utilize REST APIs to do that. I figured that I need to deploy the tWriteJASONField node somewhere but I am not being able to figure out how.

 

I envision something like:

Existing -> Job --- tMAP --- DB write

being changed to :

New      -> Job --- tMAP --- tJASONWrite --- tRESTClient

Also the tJASONWrite component needs JASON tree structure to be specified. Do I have to create that manually, every time, for every job? I'm assuming there is a way to do that automatically, based on the input row schema.

 

So far, I've got the GET working fine and I could fetch the JASON object but I primarily need the PUSH and POST working.

 

Any thoughts on this would be appreciated.

Labels (3)
2 Replies
Jesperrekuh
Specialist
Specialist

You want some auto-conversion from row -> JSON structure?! 

 

However think on how your POST/PUSH works expect to receive:

{ "id" : 0 , "name" : "foo" , "age" : 24 }

Or

{ "target" : "person" , 
"update" : [
      { "id" : 0 , "name" : "foo" , "age" : 24 },
      { "id" : 35, "name" : "foometwice" , "age" : 65 }
    ]
}

Or ..... so many different ways 

 

"Auto conversion" is possible with tJSONWriteField ... you can do some automapping isnt there a checkbox ,  but you probably need to adjust this output to fit your push/post, but it ends up in an array like the first example. There;s no magic component to do it for you beside writing some Java code and tJavaRow / tJavaFlex ... 

However to read/write dynamic schema in Open Studio... take a closer look on this thread : https://community.talend.com/t5/Design-and-Development/Dynamic-schema-alternative-in-Open-Studio/m-p...

 

Keep it clean, sometimes it helps being clear on what you're trying to do!

sushantV
Creator
Creator
Author

I got derailed due to some other priorities and couldn't focus on this effort. Going to focus on this now.