@AnkushKoul
You may consider having two dataflows here because you would need to store this password somewhere that your putSFTP processor dataflow would need have access to.
One dataflow that acquires the password from the rest endpoint and another that is actually performs your putSFTP.
Flow to get password would consist of a GenerateFlowFile (configure to generate a FlowFIle on each NiFi node using a run schedule to control how often password will be refreshed)--> invoketHTTP --> putDistributedMapCache (Configured to use DistributedMapCacheClient that uses "localhost" as server hostname. Will need to also add a DistributedMapCacheServer Controller service that above client will talk to. This will make sure each node grabs password and stores it locally on that nodes's DMCServer)
Then in your flow using putSFTP, you would replace the invokeHTTP processor a fetchDistributedMapCache processor just before the putSftp processor (suggest looping failure relationship from putSFTP back to fetchDistributedMapCache processor just in case password changes or there was no password stored when fetch was attempted first time).
Keep in mind that flows like this are not idea. The retrieved password that you are placing in to a FlowFile attribute is stored in plaintext.
If you found this solution helpful, please take a moment to login and click accept on this solution.
Good luck,
Matt