forio Toggle navigation

Introspection API Service

The Introspection API Service allows you to view a list of the variables and operations in a model. Typically used in conjunction with the Run API Service.

The Introspection API Service is not available for Forio SimLang.

var intro = new F.service.Introspect({
        account: 'acme-simulations',
        project: 'supply-chain-game'
});
intro.byModel('supply-chain.py').then(function(data){ ... });
intro.byRunID('2b4d8f71-5c34-435a-8c16-9de674ab72e6').then(function(data){ ... });

Constructor options

Required? Name Type Description
  account string The account id. In the Epicenter UI, this is the Team ID (for team projects) or User ID (for personal projects). Defaults to undefined. If left undefined, taken from the URL.
  project string The project id. Defaults to undefined. If left undefined, parsed from the URL.
  token string For projects that require authentication, pass in the user access token (defaults to undefined). If the user is already logged in to Epicenter, the user access token is already set in a cookie and automatically loaded from there. (See more background on access tokens). @see Authentication API Service for getting tokens.
  transport JQueryAjaxOptions Options to pass on to the underlying transport layer. All jquery.ajax options are supported.
  server object
  server.host string The value of host is usually the string api.forio.com, the URI of the Forio API server. This is automatically set, but you can pass it explicitly if desired. It is most commonly used for clarity when you are hosting an Epicenter project on your own server
  server.protocol https / http Defaults to https

Methods

byModel(modelFile[, options])

Get the available variables and operations for a given model file.

Note: This does not work for any model which requires additional parameters, such as files.

Parameters

Required? Name Type Description
Yes modelFile string Name of the model file to introspect.
  options object Overrides for configuration options.

Example

intro.byModel('abc.vmf')
    .then(function(data) {
        // data contains an object with available functions (used with operations API) and available variables (used with variables API)
        console.log(data.functions);
        console.log(data.variables);
    });

byRunID(runID[, options])

Get the available variables and operations for a given model file.

Note: This does not work for any model which requires additional parameters such as files.

Parameters

Required? Name Type Description
Yes runID string Id of the run to introspect.
  options object Overrides for configuration options.

Example

intro.byRunID('2b4d8f71-5c34-435a-8c16-9de674ab72e6')
    .then(function(data) {
        // data contains an object with available functions (used with operations API) and available variables (used with variables API)
        console.log(data.functions);
        console.log(data.variables);
    });