Created 12-06-2023 09:16 AM
hi everyone ! hoping everybody has an awsome day.
I am trying to create a process Group with a flow definition json i downloaded.
when i upload a file.json manually and checked the nifi-request.log and the only i see is this pettiotion " http://localhost:8081/process-groups/{id}/process-groups/upload"
but i don't see the body in sent request, i want to use the api rest to upload this file but documentation is not clear in this aspect
pettition #1:
curl --location "http://localhost:8082/nifi-api/process-groups/{id}/process-groups/upload" \
Response: Process Group name is required
pettition #2:
curl --location "http://localhost:8082/nifi-api/process-groups/{id}/process-groups/upload" \
Response: Process Group name is required
no matter how hard i tried i could not find a way to upload this file or even make the API accepts the name parameter.
If someone can help me i would thanks a lot
have a nice day.
Created on 12-06-2023 12:31 PM - edited 12-06-2023 12:32 PM
Hi @Colombia ,
First of all you are right , the documentation seems to be lacking around this call. When I check the Nifi Rest API documentation under (Nifi-Api ) here is what I find for the upload api :
For some reason the Name of all the parameters are not shown ! Not sure if they were missed by mistake or I'm missing something here @MattWho , @steven-matison might know.
After trial and error using Postman I was able to get it working and here is the curl command as provided by postman:
curl --location 'https://{url}:9443/nifi-api/process-groups/17baf155-018c-1000-7bde-586d185d1d0d/process-groups/upload' \
--header 'Content-Type: multipart/form-data' \
--header 'Authorization: Bearer ...' \
--form 'positionX="11.0"' \
--form 'clientId="4036074c-018c-1000-3e06-aaaaaaaaaaaa"' \
--form 'disconnectNode="true"' \
--form 'groupName="testapi"' \
--form 'positionY="557.0"' \
--form 'file=@"/C:/nifi-2.0.0-M1-bin/nifi-2.0.0-M1/test123.json"'
If that helps please accept solution.
Thanks
Created on 12-06-2023 12:31 PM - edited 12-06-2023 12:32 PM
Hi @Colombia ,
First of all you are right , the documentation seems to be lacking around this call. When I check the Nifi Rest API documentation under (Nifi-Api ) here is what I find for the upload api :
For some reason the Name of all the parameters are not shown ! Not sure if they were missed by mistake or I'm missing something here @MattWho , @steven-matison might know.
After trial and error using Postman I was able to get it working and here is the curl command as provided by postman:
curl --location 'https://{url}:9443/nifi-api/process-groups/17baf155-018c-1000-7bde-586d185d1d0d/process-groups/upload' \
--header 'Content-Type: multipart/form-data' \
--header 'Authorization: Bearer ...' \
--form 'positionX="11.0"' \
--form 'clientId="4036074c-018c-1000-3e06-aaaaaaaaaaaa"' \
--form 'disconnectNode="true"' \
--form 'groupName="testapi"' \
--form 'positionY="557.0"' \
--form 'file=@"/C:/nifi-2.0.0-M1-bin/nifi-2.0.0-M1/test123.json"'
If that helps please accept solution.
Thanks
Created on 12-07-2023 05:32 AM - edited 12-07-2023 05:34 AM
Hi @SAMSAL
my friend, I just wanted to give you a huge thank you for your superhero-like assistance with the NiFi API on the community platform! Your solution was nothing short of amazing and saved the day in a way only a true superhero could.
Your expertise made a world of difference, and I'm incredibly grateful for your support.
Thanks a ton!
Best regards,
have a awesome day
Created on 12-11-2023 07:52 AM - edited 12-11-2023 08:02 AM
@SAMSAL Thank you.
For future reference. If you ever need to figure out what the request is, simply use NIFI UI to do the action you want while monitoring your Developer Tools. This will expose the full request/response on any given UI action.
I have filed a JIRA for this.