You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@nifi.apache.org by "harshit.varshney@iktara.ai" <Ha...@iktara.ai> on 2022/10/11 05:11:04 UTC
Issue Regarding Uploading a Template using Rest-Api in Nifi-version(1.15.3)
Dear Team,
I am facing a issue regarding Uploading a template in nifi using Rest-Api
commands in python .
This is my sample code :
new_process_group_id='c0c352f4-0183-1000-bc0c-7b0156ac0f6e'
headers = {"Content-Type": "multipart/form-data",
"x-api-key": "xxxxxx-xxxxx-xxxx-xxxx-xxxxxxxx"}
file = {"template": open("kafka.xml", "rb")}
res = requests.post(
'http://192.168.1.103:7777/nifi-api/process-groups/'+new_process_group_id+'/
templates/upload/',data={},
files=file ,headers=headers)
print('status',res)
print(res.text)
I am getting output:
$status <Response [400]>
$HTTP 400 Bad Request
Can anyone help me in this issue.
Thanks & Regards
Harshit Varshney
Re: Issue Regarding Uploading a Template using Rest-Api in Nifi-version(1.15.3)
Posted by Daniel Chaffelson <ch...@gmail.com>.
Hi Harshit,
There is a python client for NiFi, with specific support for handling
templates.
https://nipyapi.readthedocs.io/en/latest/nipyapi-docs/nipyapi.html#nipyapi.templates.upload_template
On Tue, Oct 11, 2022, 6:11 AM harshit.varshney@iktara.ai <
Harshit.Varshney@iktara.ai> wrote:
> Dear Team,
>
> I am facing a issue regarding Uploading a template in nifi using Rest-Api
> commands in python .
>
> This is my sample code :
>
>
>
> new_process_group_id='c0c352f4-0183-1000-bc0c-7b0156ac0f6e'
> headers = {"Content-Type": "multipart/form-data",
> "x-api-key": "xxxxxx-xxxxx-xxxx-xxxx-xxxxxxxx"}
> file = {"template": open("kafka.xml", "rb")}
> res = requests.post( '
> http://192.168.1.103:7777/nifi-api/process-groups/'+new_process_group_id+'/templates/upload/
> ',data={},
> files=file ,headers=headers)
> print('status',res)
> print(res.text)
>
>
>
>
>
>
>
> I am getting output:
>
> $status <Response [400]>
>
> $HTTP 400 Bad Request
>
>
>
>
>
> Can anyone help me in this issue.
>
> Thanks & Regards
>
> Harshit Varshney
>
>
>
>
>
>
>