NiFi Rest API Start

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

NiFi Rest API Start

dale.chang13
Looking through the NiFi API, I am not finding a way to start a Processor, Process Group, or an instance of NiFi. Is there a Rest API command I can invoke to start one of these? The API says there is a way to start and stop processors
Reply | Threaded
Open this post in threaded view
|

Re: NiFi Rest API Start

Matt Burgess
It's part of the "Update Processor" API, check out this thread from
the NiFi dev list archive:

http://apache-nifi-developer-list.39713.n7.nabble.com/Reg-starting-and-Stopping-processor-tp7930p7949.html

Regards,
Matt

On Mon, Apr 25, 2016 at 12:17 PM, dale.chang13 <[hidden email]> wrote:

> Looking through the NiFi API, I am not finding a way to start a Processor,
> Process Group, or an instance of NiFi. Is there a Rest API command I can
> invoke to start one of these? The API says there is a way to start and stop
> processors
>
>
>
> --
> View this message in context: http://apache-nifi-developer-list.39713.n7.nabble.com/NiFi-Rest-API-Start-tp9598.html
> Sent from the Apache NiFi Developer List mailing list archive at Nabble.com.
Reply | Threaded
Open this post in threaded view
|

Re: NiFi Rest API Start

dale.chang13
Matt Burgess wrote
It's part of the "Update Processor" API, check out this thread from
the NiFi dev list archive:

http://apache-nifi-developer-list.39713.n7.nabble.com/Reg-starting-and-Stopping-processor-tp7930p7949.html

Regards,
Matt
Nice, so I was able to change the status and the properties of a processor, thanks to your help. I have a follow up question:
Would you be able to start a whole process group through a rest api?

I have tried using the "Update Process Group" API with partial success. I can't seem to provide the correct JSON attribute when it asks for the parent group:

HTTP Request/Response wrote
curl -i -X PUT -H 'Content-Type:application/json' -d '
{"revision":
  {"clientId":"test-api-1",
   "version":37},
 "processGroup": {
   "id":"[PROCESS_GROUP_ID]",
   "running":"true",
   "parentGroupId":"[PARENT_GROUP_ID]"
  }
}' http://localhost:8181/nifi-api/controller/process-groups/[PROCESS_GROUP_ID]
HTTP/1.1 400 Bad Request
Date: Mon, 25 Apr 2016 20:22:05 GMT
Server: Jetty(9.2.11.v20150529)
Date: Mon, 25 Apr 2016 20:22:05 GMT
Content-Type: text/plain
Content-Length: 86

Unable to create the specified process group since the parent group was not specified.
Reply | Threaded
Open this post in threaded view
|

Re: NiFi Rest API Start

Matt Gilman
It appears it's not able to find the Process Group ID that you've
specified. When this happens the REST API will attempt to create the
Process Group and it's failing to do that. I'm thinking that's it hasn't
successfully interpreted the request body as you appear to be setting the
ID. Here's an example of the message body that I'm running locally...

'{"processGroup":{"id":"403dc272-dd9c-4173-aeb1-09ecf4eee514","running":true},"revision":{"version":0,"clientId":"2eab0b62-c2fe-4ad7-8189-161dc44a0eba"}}'

Another thing you could try is to open up your browser's Developer Tools.
If you issue the requet using the UI, you should be able to see it in the
Developer Tools Network tab. From there some (Chrome) even offers a 'Copy a
cUrl' menu item.

Matt

On Mon, Apr 25, 2016 at 3:25 PM, dale.chang13 <[hidden email]>
wrote:

> Matt Burgess wrote
> > It's part of the "Update Processor" API, check out this thread from
> > the NiFi dev list archive:
> >
> >
> http://apache-nifi-developer-list.39713.n7.nabble.com/Reg-starting-and-Stopping-processor-tp7930p7949.html
> >
> > Regards,
> > Matt
>
> Nice, so I was able to change the status and the properties of a processor,
> thanks to your help. I have a follow up question:
> /Would you be able to start a whole process group through a rest api?/
>
> I have tried using the "Update Process Group" API with partial success. I
> can't seem to provide the correct JSON attribute when it asks for the
> parent
> group:
>
>
> HTTP Request/Response wrote
> > curl -i -X PUT -H 'Content-Type:application/json' -d '
> > {"revision":
> >   {"clientId":"test-api-1",
> >    "version":37},
> >  "processGroup": {
> >    "id":"[PROCESS_GROUP_ID]",
> >    "running":"true",
> >    "parentGroupId":"[PARENT_GROUP_ID]"
> >   }
> > }'
> >
> http://localhost:8181/nifi-api/controller/process-groups/[PROCESS_GROUP_ID]
> > HTTP/1.1 400 Bad Request
> > Date: Mon, 25 Apr 2016 20:22:05 GMT
> > Server: Jetty(9.2.11.v20150529)
> > Date: Mon, 25 Apr 2016 20:22:05 GMT
> > Content-Type: text/plain
> > Content-Length: 86
> >
> > Unable to create the specified process group since the parent group was
> > not specified.
>
>
>
>
>
> --
> View this message in context:
> http://apache-nifi-developer-list.39713.n7.nabble.com/NiFi-Rest-API-Start-tp9598p9601.html
> Sent from the Apache NiFi Developer List mailing list archive at
> Nabble.com.
>