- 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 send dictionary in invoke http processor
- Labels:
-
Apache NiFi
Created ‎06-04-2020 04:19 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hi everyone ,
We want to put data in web app using API endpoint
https://localhost:8000/api/event/${id}/attributes this is the API endpoint that i have used in invoke HTTP processor in Remote URL field with PUT method.
we want to create new attribute with value and this attribute is a dictionary type so we have to pass the data in the dictionary format for this we have used updateattribute processor and attributetojson processor.
updateAttribute processor snap
Attributetojson processor snap
and the below is out of attributetoJson processor (flowfile)
{"note":"note from nifi","attributes":"{\n \"workflow\":\"process\"\n }","id":"1ecfbcbb-38bf-49e9-a77e-a88w"}
the error msg in invoke http processor
property_name | property_value |
attributes | {"workflow": "process"} |
'attributes' | ${attributes:unescapeJson()} |
Created ‎06-04-2020 05:29 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@renuu You have to build the final values you want as separate key value pairs like this:
UpdateAttribute
Next you will use these attributes to create a json object attribute using AttributesToJson:
AttributesToJson flowfile-attribute
After that, if you inspect the flowfile you will see the json object as JSONAttributes:
FlowFile Attribute JSONAttributes
From here you can use it as ${JSONAttributes} or if you need it to be called ${attributes} you just use another UpdateAttribute:
Created ‎06-04-2020 05:29 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@renuu You have to build the final values you want as separate key value pairs like this:
UpdateAttribute
Next you will use these attributes to create a json object attribute using AttributesToJson:
AttributesToJson flowfile-attribute
After that, if you inspect the flowfile you will see the json object as JSONAttributes:
FlowFile Attribute JSONAttributes
From here you can use it as ${JSONAttributes} or if you need it to be called ${attributes} you just use another UpdateAttribute:
