Skip to content

Terra Dotta Software API Documentation


Back to Terra Dotta Software API Documentation Return to Public Site

Stub Example

A stub file is used for setting values that are not natively editable within the software, or to override/set a value temporarily. Any global value set in the stub will override the value a of setting by the same name. That is to One of these values is the Public Interface API Access Control List (ACL), or REQUEST.CurrentAccount.getPublicAPIACL(). An ACL is used to prevent or permit access based on one or more criteria. In this case, the REMOTE_ADDR CGI variable (IP address) is cross-checked against the value(s) set in the ACL.

For most installations, this value should be set to the IP address(es) for the physical server or servers hosting the software. This configuration prevents outside sources from accessing the API. If the goal is to keep the API open for your installation, this setting may be disregarded.

Stub Location
http://{site root}/components/_stub.cfm
The value for {site root} would represent your installation URL. If the file _stub.cfm does not exist in that location, please create it using a standard text editor and rename it with a "cfm" extension.

Restrict access to all users (no users may access the API):
<cfset REQUEST.CurrentAccount.setPublicAPIACL("NULL") />
Restrict access to the local host machine (loopback/localhost):
<cfset REQUEST.CurrentAccount.setPublicAPIACL("127.0.0.1") />
Restrict access to multiple IPs:
(Use commas to separate multiple values)
<cfset REQUEST.CurrentAccount.setPublicAPIACL("192.168.1.1,192.168.1.2,255,255,255.0,127.0.0.1") />
Give access to all users by removing or commenting out the setting:
(This example uses a ColdFusion comment that cause the value to be ignored)
<!---// <cfset REQUEST.CurrentAccount.setPublicAPIACL("NULL") /> //--->
NOTE: Once this setting is populated, it will be populated for the life of the application timeout, or until the system is flushed. That is to say, if you make a change, and you want to remove it, removing the code in the stub is not enough -- you must set it to an empty value, as in:
<cfset REQUEST.CurrentAccount.setPublicAPIACL("") />

After a single request has been made (to update this value), you may safely remove the stub code.
For additional information about the stub file, please visit the main documentation for the software.

Back to Terra Dotta Software API Documentation Top