on 03-23-2020 3:23 AM
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
It seems there is no solution yet, but there is one coming.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Maybe the links to the Cloud Foundry API documentation in SAP HANA XSA Controller API Interaction help you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Did anyone find an answer to the question to do it in complete REST way
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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.
With your reminder for the service plan apiaccess I was able to find the documentation Enable API Access to an XSUAA Configuration.
User | Count |
---|---|
81 | |
11 | |
8 | |
8 | |
6 | |
6 | |
6 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.