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:
- User ID
- Username
- User email
- User role
- Application ID
- Application name
- Timestamp (Date of application in UNIX Timestamp format, e.g. : 1661351547)
- 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.
- Name: This is the name by which you would identify the variable.
- Description: You can add a description to give more context on the content or use of the variables.
- Text of use: Variables can apply over predefined values, associated with users or associated with applications.
- All APIs: Allows you to set a fixed or primitive value (e.g. : timestamp(), epoch(), today() ).
- Users: You should assign values to each of the registered users.
- 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:
- If the sign is mandatory, the application would be rejected.
- If the parameter is not mandatory, the default value defined in the data view would be used.