You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@nifi.apache.org by "Adam J. Shook" <ad...@gmail.com> on 2017/05/28 19:20:36 UTC

Add relationship to RouteOnAttribute via REST API?

Hello,

I've started messing around with the REST API and I noticed that when I add
a property to the RouteOnAttribute processor with the routing strategy set
to "route to property name", the route isn't created as well.  I tried
adding the relationship directly in components -> relationships, but I see
that it is read-only.

Is there any means to programmatically add a new route via property to the
RouteOnAttribute processor?

Thank you,
--Adam

Re: Add relationship to RouteOnAttribute via REST API?

Posted by "Adam J. Shook" <ad...@gmail.com>.
That did the trick!  Thank you!

On Sun, May 28, 2017 at 9:29 PM, Koji Kawamura <ij...@gmail.com>
wrote:

> Hello Adam,
>
> I think you need to execute two requests, the 1st is to add a dynamic
> property to RouteOnAttribute, and the 2nd is to create a connection
> from RouteOnAttribute.
>
> Here is an example for the 1st request adding a dynamic property using
> cURL command:
>
> curl -i -H 'Content-Type: application/json' -XPUT -d
> '{"component":{"id":"51bf89dc-015c-1000-6493-68ecce3a36d9","
> name":"RouteOnAttribute","config":{"properties":{"
> filter":"${someAttribute:contains('someValue')}"}}},"
> revision":{"clientId":"51bf55c6-015c-1000-c259-
> 19995ecde81f","version":4}}'
> http://localhost:8080/nifi-api/processors/51bf89dc-015c-
> 1000-6493-68ecce3a36d9
>
> After that, I was able to add a connection by 2nd request as follows,
> the key would be specifying "selectedRelationshipls" array with the
> property name you added to RouteOnAttribute:
>
> curl -i -H 'Content-Type: application/json' -XPOST -d
> '{"revision":{"clientId":"51bf55c6-015c-1000-c259-
> 19995ecde81f","version":0},"component":{"name":"","source"
> :{"id":"51bf89dc-015c-1000-6493-68ecce3a36d9","groupId":"
> 51bf0c82-015c-1000-aac1-7b724a24b1c4","type":"PROCESSOR"},"destination":{"
> id":"51c05d2c-015c-1000-69f5-3d972a6959a4","groupId":"
> 51bf0c82-015c-1000-aac1-7b724a24b1c4","type":"PROCESSOR"},"
> selectedRelationships":["filter"],"flowFileExpiration":"0
> sec","backPressureDataSizeThreshold":"1
> GB","backPressureObjectThreshold":"10000","bends":[],"prioritizers":[]}}'
> http://localhost:8080/nifi-api/process-groups/51bf0c82-
> 015c-1000-aac1-7b724a24b1c4/connections
>
> Thanks,
> Koji
>
>
> On Mon, May 29, 2017 at 4:20 AM, Adam J. Shook <ad...@gmail.com>
> wrote:
> > Hello,
> >
> > I've started messing around with the REST API and I noticed that when I
> add
> > a property to the RouteOnAttribute processor with the routing strategy
> set
> > to "route to property name", the route isn't created as well.  I tried
> > adding the relationship directly in components -> relationships, but I
> see
> > that it is read-only.
> >
> > Is there any means to programmatically add a new route via property to
> the
> > RouteOnAttribute processor?
> >
> > Thank you,
> > --Adam
>

Re: Add relationship to RouteOnAttribute via REST API?

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

I think you need to execute two requests, the 1st is to add a dynamic
property to RouteOnAttribute, and the 2nd is to create a connection
from RouteOnAttribute.

Here is an example for the 1st request adding a dynamic property using
cURL command:

curl -i -H 'Content-Type: application/json' -XPUT -d
'{"component":{"id":"51bf89dc-015c-1000-6493-68ecce3a36d9","name":"RouteOnAttribute","config":{"properties":{"filter":"${someAttribute:contains('someValue')}"}}},"revision":{"clientId":"51bf55c6-015c-1000-c259-19995ecde81f","version":4}}'
http://localhost:8080/nifi-api/processors/51bf89dc-015c-1000-6493-68ecce3a36d9

After that, I was able to add a connection by 2nd request as follows,
the key would be specifying "selectedRelationshipls" array with the
property name you added to RouteOnAttribute:

curl -i -H 'Content-Type: application/json' -XPOST -d
'{"revision":{"clientId":"51bf55c6-015c-1000-c259-19995ecde81f","version":0},"component":{"name":"","source":{"id":"51bf89dc-015c-1000-6493-68ecce3a36d9","groupId":"51bf0c82-015c-1000-aac1-7b724a24b1c4","type":"PROCESSOR"},"destination":{"id":"51c05d2c-015c-1000-69f5-3d972a6959a4","groupId":"51bf0c82-015c-1000-aac1-7b724a24b1c4","type":"PROCESSOR"},"selectedRelationships":["filter"],"flowFileExpiration":"0
sec","backPressureDataSizeThreshold":"1
GB","backPressureObjectThreshold":"10000","bends":[],"prioritizers":[]}}'
http://localhost:8080/nifi-api/process-groups/51bf0c82-015c-1000-aac1-7b724a24b1c4/connections

Thanks,
Koji


On Mon, May 29, 2017 at 4:20 AM, Adam J. Shook <ad...@gmail.com> wrote:
> Hello,
>
> I've started messing around with the REST API and I noticed that when I add
> a property to the RouteOnAttribute processor with the routing strategy set
> to "route to property name", the route isn't created as well.  I tried
> adding the relationship directly in components -> relationships, but I see
> that it is read-only.
>
> Is there any means to programmatically add a new route via property to the
> RouteOnAttribute processor?
>
> Thank you,
> --Adam