Configure context variables at method parameters

Configure context variables at method parameters

Summary

Context variables allow you to associate values assigned to the account, users and applications to APIs parameters values.

By setting up the API method you can relate its parameters to context variables. When a request is made to the method, the Vor-Tex gateway identifies the application and user that is making the request and completes the values of the parameters.

Parameters related to context variables are not displayed in the APIs documented in the developer portal. The developer user who accesses the method would not know its existence.





Predefined context variables

Your account contains some predefined context variables:
  1. User ID
  2. Username
  3. User email
  4. User role
  5. Application ID
  6. Application name
  7. Timestamp (Date of application in UNIX Timestamp format, e.g. : 1661351547)
  8. Epoch Date (application date in Epoch format, e.g. : 2022-07-20T17:24:00 000Z)

Add context variables

To add new context variables you must go to APIs > Context variables.

Then you need to click on the button New variable and complete the form.
  1. Name: This is the name by which you would identify the variable.
  2. Description: You can add a description to give more context on the content or use of the variables.
  3. Text of use: Variables can apply over predefined values, associated with users or associated with applications.
    1. All APIs: Allows you to set a fixed or primitive value (e.g. : timestamp(), epoch(), today() ).
    2. Users: You should assign values to each of the registered users.
    3. Applications: You should assign values to each of the registered applications
Once the context variable has been created, if you have selected Users or Applications, the button would be displayed Add value which allows you to search for registered developers or applications and enter the value you want to apply over the related parameter when the request is executed to the method.

Configure method parameters


Once you have created the variables to use, in the configuration of the API method you can configure the parameters to relate them to context variables.


What happens if you do not assign values to users or applications?

Where no value has been assigned to the user or application is made to the API method, the parameters would have the following behaviour:
  1. If the sign is mandatory, the application would be rejected.
  2. If the parameter is not mandatory, the default value defined in the data view would be used.

    • Related Articles

    • Create APIs methods

      Summary In the article Create and manage APIs versions The first necessary steps to create APIs were shown. Methods define the action to be taken on a particular esource. As a first step you should select the option of Add Methodin the API. Add ...
    • Add filters and parameters in data view

      Summary Data views allow you to add fixed or dynamic filters, these are parameters. Fixed filters To add a filter you must click on the option Filter data. A form would be displayed where you should select the column on which the filter, the type of ...
    • Try a method

      Summary The developer portal allows you to test reading methods (GETs) on the same portal. Test method Enter an API in the APIs Catalog on the portal's homepage. Then select a method and click on the buttonTest method. Select the implementation which ...
    • Create and configure APIs

      Summary APIs would be exhibited on the developer portal. An API can contain multiple versions, and each of the minimum versions. To create an API you must go to APIs > New APIs. Configure APIs When creating a new API you should complete the Title, ...
    • Configure APIs and Methods Privacy

      Summary You can define the privacy of your APIs and methods to grant access only to users you want, or revoke accesses when you require it. Privacy rules You can set up the visibility of APIs and methods, i.e. whether they would be public or private. ...