Re: CF // Login using REST API


Daniel Mikusa
 

On Mon, Jul 27, 2015 at 4:58 AM, Brena, Juan Antonio (ext) <
juan.brena.external(a)atos.net> wrote:

Good morning,

I have installed CF using the following installer:
*https://github.com/yudai/cf_nise_installer*
<https://github.com/yudai/cf_nise_installer>

Using the following request:

*https://api.CF_IP.xip.io/v2/info* <https://api.CF_IP.xip.io/v2/info>

Y receive the following information:

{
"name": "vcap",
"build": "2222",
"support": "http://support.cloudfoundry.com",
"version": 2,
"description": "Cloud Foundry sponsored by Pivotal",
"authorization_endpoint": "https://uaa. CF_IP.xip.io",
"token_endpoint": "https://uaa. CF_IP.xip.io",
"min_cli_version": null,
"min_recommended_cli_version": null,
"api_version": "2.25.0",
"logging_endpoint": "wss://loggregator. CF_IP.xip.io:4443"
}

I would like to know, how to get a token (Login process) to get apps:

*https://api.CF_IP.xip.io/v2/apps* <https://api.CF_IP.xip.io/v2/apps>

Many thanks in advance.

If you just want to login and use your system, install the cf cli.

https://github.com/cloudfoundry/cli/releases

Then run `cf api api.CF_IP.xip.io` followed by `cf login`. This will
prompt you for your credentials. I can't recall what that installer set's
up, but it'll be something like admin / admin or admin / admin-secret.
Check the docs, it'll probably say.

For additional help with cf, run `cf -h` to see the available commands or
`cf command -h` to get details on a particular command.


If you want to login programmatically (like if you're going to write an app
to interact with CF) then you need to go through one of the Oauth2 work
flows. If you're unfamiliar with Oauth2, google has lots of resources on
the flows and how it works.

As far as CF, a couple things to get you started...

1.) Run `CF_TRACE=true cf login` (or `set CF_TRACE=true` followed by `cf
login` on Windows) and watch the output. It'll dump the HTTP request and
response data, so you can see how the cli does it.

2.) Beyond that, more detail can be found here.

https://github.com/cloudfoundry/uaa/tree/master/docs

I have found this particular document to be useful.

https://github.com/cloudfoundry/uaa/blob/master/docs/UAA-APIs.rst

and of course, post any follow up questions to the list.

Dan

________________________________

cf-dev mailing list
cf-dev(a)lists.cloudfoundry.org
https://lists.cloudfoundry.org/mailman/listinfo/cf-dev

Join cf-dev@lists.cloudfoundry.org to automatically receive all group messages.