Created on 04-19-2018 05:02 PM - edited 08-17-2019 06:47 PM
how to capture the local repo "Base URL" by API
we try the following , but this not include the URL PATH
# curl -H "X-Requested-By: ambari" -X GET -u admin:admin http://master02:8080/api/v1/stacks/HDP/versions/2.6/repository_versions { "href" : "http://master02:8080/api/v1/stacks/HDP/versions/2.6/repository_versions", "items" : [ { "href" : "http://master02:8080/api/v1/stacks/HDP/versions/2.6/repository_versions/1", "RepositoryVersions" : { "id" : 1, "stack_name" : "HDP", "stack_version" : "2.6" } } ]
Created 04-19-2018 06:12 PM
First, create the repo.json and hdputils-repo.json files, these are real cluster setup REST API I have used on AWS. Make sure that base URL once typed in the browser you can see both the HDP and HDP_Utils files. As usual, have these files where you are running the API from.
Setup Internal repo via REST API.
HDP
curl -H "X-Requested-By: ambari" -X PUT -u admin:admin http://ec2-52-213-14-151.eu-west-1.compute.amazonaws.com:8080/api/v1/stacks/HDP/versions/2.6/operati... -d @repo.json
Contents of the repo.json
{ "Repositories" : { "base_url" : "http://ec2-33-144-38-10.eu-central-1.compute.amazonaws.com/repos/2.6/HDP-2.6.0.3/HDP/centos7/", "verify_base_url" : true } }
HDP-UTILS
curl -H "X-Requested-By: ambari" -X PUT -u admin:admin http://ec2-52-213-14-151.eu-west-1.compute.amazonaws.com:8080/api/v1/stacks/HDP/versions/2.6/operati... -d @hdputils-repo.json
Contents of the hdputils-repo.json
{ "Repositories" : { "base_url" : "http://ec2-33-144-38-10.eu-central-1.compute.amazonaws.com/repos/2.6/HDP-UTILS-1.1.0.21/centos7/", "verify_base_url" : true } }
Hope that give you a clear indication
Created 04-19-2018 06:27 PM
@Geoffrey sorry if my question not clearly , but we not want to create..update the repo on ambari , what we want is to print the current repo from the ambari by API
Created 04-19-2018 10:09 PM
@Geoffrey , if printing the current repo by API as described in ambai GUI is not able , then at least how we can identify the API that you described here , performed successfully ?
"curl -H "X-Requested-By: ambari"-X PUT -u admin:admin http://ec2-52-213-14-151.eu-west-1.compute.amazonaws.com:8080/api/v1/stacks/HDP/versions/2.6/operati... -d @repo.json"