hi, is it possible to retrieve credentialusername and credential password using /odata/assets({key}) authenticated rest api?
hi @Chau_JunYue,
Hope this helps Retrieving asset credential from Orchestrator via REST API
Kind regards,
Kenneth
Hi @Chau_JunYue
Try this code
// The URL of the Orchestrator instance
const string orchestratorUrl = “https://yourinstance.orchestrator.com”;
// The API key or access token for authenticating to the Orchestrator API
const string apiKey = “your-api-key-or-access-token”;
// The ID of the asset credential you want to retrieve
const string assetCredentialId = “your-asset-credential-id”;
// Create an HTTP client for calling the Orchestrator API
var client = new HttpClient();
// Set the base URL for the client
client.BaseAddress = new Uri(orchestratorUrl);
// Set the API key or access token as the Authorization header for the client
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(“Bearer”, apiKey);
// Call the Assets API endpoint to retrieve the asset credential
var response = await client.GetAsync($“/odata/Assets({assetCredentialId})”);
// Handle the API response
if (response.IsSuccessStatusCode)
{
// The asset credential was retrieved successfully
var assetCredential = JObject.Parse(response.Content.ReadAsStringAsync().Result);
}
else
{
// There was an error retrieving the asset credential
}
hi, juz try your method, using /odata/assets endpoint and assetcredentialid
{
“message”: “AssetDto does not exist.”,
“errorCode”: 1002,
…
}
seems like it is not possible to retrieve the assetcredential / credential password of an asset using api.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.