Skip to main content
June 16, 2009
Answered

Administrator API: Login to specific instance with username, password

  • June 16, 2009
  • 2 replies
  • 1290 views

1) How do I login to a specific instance of ColdFusion administrator with a username and password.  The example I see everywhere is variations of:

adminObj = createObject("component","cfide.adminapi.administrator");
adminObj.login("password");

which appears to be based on no instances and not multiple administrators.

my goal is to log into a set of instances and assign datasources to each of them based on a csv file.  I know how to do all that once logged in.

What I don't know how to do is log in!

Please help!

2) Is there an actual document anywhere that actually documents the administrator API?  I have the help files that I suspect everyone has and they don't.

Thank you.

    This topic has been closed for replies.
    Correct answer mack_

    As far as I know there's little documentation on the API :

    http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=basiconfig_37.html

    Another way would be to browse the CFC via the cfcexplorer:

    /CFIDE/componentutils/cfcexplorer.cfc?PATH=/cfide/adminapi/administrator.cfc&NAME=CFIDE.adminapi.administrator&METHOD=getcfcinhtml

    Mack

    2 replies

    June 19, 2009

    The way I did it was to create a directory under the cfide folder in a given instance and called the pages via http://server.blah.com:8301/cfide/blah/admin.cfm

    Here's some example code of creating a datasource (I don't recall where I grabbed it from, it isn't mine - but it does work).

    <!--- <!--- log in CFAdmin User --->
    <cfset administratorService = CreateObject("component","CFIDE.adminapi.administrator")>
    <cfset bIsLoggedIn = administratorService.Login(dsnpassword,dsnuser)>

    <cfif bIsLoggedIn>
       <cfset datasourceService = createObject("component", "CFIDE.adminapi.datasource")>
       <!--- check to see if datasource with same name doesn't already exist --->
       <cfif datasourceService.VerifyDSN(#dsName#) eq false>
          <cfset stArgs = StructNew()>
          <cfset stArgs.name = #dsName#>
          <cfset stArgs.database = #dbName#>
          <cfset stArgs.host = #dbServer#>
          <cfset stArgs.port = 1433>
          <cfset stArgs.driver = mssql>
          <cfset stArgs.selectmethod = datasource_selectmethod>
          <cfset stArgs.username = dbuser>
          <cfset stArgs.password = dbpassword>
          <!--- create datasource - this one's for MSSQL DB --->
          <cfset datasourceService.SetMSSQL(argumentCollection=stArgs)>
       </cfif>
    </cfif> --->

    June 16, 2009

    1a) Answer to self: by executing the API while running in the instance desired (duh).

    1b) No idea: does the login support a username parameter?  No idea because...

    2) I still can't find actual documentation for the API anywhere.

    Any answers to (1b) and (2)?

    mack_Correct answer
    Participating Frequently
    June 17, 2009

    As far as I know there's little documentation on the API :

    http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=basiconfig_37.html

    Another way would be to browse the CFC via the cfcexplorer:

    /CFIDE/componentutils/cfcexplorer.cfc?PATH=/cfide/adminapi/administrator.cfc&NAME=CFIDE.adminapi.administrator&METHOD=getcfcinhtml

    Mack