Skip to main content
Solved

Credential vaultt API issue


Forum|alt.badge.img+3

The API is failing to add the specified attribute value to the credential's attribute during credential creation in the vault. Please help

API Post method- {{ControlRoomURL}}v2/credentialvault/credentials

Body= 


{
  "name": "SampleCredenti74",
  "description": "Test credential Created from API request",
  "attributes": [
    {
      "name": "Username",
      "description": "Username for a sample API Call",
      "userProvided": false,
      "masked": false,
      "value": "user@automationanywhere.com",
      "passwordFlag": false
    },
    {
      "name": "Password",
      "description": "Totally fake password for a sample API call",
      "userProvided": false,
      "masked": true,
      "value": "afdkjh#hdfn^*#@",
      "passwordFlag": true
    }
  ]
}

 

Best answer by Aaron.Gleason

@Rajesh 5224 You’re using the credential ID twice instead of the credential attribute ID. Yes, it’s confusing.

Your credential ID (used in the URL of the REST call) is 78 in your example above, but the body should contain the ID of the attribute (235 in your example above for the user name; probably 236 for the password).

When I did this, I was able to set the password attribute.

 

View original
Did this topic help answer your question?

6 replies

Aaron.Gleason
Automation Anywhere Team
Forum|alt.badge.img+10
  • Automation Anywhere Team
  • 539 replies
  • March 28, 2025

What is the return code the API is returning to you? Maybe that will give us a hint.


Forum|alt.badge.img+3
  • Author
  • Cadet | Tier 2
  • 7 replies
  • March 28, 2025

Hi ​@Aaron.Gleason , the API is retuning the 200 success code and the credential is also created but the attribute value which is passed in the JOSN body at the time of the request is not getting inserted to the correspondence attribute. Am is missing something? The usecase I am working on is I need to create credential with attributes using credential vault API

 


Aaron.Gleason
Automation Anywhere Team
Forum|alt.badge.img+10
  • Automation Anywhere Team
  • 539 replies
  • March 28, 2025

Perfect. Thanks for the additional details, though you got a 201, not a 200 (not a big deal). Let me give it a try and see if I can make it behave.

I see the same thing as you: The credential is created, but no values are set. Apparently this is a two-step process: 

Step 1 is to create the credential (as you did). The “value” tag you added to the JSON is ignored. When the credential is created, you are presented with an id. (78 in your example above)

Step 2: Use that ID to perform a second call, POST /v2/credentials/{id}/attributevalues. You can see this second API call in your /swagger/ page.

Hope that helps!


Forum|alt.badge.img+3
  • Author
  • Cadet | Tier 2
  • 7 replies
  • March 28, 2025

Hi ​@Aaron.Gleason , its not working. Document seems to be incorrect

 


Aaron.Gleason
Automation Anywhere Team
Forum|alt.badge.img+10
  • Automation Anywhere Team
  • 539 replies
  • Answer
  • March 28, 2025

@Rajesh 5224 You’re using the credential ID twice instead of the credential attribute ID. Yes, it’s confusing.

Your credential ID (used in the URL of the REST call) is 78 in your example above, but the body should contain the ID of the attribute (235 in your example above for the user name; probably 236 for the password).

When I did this, I was able to set the password attribute.

 


Forum|alt.badge.img+3
  • Author
  • Cadet | Tier 2
  • 7 replies
  • March 28, 2025

thank you ​@Aaron.Gleason . It will resolve my problem


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings