Reply To: How to update ignio’s credential vault dynamically in Cheetah – via API

bana.sunit
Participant
2 years, 1 month ago #3483
Up
1
Down
::

PFB a sample snippet that can be used to update the password of a credential entry under an identifier.

String query=”GraphQuery.node(‘credIdentifier:CredentialIdentifier’).out(‘r1:contains’,null).node(‘credEntry:IgnioUIDCredentialEntry’).properties(‘credIdentifier.identifier’,'<<Identifier of the Credential identifier>>’)”;
def credEntryList = node.executeQuery(query);
String nodeId = credEntryList.get(0).id ;
com.digitate.ignio.model.base.EntityInstance credentialEntryInstance= new com.digitate.ignio.model.base.EntityInstance();
credentialEntryInstance.setLabel(“IgnioUIDCredentialEntry”);
credentialEntryInstance.setId(nodeId);
credentialEntryInstance.setProperties(credEntryList.get(0).nodeProperties);
credentialEntryInstance.setProperty(“password”, “<<New password non encrypted”);
node.createOrUpdate (“IgnioUIDCredentialEntry”,credentialEntryInstance, ‘ignio’);

Please note this strategy will work if there is only one credential entry of type IgnioUIDCredentialEntry under a credentialIdentifier whose password needs an update.