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){ ... });

Configuration Options

token

For projects that require authentication, pass in the user access token (defaults to empty string). 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).

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 empty string. If left undefined, taken from the URL.

project

  • String

The project id. Defaults to empty string. If left undefined, taken from the URL.

Methods

byModel

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.

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);
     });

Parameters

  • modelFile: String Name of the model file to introspect.

  • options: Object (Optional) Overrides for configuration options.

byRunID

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.

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);
     });

Parameters

  • runID: String Id of the run to introspect.

  • options: Object (Optional) Overrides for configuration options.