nifi-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hollis <huip...@163.com>
Subject Re: Re: Does Nifi Rest Api Supported Trigger Operation
Date Wed, 19 Jul 2017 02:04:29 GMT
Hi Ben and Pierre,
             Thank you very much . It really works. I got a lot of help and I can finish my
purpose.



Thanks,
Hollis
 
From: 尹文才
Date: 2017-07-18 20:54
To: users
Subject: Re: Re: Does Nifi Rest Api Supported Trigger Operation
Hi Hollis, I was at first using Chrome's app postman to play around with the NIFI rest api,
My command to request the processor to be running like this:

PUT http://localhost:8082/nifi-api/processors/015d1006-1e68-1611-fb97-8e5397d0bc1f

The Content-Type header is "application/json" and the request body is as below: 

{ "revision": { "version": 0 }, "component": { "id": "015d1006-1e68-1611-fb97-8e5397d0bc1f",
"state": "RUNNING" } }

you need to have the revision and component part(at least id and state according to my test)
in the request to set the processor to specific state.
I hope this helps.

Regards,
Ben

2017-07-18 18:08 GMT+08:00 Pierre Villard <pierre.villard.fr@gmail.com>:
Hi Hollis, I'd suggest you to open the developer tools of your browser, perform the action
using the UI and look at what is actually sent to understand how the REST API is working (the
UI is using the API in the background).

That would give you something like that (to start a processor):

curl 'http://localhost:8080/nifi-api/processors/cac3a577-015b-1000-b9c3-843741836f15' -X PUT
-H 'Content-Type: application/json' --data '{"revision":{"clientId":"3bdd5735-015d-1000-e275-34d1e8e64dc8","version":0},"component":{"id":"cac3a577-015b-1000-b9c3-843741836f15","state":"RUNNING"}}'

I am not sure that the "revision" part is required, so it could be:

curl 'http://localhost:8080/nifi-api/processors/cac3a577-015b-1000-b9c3-843741836f15' -X PUT
-H 'Content-Type: application/json' --data '{"component":{"id":"cac3a577-015b-1000-b9c3-843741836f15","state":"RUNNING"}}'

Thanks!
Pierre


2017-07-18 12:01 GMT+02:00 Hollis <huipanc@163.com>:
Hi Ben,
      Moreover, I have try using this command:
         curl -i -X PUT -H 'Content-Type:application/json' -d '
         {"revision":{"clientId":"015d1019-dafc-19e0-949d-80be03d7675f","version":19}}
        ' http://192.168.1.209:8070/nifi-api/processors/39e0dafc-015d-1000-918d-bee89ae2226e
       but unfortunally,I got this reponse shown picture below,

     I can't understand what does "Processor details must be specified."  mean.

   


Thanks,
Hollis
 
From: Hollis
Date: 2017-07-18 15:27
To: users
Subject: Re: Re: Does Nifi Rest Api Supported Trigger Operation
Hi Ben,
            Thank you for your reply and I have try your step.When I come to step 3  ". use
PUT /processors/{id} to update the processor's state to STOPPED."  I meet some problem.
            My command is  http://192.168.1.209:8070/nifi-api/processors/015d1004-dafc-19e0-5395-cc6672492e00,
but I got a 400 Bad Request. I search the nifi Rest Api and locate the Rest API. I don't know
what does body mean and what cause this 400 error.




Thanks,
 Hollis
 
From: Joe Witt
Date: 2017-07-18 09:52
To: users
Subject: Re: Does Nifi Rest Api Supported Trigger Operation
Hello

We dont support the notion of a 'run once' operation today.  Is that something you're looking
for?

Thanks

On Mon, Jul 17, 2017 at 9:48 PM, 尹文才 <batman713@gmail.com> wrote:
Hi, I had asked a similar question a few days ago, the steps I used to restart a processor
with a specific name is as below:
1. use GET /flow/search-results with parameter q equals to the processor name to find the
basic information of the processor.
2. use GET /processors/{id} to get the detailed information of the processor, the id is retrieved
from the basic information in step 1.
3. use PUT /processors/{id} to update the processor's state to STOPPED.
4. use PUT /processors/{id} to update the processor's state to RUNNING.

I was using the Java api to restart the processor, the Java nifi api client I used is written
by someone who wrote for NIFI 1.0.0 and stopped maintaining since 9 months ago, you may take
a look if you're intertested: 
https://github.com/simplesteph/nifi-api-client-java

Regards,
Ben

2017-07-17 22:32 GMT+08:00 Matt Gilman <matt.c.gilman@gmail.com>:
Hollis,

The NiFi UI uses the REST API exclusively to perform all of its actions. You can see all of
these requests in action by opening the Developer Tools in your web browser. Here is the link
to the REST API Docs [1].

Matt

[1] https://nifi.apache.org/docs/nifi-docs/rest-api/index.html

On Mon, Jul 17, 2017 at 2:10 AM, huipanc@163.com <huipanc@163.com> wrote:
Hi All,
           I want to find nifi rest api (http://nifi.apache.org/docs.html)  to operation
processor in nifi UI. But I can not find any  trigger operation like start and stop process
shown below. Does nifi support this operation. 



Thanks,
Hollis





Mime
View raw message