My NiFi API Client looks like this:
@RequestLin("POST /process-groups/{id}/templates/upload")
@Headers("Content-Type: multipart/form-data")
TemplateEntity uploadTemplate(@Param("id") String id, @Param("name") String name, @Param("file") File file)
I call it as such:
File fileTemplate = new File("template_file.xml")
TemaplateEntity templateEntity = client.uploadTemplate("processGroupID123", "template", fileTemplate)
I get an error response:
feign.FeignException$BadRequest: [400 Bad Request] during [POST] to [https://nifi.instance.com/nifi-api/process-groups/processGroupID123/templates/upload]
When I do it through the UI which works, the request URL looks the same and checking the Network activity the payload should look like this:
------WebKitFormBoundaryxHgNbfqkeTPLWqsc
Content-Disposition: form-data; name="template"; filename="template_file.xml"
Content-Type: text/xml
------WebKitFormBoundaryxHgNbfqkeTPLWqsc
Content-Disposition: form-data; name="disconnectedNodeAcknowledged"
false
------WebKitFormBoundaryxHgNbfqkeTPLWqsc