Skip to content

Terra Dotta Software API Documentation


Back to Terra Dotta Software API Documentation Return to Public Site

getPrograms

Returns a list of active programs by their associated program type(s).

URL
http://{site root}/piapi/index.cfm?callName=getPrograms
The value for {site root} would represent your installation URL.



Top
Table 1: Input arguments for getPrograms
Standard Input Parameters (jump to call specific input arguments)
Argument Type Required Meaning
ResponseEncoding String Optional The data format to be returned by the API call. The value for ResponseEncoding can be one of the following values:
    Applicable values:
    (case insensitive)
  • XML - eXtensible Markup Language (default)
  • JSON - JavaScript Object Notation
  • SOAP - Simple Object Access Protocol
CallBack Boolean Optional Used with JSON only to specify if a callback function will be used or not.
CallBackName String Optional Used with JSON only to specify the callback function to use.
Call-specific Input Parameters (jump to standard input arguments)
Argument Type Required Meaning
ItemSort String Optional Sorts search results based on the value you specify. See the SortOrder field for values for specifying that results are returned in ascending or descending order.
    Applicable values:
    (case insensitive)
  • Program_Name
  • Program_City
  • Program_Country
  • Program_Region
Or, a combination of the above.

Default: Program_Name, Program_City, Program_Country, Program_Region
SortOrder String Optional Sorts search results in ascending or descending order, in conjunction with the value(s) you specify in ItemSort. The default is ascending order, or "asc".
    Applicable values:
    (case insensitive)
  • asc
  • desc

Default: asc
ProgramType Integer Optional A filter for specifying the type(s) of programs to return. The default will return Outgoing with SideTrips and OneStep (1).
    Applicable values:
  • 1 - Outgoing with SideTrips and OneStep
  • 2 - Inbound Exchange
  • 3 - Scholarship
  • 4 - Risk Management
  • 14 - Advising

Default: Outgoing with SideTrips and OneStep
StartRow Integer Optional Starting row of the program list.
EndRow Integer Optional Ending row of the program list.


Top
Table 2: Return values for getPrograms
Depending on the program type, some of the nodes may or may not be available. The following is a representation of all available nodes for all program types.
Return Value Type Meaning
program_id Integer The numeric program identifier.
program_name String The name of the program.
program_city String The name of the host program city.
program_country String The name of the host program country.
program_region String The geographical region in which the program is hosted.
program_latitude Decimal Latitude coordinate for the the program location.
program_longitude Decimal Longitude coordinate for the the program location.
program_type_id Integer An integer value that represents the type of program it is.


Using our original call:
http://{site root}/piapi/index.cfm?callName=getPrograms
We would receive a packet of data in XML format (the default), that might resemble the following:
(the following XML packet is formatted for readability)
<programs>
    
<recordcount>2</recordcount>
    
<program>
        
<program_id>10304</program_id>
        
<program_name>CIEE Botswana: University of Botswana</program_name>
        
<program_city>Gaborone</program_city>
        
<program_country>Botswana</program_country>
        
<program_region>Africa</program_region>
        
<program_latitude>-24.65451</program_latitude>
        
<program_longitude>25.90859</program_longitude>
        
<program_type_id>1</program_type_id>
    
</program>
    
<program>
        
<program_id>10309</program_id>
        
<program_name>Faculty-Led Italy: Food and Wine of Italy</program_name>
        
<program_city>Florence</program_city>
        
<program_country>Italy</program_country>
        
<program_region>Europe</program_region>
        
<program_latitude>43.76667</program_latitude>
        
<program_longitude>11.25</program_longitude>
        
<program_type_id>2</program_type_id>
    
</program>
</programs>


We can modify the call to return the data in SOAP format by specifying ResponseEncoding=SOAP:
http://{site root}/piapi/index.cfm?callName=getPrograms&ResponseEncoding=SOAP
We would receive a packet of XML wrapped within a SOAP envelope that might resemble the following:
(the following XML packet is formatted for readability)
<soapenv:Envelope 
    xmlns:soapenv
="http://schemas.xmlsoap.org/soap/envelope/" 
    xmlns:xsd
="http://www.w3.org/2001/XMLSchema" 
    mlns:xsi
="http://www.w3.org/2001/XMLSchema-instance">
    
<soapenv:Body>
        
<programs>
            
<recordcount>2</recordcount>
            
<program>
                
<program_id>10304</program_id>
                
<program_name>CIEE Botswana: University of Botswana</program_name>        
                
<program_city>Gabore</program_city>
                
<program_country>Botswana</program_country>
                
<program_region>Africa</program_region>
                
<program_latitude>-24.65451</program_latitude>
                
<program_longitude>25.90859</program_longitude>
                
<program_type_id>1</program_type_id>
            
</program>
            
<program>
                
<program_id>10309</program_id>        
                
<program_name>Faculty-Led Italy: Food and Wine of Italy</program_name>
                
<program_city>Florence</program_city>
                
<program_country>Italy</program_country>
                
<program_region>Europe</program_region>
                
<program_latitude>43.76667</program_latitude>
                
<program_longitude>11.25</program_longitude>
                
<program_type_id>2</program_type_id>
            
</program>
        
</programs>
    
</soapenv:Body>
</soapenv:Envelope>


