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 [email protected] <
[email protected]> 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
>
>
>
>
>
>
>

Reply via email to