Support Questions

Find answers, ask questions, and share your expertise
Announcements
Now Live: Explore expert insights and technical deep dives on the new Cloudera Community BlogsRead the Announcement

is there way to control the process group though using nifi 2 api

avatar
New Contributor

Hi all,

I tried to start the process group using the NiFi API, but it always returned a 403 Forbidden message.

I follow the steps below

{{baseUrl}}/nifi-api/access/token - get the bearer token successfully
{{baseUrl}}/nifi-api/process-groups/{{pgId}} passing the JSON value in the body {\"id\":\"${PG_ID}\",\"state\":\"RUNNING\"}", 
but I am getting 403- forbidden error message.

Please help me to resolve the issue.

 

 

3 REPLIES 3

avatar
Expert Contributor

Hi @MuruganFinastra , Are you sure you are attaching your token correctly to your requests? You should be using an Authorization header with a value of "Bearer <token>" for all requests once you fetch the token.

avatar
New Contributor

Thanks for your reply.

Yes, I am passing the Bearer token into the Authorisation header. Additionally, I can retrieve responses from the other APIs ({{baseUrl}}/nifi-api/flow/current-user and {{baseUrl}}/nifi-api/process-groups/{{pgId}}/status). 

avatar
Expert Contributor

So GET requests work fine for you but POSTs fail? Perhaps your user does not have write permissions?

I recommend opening devtools and looking at the Network tab to see what requests get sent when you do certain operations (starting/stopping a process group) in the UI. You should be able to replicate them with the REST API if you can do them manually in the UI.