Global Variable Adapter
Last updated
Last updated
The Global Variable adapter allows dynamic storage of values that can be used during runtime. This feature is useful for storing a specific key in OIP and reusing it in API filters by dynamically changing its values.
global variable retrieve - Fetch the value from DB during run time.
global variable create - Create/ update the value during run time.
Interface Name: PrimaryOrders_Bizom_API_TO_EOSALES_FILE_Prod_V2
Requirement: To compensate for any delay at the Bizom GET API end, we implement Global variable logic to store the last created/modified time of the order. This will help OIP to fetch the orders based on the last received order time.
In the left panel options, choose the Global Variable screen.
Click on the option to create and select the Client Name, Job Name and define the global variable name and global variable value which we need to configure and save.
Global variable values can accept only string data types. From bizom API, we will receive the time in HH:mm:ss format. As string data type can’t accept colon, hence we replace colon with R in global variable value. The same needs to be handled at the code level (freemarker template).
By using the provided credentials we will hit the bizom token API and generate the token.
API: https://api.bizom.in/oauth/directLogin/xml
Request:
<User>
<username>eosalesintegration</username>
<password>E@$@ls</password>
</User>
This step is used to retrieve the global variable we have configured in the global variable screen.
Step Type, Type: GLOBAL VARIABLE
Sub Type: globalVariableRetrieve
Request Template: We have to give the same name which we have defined in the global variable screen. eg: eosalesLastOrderDateKey.
This step is used to get the data from the bizom list order API.
Parameters
Values
Access token
Get the token from first step
Fromdate
Value taken from global variable retrieve step
Fromtime
Value taken from global variable retrieve step
Todate
Next run time from job details
Totime
Next run time from job details
Start sequence
From job settings (Starts from 0 and iterates with each batch depending on the batch size.)
End Sequence
Calculated by OIP as, (Start Sequence + batch size) - 1
Date type
It can be created/modified based on the client requirements.
Hard coded as 1 (depends on the client)
Hard coded as 2 (depends on the client)
Based on the date type used in the API, read the date and time from Bizom API and add it to the list of data. This value can be utilized in the global variable create step.
This step is used for creating headers and data for the list. This will be written to the file using the next 2 steps. The Nashorn step is used based on the logic requirements and is not a mandatory step.
It is used to write the data to the file and create the file on the server.
Path:
eosales|B5HdfBcYIs|integrationftp.bizom.in|22|/integrationftp.bizom.in/eosales/bizom/Prod/Primaryorders|new|processed|inProcess
Step Settings:
It is used to upload the generated file to the target SFTP/FTP folder.
Path:
eosales|B5HdfBcYIs|integrationftp.bizom.in|22|/integrationftp.bizom.in/eosales/bizom/Prod/Primaryorders|new|processed|inProcess
Step Settings:
This step is used to modify the global variable value based on the modified time of the last order.
Step Type, Type: GLOBAL VARIABLE
Sub Type: globalVariableCreate
Step Request Validation: For including dynamic batch count in the bizom get API parameters, we can add request validation in the create step. The global variable value is updated only after the last batch of each run. After each batch, this step throws a validation message as "Didn't try rest, validation error: Global Variable Will Update in Last Run".
At creation time, the value is taken from the object holder depending on the API step. If we receive data from Bizom API, the value can be taken from the last date in the current response, else it can be taken from the global variable retrieve step which is already stored in the database.