Created 11-05-2015 03:49 PM
Just about any operation on https://nifi.apache.org/docs/nifi-docs/rest-api/index.html has a clientId parameter. What is its purpose and benefits? Is it more like maintaining a session? Is there physically a server-side session created for a REST client?
If I don't specify a clientId, do I just keep creating more sessions (as it's auto-generated if not provided)?
Created 11-05-2015 05:54 PM
Requests to NiFi's REST API to change the data flow (mutable requests) require a revision to be included. Since multiple users may be working with the same NiFi instance at the same time, this is used as a simple check to verify the user who submitted the request acknowledges they have the most current version of the data flow before applying their change.
The revision is comprised of two pieces. The first is the version. The version is a one-up number that is updated by NiFi during a mutable request and is included in the response. The next mutable request should include that updated version. This works well until a user wants to submit multiple requests concurrently. To support this case the revision also includes a clientId. If the clientId in the revision of the current request matches the clientId of the last successful mutable request, the version does not need to match.
It is up to the client to manage the revision version and check with
http://{host}:{port}/nifi-api/controller/revision
in order to see if another client has updated the flow.
The clientId can be any string. It's accepted in most endpoints so it could be added to requests in $.ajaxSetup for instance. If the clientId is not specified one will be generated. There is no session, it's simply generates a UUID. You could use any string you may want to represent your client. In the NiFi UI, we GET the flow
http://{host}:{port}/nifi-api/controller/process-groups/root?verbose=true
and use the clientId that it generates for all subsequent requests.
Created 11-05-2015 05:54 PM
Requests to NiFi's REST API to change the data flow (mutable requests) require a revision to be included. Since multiple users may be working with the same NiFi instance at the same time, this is used as a simple check to verify the user who submitted the request acknowledges they have the most current version of the data flow before applying their change.
The revision is comprised of two pieces. The first is the version. The version is a one-up number that is updated by NiFi during a mutable request and is included in the response. The next mutable request should include that updated version. This works well until a user wants to submit multiple requests concurrently. To support this case the revision also includes a clientId. If the clientId in the revision of the current request matches the clientId of the last successful mutable request, the version does not need to match.
It is up to the client to manage the revision version and check with
http://{host}:{port}/nifi-api/controller/revision
in order to see if another client has updated the flow.
The clientId can be any string. It's accepted in most endpoints so it could be added to requests in $.ajaxSetup for instance. If the clientId is not specified one will be generated. There is no session, it's simply generates a UUID. You could use any string you may want to represent your client. In the NiFi UI, we GET the flow
http://{host}:{port}/nifi-api/controller/process-groups/root?verbose=true
and use the clientId that it generates for all subsequent requests.
Created 08-03-2016 04:53 PM
Thanks @mgilman for the information. Can you also provide more info on how can we set the ClientID for user group and list the processors for that user group ? ex: hanu is the user group.. i want to set the clientID and list all the processors and the process groups along with the parentIDs. How can we achieve this?
Thanks in advance 🙂
Created 02-25-2020 03:35 AM
@mgilman @andrewg @2hanu_valluri
Created 02-25-2020 10:43 AM
The clientId can be any string that is unique to your client. You can generate one. If one is not specified the endpoints will generate one and return it for you. Please open your web browsers developer tools and watch some of the requests in action.
Created 03-30-2023 12:37 AM
Where can i get the client id?