We can modify the call to return the data in JSON format by specifying ResponseEncoding=JSON:
http://{site root}/piapi/index.cfm?callName=getPrograms&ResponseEncoding=JSON
We would receive a JSON-encoded packet:
(the following JSON packet is formatted for readability)
_cb_getPrograms
(
 
{
  "RECORDCOUNT"
: 2,
  "PROGRAM":
   {
   "110":
    {
    "PROGRAM_ID":10304,
    "PROGRAM_NAME":"CIEE�Botswana:�University�of�Botswana",
    "PROGRAM_CITY":"Gabore",
    "PROGRAM_COUNTRY":"Botswana",
    "PROGRAM_REGION":"Africa",
    "PROGRAM_TYPE_ID":"1"
    },
   "111":
    {
    "PROGRAM_ID":10309,
    "PROGRAM_NAME":"Faculty-Led�Italy:�Food�and�Wine�of�Italy",
    "PROGRAM_CITY":"Florence",
    "PROGRAM_COUNTRY":"Italy",
    "PROGRAM_REGION":"Europe",
    "PROGRAM_TYPE_ID":"2"
   }
  }
 }
}
The data returned using JSON encoding is wrapped within the callback function, _cb_getPrograms(). By default, all JSON calls are returned within a callback wrapper function in form of:
_cb_callName()
Where callName represents the name of the function you originally called. To override this, you can specify the callBackName argument, as in:
http://{site root}/piapi/index.cfm?callName=getPrograms&ResponseEncoding=JSON&callBackName=MyCallBackFunction
This call would return the JSON packet wrapped within the callback function, MyCallBackFunction, as in:
_cb_MyCallBackFunction(...json-encoded data...)
In your custom pages, you would then create a corresponding function to handle this custom callback function:
<script language="JavaScript" type="text/javascript">
<!--
// <![CDATA[
function _cb_MyCallBackFunction(data)
{
    
// put additional routines here
}
// ]]>
//-->
</script>
If you would like to receive the data without a callback function, you can use the argument callBack to override this. Specifying a value of false for the callBack argument returns the data without the callback function, as in:
http://{site root}/piapi/index.cfm?callName=getPrograms&ResponseEncoding=JSON&callBack=false
Note: specifying callBack=true is implied and is unnecessary for returning JSON data with a callback function.



Example 1: Following is an example using JSON and client-side JavaScript to render the program names as links and indicating whether or not the programs are incoming:


Run Example 1 Top
(if your installation does not have any data, this example may not return anything)

<div id="results"></div>
<script language="JavaScript" type="text/javascript">
<!--
// <![CDATA[
function _cb_getPrograms(root)
{
    var progname = '';
    var programtypeid = '';
    var progid = 0;
    var program = '';
    var rs = root.PROGRAM;
    if(rs) {
      for (var key in rs) {
        if(key && typeof rs[key]=='object'){
          var obj = rs[key];
          for (var prop in obj) {
            if(prop == 'PROGRAM_NAME') {
              progname = obj[prop] ;
            }
            if(prop == 'PROGRAM_ID'){
              progid = obj[prop] ;
            }
            if(prop == 'PROGRAM_TYPE_ID'){
              programtypeid = obj[prop] ;
            }
          }
          if (null != progname && null != programtypeid)
          {
            if(programtypeid == '2'){
              program = program + '<a href="index.cfm?FuseAction=Programs.ViewProgram&amp;Program_ID='

              + progid + "'">' + progname + '</a>' + " (Inbound Exchange)<br />";
            }
            else {
              program = program + '<a href="index.cfm?FuseAction=Programs.ViewProgram&amp;Program_ID='

              + progid + '">' + progname + '</a>' + "<br />";
            }
          }
        }
      }
    }
    document.getElementById("results").innerHTML = program;
}
// ]]>
//-->
</script>
<script src="http://{site root}/piapi/index.cfm?callname=getPrograms&ResponseEncoding=json"
        type="text/javascript">
</script>
Example 2: Following is an example of using ColdFusion to call the API and returning the data in a SOAP envelope:

Run Example 2 Top
(if your installation does not have any data, this example will not return anything)

<!---// local variables //--->
<cfparam name="responsePacket" default="[ no response ]" />

<!---// connect to the API (GET or POST) //--->
<cfhttp result="httpCall" method="post"
     url="#REQUEST.CurrentAccount.AccountURL()#piapi/index.cfm">
    
<cfhttpparam name="callName" type="url" value="getPrograms" />
    <
cfhttpparam name="ResponseEncoding" type="url" value="SOAP" />
</
cfhttp>

<!---// ensure the response is in XML format //--->
<cfif isXml(httpCall.fileContent)>
    
<!---// parse response //--->
    
<cfset responsePacket = xmlParse(httpCall.fileContent) />
    
<!---// check to see if an error was thrown //--->
    
<cfset err = xmlSearch(responsePacket, "//extrainfo") />
    
<!---// an error was thrown //--->
    
<cfif isArray(err) and not arrayIsEmpty(err)>
        
<!---// throw error //--->
        
<cfthrow message="#err[1].xmlText#" />
        <
cfabort />    
    </
cfif>
<cfelse>
    
<!---// additional error checking //--->
</cfif>

<!---// additional code goes here //--->
<h2>Output for 'responsePacket':</h2>
<cfdump VAR="#responsePacket#" />


Following are some additional call examples using the other available arguments.

To return all Outgoing with SideTrips and OneStep programs, you would specify a value of 1 for programType, as in:
http://{site root}/piapi/index.cfm?callName=getPrograms&programType=1
You could further that example by specifying more than one argument for programType. If you wanted to return all Outgoing with SideTrips and OneStep and Inbound Exchange programs, you would specify both Outgoing with SideTrips and OneStep and 2 for programType, separated by a comma, as in:
http://{site root}/piapi/index.cfm?callName=getPrograms&programType=1,2


For additional techniques, be sure to visit the other program calls within these documentation pages.

Back to Terra Dotta Software API Documentation Top