Search code examples
hadoopambarihdp

ambari REST API + how to get all versions from ambari


from ambari we can capture all version , by click on Admin button and the click on stack and version

finally click on Versions , then we get the following details

enter image description here

we want to know how to capture all these version by using ambari rest api?

we try

 curl -u admin:admin -H 'X-Requested-By:admin' 'http://localhost:8080/api/v1/clusters/HDP/configuratons/service_config_versions'

but its not return any info


Solution

  • This format should work:

    http://{HOSTNAME}:{PORT}/api/v1/stacks/HDP/versions/{STACKVERSION}/services?fields=StackServices/service_version
    

    So for your example:

    curl -k -u admin:admin -H 'X-Requested-By:admin' -X GET 'http://localhost:8080/api/v1/stacks/HDP/versions/2.6/services?fields=StackServices/service_version'