


|
|
Using the FuseTalk API to your Advantage
Platform: ColdFusion
Setting Up the API
Using the API
Group Security
Error Handling
FuseTalk Standard Edition 2.0 which was released in early February introduced the ability for customers to easily interact with FuseTalk data using ColdFusion components (CFC) or web services. This feature has proven very useful and powerful to already many customers. This article will focus on a few group API functions, which seem to be very popular. As the following will demonstrate, the functions will let you easily integrate your current group structure with FuseTalk.
For those who are new to ColdFusion components, you may wish to read this article by Ben Forta (www.forta.com) before proceeding.
http://www.macromedia.com/devnet/mx/coldfusion/articles/intro_cfcs.html
SETTING UP THE API
|
Before you can proceed to use the API you need to ensure that is it configured properly. Here are the steps needed to ensure that the API is well configured for use.
| A. | Login to your ColdFusion administrator and go to the mappings section. |
| B. | Check to see if a mapping called "FuseTalkForums" exists, if it doesn't create it.
| | C. | Ensure that the path is properly constructed using the example below.
The FuseTalk installation has several directories, some of which are "com", "forum", "globaladmin", and "install". The mapping needs to point to the directory which FuseTalk had been extracted in. If my directory structure is c:\inetpub\wwwroot\fusetalk\com, c:\inetpub\wwwroot\fusetalk\forum etc my mapping should be c:\inetpub\wwwroot\fusetalk
|
|
USING THE API
|
Once you are quite certain that the mapping is pointing to the correct server directory you are ready to use the API. The following is an example on how to create a group.
| 1. | Create a template called "fusetalkapitest.cfm" on your web server using your favorite ColdFusion editor. |
| 2. | Copy the following code in the template.
<cfset ftobj = CreateObject("component", "FuseTalkForums.com.fusetalkapi")>
<cfset FTVAR_FORUMID = 1>
<cfset FTVAR_GROUPNAME = "My First Group">
<cfset FTVAR_SECURITYDESC = "1,9,10">
<cfset ftresult = ftobj.AddGroup(FTVAR_GROUPNAME, FTVAR_FORUMID, FTVAR_SECURITYDESC)>
<cfoutput>Group #FTVAR_GROUPNAME# has been added</cfoutput>
|
|
| 3. | Save the template. |
| 4. | Open a web browser and execute the template you've just created (http://www.mywebserver.com/fusetalkapitest.cfm). |
| 5. | From your web browser login as an administrator to Forum ID 1 or FuseTalk (http://www.mywebserver/com/fusetalk/forum/index.cfm?forumid=1). |
| 6. | Enter the administration section by clicking on the admin link from the top menu. |
| 7. | Enter the group section by clicking on the groups link on the left menu. |
| 8. | There should be a group called "My First Group" (without the quotes). |
| 9. | Click on the update icon and the following options should be checked: Delete Topic, View Profile, Archive Topic. |
Congratulations, you've just used the FuseTalk API to create your first group. The following is an explanation of what the code means.
This tells ColdFusion to create an object called ftobj which will contain the FuseTalk API.
|
<cfset ftobj = CreateObject("component", "FuseTalkForums.com.fusetalkapi")>
|
This initializes the FTVAR_FORUMID variable to the forum which is tagged to ID number 1.
|
<cfset FTVAR_FORUMID = 1>
|
This initializes the name of the group.
|
<cfset FTVAR_GROUPNAME = "My First Group">
|
This initializes the security context of the group, more on FuseTalk security below.
|
<cfset FTVAR_SECURITYDESC = "1,9,10">
|
This calls the function AddGroup from the FuseTalk API passing it the group name, forum id, and security context. This function will perform the necessary tasks to create the group.
|
<cfset ftresult = ftobj.AddGroup(FTVAR_GROUPNAME, FTVAR_FORUMID, FTVAR_SECURITYDESC)>
|
|
GROUP SECURITY
|
FuseTalk security is a very large subject which will not be discussed in this article. We will, however, describe a little bit how the group security structure works.
Each group within FuseTalk can have its own set of security permissions and each group can then be tagged to a category. Users who are in the group will then gain the selected security privileges when they enter the category. To see a full list of all the security permissions, login to a forum with a user that has administrative privileges and enter the group section under the administration module. Then update the "moderators" group. Each setting besides the checkbox is a distinct security option available to the group.
While adding a group you can specify which security permission the group will have. This is done by passing a comma-delimited list of the security ID's in the last parameter of the AddGroup function. In our example we set a variable called FTVAR_SECURITYDESC and assigned it the following values "1,9,10".
| 1: | Delete Topic |
| 9: | View Profile |
| 10: | Archive Topic |
A complete list of the security descriptors is available at the end of this article.
|
ERROR HANDLING
|
Let's say you've followed the example above and the group was not created. How can you find out why? Here's how.
FuseTalk handles errors by passing back error codes from the functions. The error codes can usually be access by the following method: resultvar.errorcode. An errorcode of 0 means that everything went well and the group has been created. Any other error codes mean that an error occurred. Below is an example of how you can get the "English" version of the error.
|
<cfset ftresult = ftobj.AddGroup(FTVAR_GROUPNAME, FTVAR_FORUMID, FTVAR_SECURITYDESC)>
<cfset FTVAR_ERROR = ftobj.GetDictionaryWordByID(1, ftresult.errorcode).vchword>
<cfoutput>ftresult.errorcode & ": " & #FTVAR_ERROR#</cfoutput>
|
|
Although this article has not gone into in depth discussions on the API, it has hopefully given you an understanding on the FuseTalk API and how it can relates to your application. The FuseTalk API has over 300 different functions which can be utilized in many different ways. Groups in only one of them. To see a complete listing of the functions including all the group functions please read our API documentation located in your global administrator. You can also view it here: http://livedocs.fusetalk.com/cf/globaladmin/index.htm#api_guide/api_brief.htm
SECURITY DESCRIPTORS
|
1 - Delete Topic
2 - Delete Message
3 - Move Topic
4 - Edit Message
5 - Banning
6 - Lock Topic
7 - E-mail User
8 - Access Forum Administrator
9 - View Profile
10 - Archive Topic
11 - Empty Trash Bin
12 - Update Forum Settings
13 - Administer Today Page
14 - Administer FAQ
15 - Administer Censored Words
16 - Administer Polls
17 - Administer Profile Questions
18 - Not Used
|
19 - Add/Update User
20 - Delete User
21 - Add/Edit Category
22 - Delete Category
23 - Post & Reply to a Category
24 - Not used
25 - Access Locked Categories
26 - Attach Files in a Category
27 - Approve Topics/Messages
28 - Not used
29 - Alert Topics
30 - Not used
31 - moderator logs
32 - Add/Update/Delete Groups
33 - Answer Support Questions
34 - Not used
35 - Move Message
36 - Mailing List
|
|
To discuss this article or to ask question please visit our forums.
|