getCredentialsValue (DataService - JavaScript)

Read-only. Can be used as an alternative to return the same credential values as getAppPath(), getUserName(), and getPassword() and so on. The method looks directly at the "credentials" values found in the VCAP_SERVICES environment variable.

Defined in

DataService

Syntax

getCredentialsValue(String) : String

Usage

You can use this method to write to the DataService object in the following ways:

  • getCredentialsValue("apppath") returns the same as getAppPath()
  • getCredentialsValue("username") returns the same as getUserName()
  • getCredentialsValue("host") returns the same as getHost()
and so on. This method looks directly at the "credentials" values found in the VCAP_SERVICES environment variable which look like the following:
{
   "XPagesData": [
      {
         "name": "myXPagesDB-XPagesData",
         "label": "XPagesData",
         "plan": "xpages-data-free",
         "credentials": {
            "apppath": "bluemix/xxxxxx/data1.nsf",
            "username": "xxxxxx",
            "host": "169.53.5.242",
            "rootDir": "bluemix/xxxxxx/dev/",
            "servername": "CN=server_name/O=Bluemix",
            "password": "xxxxxx",
            "url":"http://xxxxxx:xxxxxx@9.39.221.87/reg/BmUsrMgr.nsf/bmUserDashboard.xsp
      ?documentId=123456&action=openDocument"
         }
      }
   ]
}

Language cross-reference

getCredentialsValue method in Java DataService class.