cancel
Showing results for 
Search instead for 
Did you mean: 

How to access Cloud Foundry Controller API?

former_member184876
Active Participant

Hi Community,

After working for quite some time on the Cloud Foundry CLI and SAP Cloud Platform Cockpit, i was thinking how to access Cloud Foundry using Cloud Foundry API.

I explored little bit, but have hard time to understand how to authenticate to CF API using postman.

https://api.cf.eu10.hana.ondemand.com/

Need your advice on how i can get access token to access different Cloud Foundry APIs form Postman?

Thank you in advance,

Venu

0 Kudos

Hi,
Did anyone found a solution for this ?

Best Regards,

Vijendra

Accepted Solutions (1)

Accepted Solutions (1)

tobias_mitter2
Explorer
0 Kudos

It seems there is no solution yet, but there is one coming.

See this: https://help.sap.com/viewer/65de2977205c403bbc107264b8eccf4b/Cloud/en-US/3670474a58c24ac2b082e76cbbd...

Just stumbled over it by accident. When I look at the supported scopes though, it seems it is only a part of the whole api. It doesn't even say which api (v2 or v3), it might even be that SAP is building a facade around it...have to check it out some time. Hope this helps.

former_member184876
Active Participant
0 Kudos

Thank you Tobias for sharing this info. very helpful.

Answers (4)

Answers (4)

mike_zaschka
Active Participant

The answer is a copy from here: https://answers.sap.com/questions/13004003/how-to-authenticate-cloud-platform-api.html

With the help of SAP:

The CF Cloud Controller API is currently not connected to XSUAA and thus it is not possible to obtain a token from there. Instead you have to directly call the CF UAA service and use a valid user (no service key) and the following parameters. You should then get a valid token with cloud_controller.read and cloud_controller.write scopes.

Endpoint

https://login.cf.eu20.hana.ondemand.com/oauth/token (BTP region dependent)

Basic Authentication
user: cf
password: (empty - no password)

Parameters:

username: <BTP user email>
password: <BTP user password>
client_id: cf
grant_type: password
response_type: token

An example CURL call:

curl -v -XPOST -H"Application/json" -u "cf:" --data "username=<BTP user email>&password=<BTP user password>&client_id=cf&grant_type=password&response_type=token" https://login.cf.eu20.hana.ondemand.com/oauth/token
gregorw
Active Contributor

Maybe the links to the Cloud Foundry API documentation in SAP HANA XSA Controller API Interaction help you.

pavithra
Employee
Employee
0 Kudos

Did anyone find an answer to the question to do it in complete REST way

former_member210955
Active Participant
0 Kudos

Does this help ?

http://v3-apidocs.cloudfoundry.org/version/3.92.0/

Best Regards,

Saurav

former_member210955
Active Participant
0 Kudos

Does this help ?

http://v3-apidocs.cloudfoundry.org/version/3.92.0/

Best Regards,

Saurav

tobias_mitter2
Explorer
0 Kudos

Hi Venu,

I had basically the same question a few days ago.

https://answers.sap.com/questions/13004003/how-to-authenticate-cloud-platform-api.html

Didn't get a response until now. You can get a token with cli and use it in postman to access the api. It works well, I can use the whole range of apis (http://v3-apidocs.cloudfoundry.org/version/3.81.0/index.html). It is just that I can not find a way to authenticate in a REST way (without CLI). So it is really frustrating.

Best regards,

Tobias

former_member184876
Active Participant
0 Kudos

Hi Tobias,

Thanks for your response and pointing to your question. Yes. The token form CF CLI is working. But the JWT from XSUAA service instance (received through application binding) is rejected by Cloud Foundry API. Not sure if there is a way to access CF API through applicaitons.

Thank you,

Venu

tobias_mitter2
Explorer

Yes I tried every conceivable way...

Until just recently we had the same problem with the XSUAA API. There was also no way to use it until SAP finally released a "fix". Now you can create a XSUAA Instance with a special api service plan. When creating a service key for that instance you could finally get a working client_id and client_secret to access the api. The CF documentation mentions one can use the CF UAA to get a token to use the plattform api and by using the access to XSUAA I tried to create a oauth client, but also didn't succeed. For the plattform api, you need specific authorizations (scopes) which xsuaa doesn't give you.

I just cannot image, why on earth we are the only ones who would like to use this api. It is absolutely necessary for an operation team.

gregorw
Active Contributor

With your reminder for the service plan apiaccess I was able to find the documentation Enable API Access to an XSUAA Configuration.