Created 02-24-2017 10:35 AM
Hi,
Do you know create and backup the templates. I've checked NIFI-API but it is not clear for me?
It seems to need post an URI snippsets before create an template.
thanks
Created 02-25-2017 03:22 AM
Create a snippet via http post
uri example
https://mynifiinstance.com:9091/nifi-api/snippets
Body which includes my parent process group id and and my process group id
{
"snippet": {
"parentGroupId": "69ea5920-0157-1000-0000-0000028e1b90",
"processors": {},
"funnels": {},
"inputPorts": {},
"outputPorts": {},
"remoteProcessGroups": {},
"processGroups": {
"7ce7597d-0157-1000-ffff-ffffc161e771": {
"clientId": "50b3ec1a-c123-1e4f-718c-b0323fb1e175",
"version": 0
}
},
"connections": {},
"labels": {}
}
}
This will return a snippet json object
{
"snippet": {
"id": "50b3ec79-c123-1e4f-0000-000009e32e47",
"uri": "https://hdf20-0.field.hortonworks.com:9091/nifi-api/process-groups/69ea5920-0157-1000-0000-0000028e1b90/snippets/50b3ec79-c123-1e4f-0000-000009e32e47",
"parentGroupId": "69ea5920-0157-1000-0000-0000028e1b90",
"processGroups": {
"7ce7597d-0157-1000-ffff-ffffc161e771": {
"clientId": "50b3ec1a-c123-1e4f-718c-b0323fb1e175",
"version": 0
}
},
"remoteProcessGroups": {},
"processors": {},
"inputPorts": {},
"outputPorts": {},
"connections": {},
"labels": {},
"funnels": {}
}
}
Here you grab the snippet Id and do a HTTP post
uri
https://mynifiinstance.com:9091/nifi-api/process-groups/69ea5920-0157-1000-0000-0000028e1b90/templat...
body
{
"name": "dummy5",
"description": "",
"snippetId": "50b3ec79-c123-1e4f-0000-000009e32e47"
}
Now you have a template created with name "dummy5"
The response from this post is the template ID which you can then use nifi rest get api /templates/{id}/download
Here is response with template id
{
"template":{
"uri":"https://mynifiinstance.com:9091/nifi-api/templates/522819e6-e721-3c6b-95a4-81a0591fc9a3",
"id":"522819e6-e721-3c6b-95a4-81a0591fc9a3",
"groupId":"69ea5920-0157-1000-0000-0000028e1b90",
"name":"dummy5",
"description":"",
"timestamp":"02/25/2017 03:36:17 UTC",
"encoding-version":"1.0"
}
}
Created 02-25-2017 03:22 AM
Create a snippet via http post
uri example
https://mynifiinstance.com:9091/nifi-api/snippets
Body which includes my parent process group id and and my process group id
{
"snippet": {
"parentGroupId": "69ea5920-0157-1000-0000-0000028e1b90",
"processors": {},
"funnels": {},
"inputPorts": {},
"outputPorts": {},
"remoteProcessGroups": {},
"processGroups": {
"7ce7597d-0157-1000-ffff-ffffc161e771": {
"clientId": "50b3ec1a-c123-1e4f-718c-b0323fb1e175",
"version": 0
}
},
"connections": {},
"labels": {}
}
}
This will return a snippet json object
{
"snippet": {
"id": "50b3ec79-c123-1e4f-0000-000009e32e47",
"uri": "https://hdf20-0.field.hortonworks.com:9091/nifi-api/process-groups/69ea5920-0157-1000-0000-0000028e1b90/snippets/50b3ec79-c123-1e4f-0000-000009e32e47",
"parentGroupId": "69ea5920-0157-1000-0000-0000028e1b90",
"processGroups": {
"7ce7597d-0157-1000-ffff-ffffc161e771": {
"clientId": "50b3ec1a-c123-1e4f-718c-b0323fb1e175",
"version": 0
}
},
"remoteProcessGroups": {},
"processors": {},
"inputPorts": {},
"outputPorts": {},
"connections": {},
"labels": {},
"funnels": {}
}
}
Here you grab the snippet Id and do a HTTP post
uri
https://mynifiinstance.com:9091/nifi-api/process-groups/69ea5920-0157-1000-0000-0000028e1b90/templat...
body
{
"name": "dummy5",
"description": "",
"snippetId": "50b3ec79-c123-1e4f-0000-000009e32e47"
}
Now you have a template created with name "dummy5"
The response from this post is the template ID which you can then use nifi rest get api /templates/{id}/download
Here is response with template id
{
"template":{
"uri":"https://mynifiinstance.com:9091/nifi-api/templates/522819e6-e721-3c6b-95a4-81a0591fc9a3",
"id":"522819e6-e721-3c6b-95a4-81a0591fc9a3",
"groupId":"69ea5920-0157-1000-0000-0000028e1b90",
"name":"dummy5",
"description":"",
"timestamp":"02/25/2017 03:36:17 UTC",
"encoding-version":"1.0"
}
}
Created 02-27-2017 09:34 AM
@Sunile Manjee : thanks !!
Created 03-02-2020 12:52 AM
Hey! Can you please explain more how to create an apache NIFI template?!
Actually I need to know is it possible to generate an Apache NiFi template using JAVA ??
Created on 02-28-2017 10:18 AM - edited 08-19-2019 03:14 AM
@Sunile Manjee : the documentation about REST-API NIFI it is not clear !!
Why all parameters are optional in the documentation and so if we post a curl with minimum parameters it will failed.
Created 03-14-2017 11:43 AM
@Sunile Manjee : Hi thanks,
I'm trying to make a java restAPI client.
If somebody has already trying create a class for snippet and template, it is wondering if he send to me the definition of these classes.
thanks.