Archives of Support Questions (Read Only)

This is an archived board for historical reference. Information and links may no longer be available or relevant
Announcements
This board is archived and read-only for historical reference. To ask a new question, please post a new topic on the appropriate active board.

Not able to use rest endpoints of cloudbreak to do stack list on localhost

avatar

Hi,

I am trying to understand REST Api for cloudbreak and I am trying to list stacks I created on cloudbreak using the API call. But it always giving me 404 not found.

This is how I get the token (ref: https://community.hortonworks.com/questions/26536/cloudbreak-rest-api-usage.html):

curl -iX POST -H "accept: application/x-www-form-urlencoded" -d 'credentials={"username":"admin@example.com","password":"cloudbreak"}' "http://localhost:8089/oauth/authorize?response_type=token&client_id=cloudbreak_shell&scope.0=openid&source=login&redirect_uri=http://cloudbreak.shell"

Once I have token I am trying to get list of stacks as

curl -vvv -X GET -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" http://localhost:8080/api/v1/stacks/3

* About to connect() to localhost port 8080 (#0)

* Trying ::1...

* Connected to localhost (::1) port 8080 (#0)

> GET /api/v1/stacks/3 HTTP/1.1

> User-Agent: curl/7.29.0

> Host: localhost:8080

> Accept: */*

> Authorization: Bearer eyJhbGciOiJIUzI1NiIsImtpZCI6ImxlZ2FjeS10b2tlbi1rZXkiLCJ0eXAiOiJKV1QifQ.eyJqdGkiOiJhMDRiZmYyOWY0YzQ0NGYzYWFlNGNlNjI2NzYyMjBiNCIsInN1YiI6ImIxMzk1NDU3LWNlYjYtNDZlMC1hOWZlLTU2NGE3NTU0N2RhMSIsInNjb3BlIjpbImNsb3VkYnJlYWsubmV0d29ya3MucmVhZCIsImNsb3VkYnJlYWsudXNhZ2VzLnVzZXIiLCJjbG91ZGJyZWFrLnJlY2lwZXMiLCJjbG91ZGJyZWFrLnVzYWdlcy5nbG9iYWwiLCJvcGVuaWQiLCJjbG91ZGJyZWFrLnBsYXRmb3JtcyIsImNsb3VkYnJlYWsudGVtcGxhdGVzLnJlYWQiLCJwYXNzd29yZC53cml0ZSIsImNsb3VkYnJlYWsudXNhZ2VzLmFjY291bnQiLCJjbG91ZGJyZW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GF0Zm9ybXMiLCJwYXNzd29yZCIsImNsb3VkYnJlYWsuYmx1ZXByaW50cyIsImNsb3VkYnJlYWsudGVtcGxhdGVzIiwiY2xvdWRicmVhay5uZXR3b3JrcyIsImNsb3VkYnJlYWsuc3NzZGNvbmZpZ3MiLCJjbG91ZGJyZWFrLnVzYWdlcyIsImNsb3VkYnJlYWsuc2VjdXJpdHlncm91cHMiLCJjbG91ZGJyZWFrLnN0YWNrcyIsImNsb3VkYnJlYWsuY3JlZGVudGlhbHMiXX0.ZH_ejvtJZZ21QqbJrByrfggozhOOBh3LxfPxbtC_iuM&expires_in

> Content-Type: application/json

>

< HTTP/1.1 404 Not Found

< Server: Apache-Coyote/1.1

< Content-Length: 0

< Date: Wed, 15 Feb 2017 00:51:22 GMT

<

* Connection #0 to host localhost left intact

from shell I can see the stack as

cloudbreak-shell>stack list

ID INFO

-- -----------

3 cloudbreak2

Any Pointers on this will be really helpful.

Thanks

Atul Aggarwal

1 ACCEPTED SOLUTION

avatar
Super Collaborator

I think the root has been changed can you try with: cb/api/v1/stacks/3 instead of /api/v1/stacks/3.

View solution in original post

2 REPLIES 2

avatar
Super Collaborator

I think the root has been changed can you try with: cb/api/v1/stacks/3 instead of /api/v1/stacks/3.

avatar

Woohoo! thanks @khorvath!