API Variables allow you to map parameters that are sent by the API request. API Variables can be configured to be included with every call out your Fonteva Application makes. These objects can also be configured to be required. If an External App does not provide a required API Variable, the External Application will return an error. 

For example, if the External Application requires a specific value called Key for every single call out made from your Fonteva Application, you would use an API Variable to configure the value of the Key field.

Creating New API Variables


From the API Resource Detail:

  1. [Click] 
    .
  2. [Enter] the following information:
    • API Field: The name of the variable used in the Outgoing call.
    • Field Value: The value of the variable to be used in the Outgoing call.
    • Default Value: This field is used to set the default value if no value is entered by the user.
  3. [Click] the 'Is Required' select box if the API Variable is required.
  4. [Click] 
    .

Scenario: Using API Variables to Connect to Twitter

framework.Api.Variable variable = new framework.Api.Variable();
variable.apiResource = resource.configId;
variable.fieldApiName = 'q';
variable.required = true ;
framework.Config.push(variable);
variable = new framework.Api.Variable();
variable.apiResource = resource.configId;
variable.fieldApiName = 'count';
variable.defaultValue = '100';
variable.required = false ;
 
framework.Config.push(variable);
CODE