You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@nifi.apache.org by ruaraidh jay-chalmer <ru...@holimetrix.com> on 2016/10/18 10:02:47 UTC

API 1.0 questions

Hi,
I have been working on a few python tools that use the NiFi Rest API to do
a few checks and commands here and there. Since the goal is mainly
monitoring, stopping a processor is a very useful tool. In the previous
version of the API (~0.7) I managed this by creating a dictionary with
purely the processor ID, and the new state (or other parameter I wished to
update), and then I encoded it and made my put request to the right link.

This approach seems to no longer function in v1.0. I have tried create a
small python dictionary to PUT to the server, but I keep on getting more
and more errors, culminating in:

<Response [400]>
The processor id (null) in the request body does not equal the processor id
of the requested resource (d70f5d7d-0157-1000-ffff-ffff80a4d2d7).

Here is what is contained in my request:

update = \
    {
        "revision": {
            "version": processor["revision"]["version"] + 1
        },
        "id": processor["id"],
        "status": {
            "aggregateSnapshot": {
                "runStatus": "Stopped",
                "id": processor["id"]
            }
        },
        "component": {
            "state": "STOPPED"
        }
    }

I am pretty sure my PUT request is correct, and that the problem is
coming from lack or excess of data in my request.

If anyone has managed to achieve starting/stopping processors with the
new API, I would be grateful for the help!

Thanks a lot

Re: API 1.0 questions

Posted by ruaraidh jay-chalmer <ru...@holimetrix.com>.
Thanks a lot for your help! I was missing the Id in components (and like
you said, no need to increment version). You've saved me a lot of time,
thanks again :)

Wishing you a pleasant day!

2016-10-18 12:36 GMT+02:00 Koji Kawamura <ij...@gmail.com>:

> Hello,
>
> I was able to start/stop processors using 1.0 API. I am not sure if the
> API has changed from 0.x but, it seems you don't have to increment the
> revision. I used the same revision that is returned by NiFi.
>
> Here is an example (it's Javascript):
> https://github.com/ijokarumawak/nifi-deploy-process-group/blob/master/
> deploy.js#L131
>
> Hope this helps,
> Koji
>
> On Oct 18, 2016 7:03 PM, "ruaraidh jay-chalmer" <
> ruaraidh.jay@holimetrix.com> wrote:
>
> Hi,
> I have been working on a few python tools that use the NiFi Rest API to do
> a few checks and commands here and there. Since the goal is mainly
> monitoring, stopping a processor is a very useful tool. In the previous
> version of the API (~0.7) I managed this by creating a dictionary with
> purely the processor ID, and the new state (or other parameter I wished to
> update), and then I encoded it and made my put request to the right link.
>
> This approach seems to no longer function in v1.0. I have tried create a
> small python dictionary to PUT to the server, but I keep on getting more
> and more errors, culminating in:
>
> <Response [400]>
> The processor id (null) in the request body does not equal the processor
> id of the requested resource (d70f5d7d-0157-1000-ffff-ffff80a4d2d7).
>
> Here is what is contained in my request:
>
> update = \
>     {
>         "revision": {
>             "version": processor["revision"]["version"] + 1
>         },
>         "id": processor["id"],
>         "status": {
>             "aggregateSnapshot": {
>                 "runStatus": "Stopped",
>                 "id": processor["id"]
>             }
>         },
>         "component": {
>             "state": "STOPPED"
>         }
>     }
>
> I am pretty sure my PUT request is correct, and that the problem is coming from lack or excess of data in my request.
>
> If anyone has managed to achieve starting/stopping processors with the new API, I would be grateful for the help!
>
> Thanks a lot
>
>
>
>

Re: API 1.0 questions

Posted by Koji Kawamura <ij...@gmail.com>.
Hello,

I was able to start/stop processors using 1.0 API. I am not sure if the API
has changed from 0.x but, it seems you don't have to increment the
revision. I used the same revision that is returned by NiFi.

Here is an example (it's Javascript):
https://github.com/ijokarumawak/nifi-deploy-process-group/blob/master/deploy.js#L131

Hope this helps,
Koji

On Oct 18, 2016 7:03 PM, "ruaraidh jay-chalmer" <ru...@holimetrix.com>
wrote:

Hi,
I have been working on a few python tools that use the NiFi Rest API to do
a few checks and commands here and there. Since the goal is mainly
monitoring, stopping a processor is a very useful tool. In the previous
version of the API (~0.7) I managed this by creating a dictionary with
purely the processor ID, and the new state (or other parameter I wished to
update), and then I encoded it and made my put request to the right link.

This approach seems to no longer function in v1.0. I have tried create a
small python dictionary to PUT to the server, but I keep on getting more
and more errors, culminating in:

<Response [400]>
The processor id (null) in the request body does not equal the processor id
of the requested resource (d70f5d7d-0157-1000-ffff-ffff80a4d2d7).

Here is what is contained in my request:

update = \
    {
        "revision": {
            "version": processor["revision"]["version"] + 1
        },
        "id": processor["id"],
        "status": {
            "aggregateSnapshot": {
                "runStatus": "Stopped",
                "id": processor["id"]
            }
        },
        "component": {
            "state": "STOPPED"
        }
    }

I am pretty sure my PUT request is correct, and that the problem is
coming from lack or excess of data in my request.

If anyone has managed to achieve starting/stopping processors with the
new API, I would be grateful for the help!

Thanks a lot