TIBCO Spotfire® Statistics Services URL API

Function Service API

You can use the Function Service API to send a function and its arguments to the engine on the server.

Note: Open-source R is available under separate open source software license terms and is not part of TIBCO Spotfire Statistics Services. As such, open-source R is not within the scope of your license for TIBCO Spotfire Statistics Services. Open-source R is not supported, maintained, or warranted in any way by TIBCO Software Inc. Download and use of open-source R is solely at your own discretion and subject to the free open source license terms applicable to open-source R.

You can identify a function by providing its package name, along with the function name. You can also provide any function arguments, whether they are strings or objects.

Important: By default, certain Spotfire Statistics Services capabilities are disabled. If you have functions that you created or used in a previous release, you might find that they no longer work as expected. Additionally, any expression that TERR determines to be potentially malicious is disabled. Below is a non-exhaustive example of some of the capabilities disabled by default in Spotfire Statistics Services.
  • Sending TERR expressions that perform I/O to the file system or the internet.
  • Spawning new OS processes by calling the system function.
  • Calling into Java using the terrJava package, or using functions in the parallel package.
  • Loading new packages, except for those included with TERR.
  • Calling .C or .Fortran.
  • Send expressions to the server using the Expression Service.
  • Calling ExtendedServerInfo or sending other expressions that read from, or write to, your server.
  • Sending potentially malicious expressions to the server using the URL API.
Additionally, the Function Service can execute only one function, which allows a connection from Spotfire. If you have functions that you want to have enabled on Spotfire Statistics Services, or if you have additional questions about the configuration settings that control these capabilities, see your server administrator.

The Function Service processes only one function at a time, and the function you send must be in a library or a package on the server. Most of the time, you will probably want to perform a series of tasks on a data set, including importing the data, cleaning it, modeling it, and graphing the results of your analysis. To accomplish complex analyses with the Spotfire Statistics Services Function Service, you can perform the following tasks.

  • Write and test your functions.
  • Wrap your functions in one function.
  • Create a library or a package to contain your wrapper function.
  • Deploy the library or package on the server using the spserverapi function administrationService.uploadPackageVersion. (see help for spserverapi, available from the Spotfire Statistics Services landing page at http://servername:8080/service_name/, for more information.).
  • When you run your function, specify your library or package name.
Note: The function API is designed specifically for calling user-created functions through Spotfire Statistics Services. It does not handle unnamed arguments, and all parameters are passed to the function as strings. The user functions should be written with these constraints in mind and the functions should coerce the parameters to desired data types as necessary. To execute arbitrary expressions, use the eval function in the Expression Service API. For more information about writing a function to be called on the server, see the TIBCO Spotfire Statistics Services User's Guide.

The results of your function call are returned as an SPXML string.

Examples

The following link demonstrates sending an asynchronous calculation for a simple random sample of a Poisson distribution to the engine, passing in two parameters (n and lambda ).

http://servername:8080/SplusServer/api/v8/function/rpois?n=10&lambda=30&async=true

Function Service API functions