21

I have downloaded and installed the Cloud Foundry CLI tool "cf". However, I am not able to login because I could not set the API endpoint.

What is the API endpoint that I should provide? Where can I find the related information?

joe
  • 2,458
  • 2
  • 10
  • 19
Sumona
  • 211
  • 1
  • 2
  • 3
  • https://developer.ibm.com/courses/wp-content/uploads/sites/83/2016/08/CDC1-CFCLI-Lab.pdf – Ali Sep 07 '16 at 14:19

6 Answers6

21

If you are using US South Region:

use these commands:

cf api https://api.ng.bluemix.net
cf login -u bluemix_id -o myorg

If you are using United Kingdom region:

use these commands:

cf api https://api.eu-gb.bluemix.net
cf login -u bluemix_id -o myorg

for Sydney region

cf api https://api.au-syd.bluemix.net
cf login -u bluemix_id -o myorg

for Germany region

cf api https://api.eu-de.bluemix.net
cf login -u bluemix_id -o myorg

you can know which region, org and space is currently set typing:

cf target

If you are using the 'bluemix' plugin you can use the below command

example: bx api <apiLink> and bx target

15

The endpoint depends on the Bluemix region/data center, this one is for the default in North America/Dallas ("US South"):

cf login -a https://api.ng.bluemix.net

Instead of "ng" you could also have "eu-gb" for London or "au-syd" for Sydney. The regions for Bluemix Public are documented here. If you are on Bluemix Dedicated or Bluemix Local you would need to ask your administrator for the correct name of the API endpoint.

For Bluemix Public:

cf api https://api.ng.bluemix.net
cf api https://api.eu-gb.bluemix.net
cf api https://api.eu-de.bluemix.net
cf api https://api.au-syd.bluemix.net
cf api https://api.us-east.bluemix.net

You can also get an overview of existing endpoints using the IBM Cloud CLI with the regions command:

>> bx regions
Listing regions...

Name       Geolocation      Customer   Deployment   Domain                CF API Endpoint                   Type   
eu-de      Germany          IBM        Production   eu-de.bluemix.net     https://api.eu-de.bluemix.net     public   
au-syd     Sydney           IBM        Production   au-syd.bluemix.net    https://api.au-syd.bluemix.net    public   
us-east    US East          IBM        Production   us-east.bluemix.net   https://api.us-east.bluemix.net   public   
us-south   US South         IBM        Production   ng.bluemix.net        https://api.ng.bluemix.net        public   
eu-gb      United Kingdom   IBM        Production   eu-gb.bluemix.net     https://api.eu-gb.bluemix.net     public 
data_henrik
  • 14,377
  • 2
  • 20
  • 43
15

For future users who may stumble across this question using the IBM Cloud CLI, the commands to set the API Endpoint are very similar:

US South

ibmcloud api https://api.ng.bluemix.net 

US East

ibmcloud api https://api.us-east.bluemix.net

United Kingdom

ibmcloud api https://api.eu-gb.bluemix.net 

Germany

ibmcloud api https://api.eu-de.bluemix.net

Sydney

ibmcloud api https://api.au-syd.bluemix.net

After setting the API Endpoint, you can login:

ibmcloud login

Official docs here:

https://console.bluemix.net/docs/cli/reference/ibmcloud/bx_cli.html#bluemix_cli

joe
  • 2,458
  • 2
  • 10
  • 19
  • 1
    Note that it is very important *not* to include a trailing slash on these endpoints. If you do, certain commands, such as `bx login`, will fail. – Andrew Ferrier Apr 04 '17 at 13:22
1

for change region login, example:

bx login -a https://api.ng.bluemix.net
0

Please follow these instructions.

  1. Use the below command to verify your credentials: cf login -a https://api.example.com -u username@example.com -p Password

  2. use cf login -a $url -u xxx@abc.com -p xxxxx instead of cf login -a $url command.

FluffyKitten
  • 12,639
  • 10
  • 31
  • 45
0

You should use the extended cf cli which is now bx cli (the BlueMix CLI). With the bx cli installed you simply type: bx regions

This will list all the available regions and api endpoints available. With that in hand now you can connect to your preferred region/api. Below is the output from the bx regions command:

bx regions
Listing Bluemix regions...

Name       Geolocation      Customer   Deployment   Domain               CF 
API Endpoint                  Type
eu-de      Germany          IBM        Production   eu-de.bluemix.net    
https://api.eu-de.bluemix.net    public
au-syd     Sydney           IBM        Production   au-syd.bluemix.net   
https://api.au-syd.bluemix.net   public
us-south   US South         IBM        Production   ng.bluemix.net       
https://api.ng.bluemix.net       public
eu-gb      United Kingdom   IBM        Production   eu-gb.bluemix.net    
https://api.eu-gb.bluemix.net    public

You can get the bx cli from here https://clis.ng.bluemix.net/ui/all_versions.html.

Hope this helps.

Michael
  • 197
  • 1
  • 9