User Guide

34 Chapter 3: Common Tasks
2.
Check that the login API completed successfully by parsing the returned XML and examining
the value of the
status tag’s code attribute.
If the status code isnt
ok, determine what the error was and handle it appropriately, as in the
following:
<cfset xml= XmlParse(cfhttp.FileContent)>
<cfset resultsElement= XmlSearch(xml, "//status[@code='ok']")>
<cfif ArrayLen(resultsElement) neq 1>
<!--- No status code "ok" found. Check for other status codes and handle
errors. --->
</cfif>
3.
Request a list of Breeze users from the Breeze server by calling the principal-list API.
The server returns a complete list of all principals, including principals that arent users.
(For information about principals, see About principals, SCOs, and IDs” on page 17.)
The following code calls the
principal-list API. The cookie value from the previous step is
included as an HTTP parameter.
<cfhttp url="#baseurl#api/xml?action=principal-list" method="post">
<cfhttpparam type="Cookie" name="BREEZESESSION" value="#loginCookie#">
</cfhttp>
Note: This HTTP request uses the POST
method rather than GET because the only way to specify
an HTTP parameter in CFML is by using POST. The URL and the query parameters remain the
same as if you were using GET, however.
4.
Make sure that the API completed successfully by parsing the returned XML to ensure that the
value of the
status tag’s code attribute is set to ok.
If your code must be robust, you should check the
status tag in the returned XML after every
API.
5.
If the status code is ok, search the returned list of principals to find all principals that have a
type attribute set to user.
The following example places a list of all Breeze users into the array
allUsers:
<cfset xmlPrincipalList= XmlParse(cfhttp.FileContent)>
<cfset allUsers = XmlSearch(xmlPrincipalList, "//principal [@type='user']")>
6.
Obtain a list of all the users listed in the directory service.
The procedure for obtaining this list depends on the directory service.
7.
Compare the values contained in the login tags for the Breeze users with the e-mail addresses
from the directory service, using a list-comparison algorithm of your choice.
a
Determine which users are in the directory service but not in Breeze; these are new users to
be added to Breeze.
b
Determine which users are in Breeze but not in the directory service; these users should be
removed from Breeze.
c
Determine which users are in both Breeze and the directory service, but have different
names in the two places; these usersnames should be changed in Breeze.