# API - FILE IFlow

#### Steps :

1. Token step&#x20;
2. Get Api - fetches data
3. File create - creates file
4. File upload - uploads data

The Steps involved can vary if we implement Global Variable.

#### Process:

• Delivers a scheduled integration portal-based solution that can be automated to flow data from one system to another ftp/sftp System.

• Get the data from GET API and place the data in the required FTP/SFTP.

• Simplify maintenance and minimize coding with seamless integration into delivery.&#x20;

&#x20;

1. **Token step**&#x20;

This is a Bizom API step, to generate a token using username and password credentials. ![](https://lh4.googleusercontent.com/yAu4UWa3j9pg0hjgyNg7-NMB7laMRNaXINqP9LzSnmVCwqoqxKlQ406xE0raS85KKux-xhlnZQFWn_5AB0g8U-BcGrIUJzJZvw2-lRXhHbdRUsMUpT5zaFt_L0GB5luoS0-cf0btQIUe6fXOOkcClQ)

<br>

Step Type: REST adapter

Sub Type: POST|application/xml

API URL: <https://api.bizom.in/oauth/directLogin/xml>

#### Sample Request:

\<User>

&#x20;   \<username>ecom\_apiadmin\</username>

&#x20;   \<password>Pir\@m@|\</password>

\</User>

<br>

2. **Retrieve Data using Get API**&#x20;

With the Get API, we retrieve the data using page filters.

In the response formatter, the structure and format of the retrieved data is stored in an object with the help of Nashorn template.

<br>

#### Pagination filters to fetch data from API:

* Start & end sequence
* date / time filter
* Batch count & size

![](https://lh6.googleusercontent.com/Oc1t-FdLUd7XRHH5xJTWG9pizFjdK45KY-BPtC0gUL2F0LiEjdWdWrYnLhLuKXI_t8BykvhiwpZ0QNxT_qUbfLOAcdzRdqO2VOvk6Von0HOLuaHqGhxiGPiP6J6Y-LJ3gkXIpR3yu8wP3QApReQlbA)

<br>

Step Type: REST adapter

Sub Type: POST|application/xml

API URL: [https://api.bizom.in/salesreturns/getSalemansalesreturn/?access\_token=${configs\['0'\].values\['1'\]\['Token'\]}\&responsetype=json\&fromdate=${lastScheduledStartTime?date} \&todate=${nextRunTime?date}\&startseq=${startSequence}\&endseq=${endSequence}\&fromtime=${lastScheduledStartTime?time}\&totime=${nextRunTime?time}\&is\_primary=1\&groupbytransactions=1](https://api.bizom.in/salesreturns/getSalemansalesreturn/?access_token=$%7Bconfigs\[%270%27].values\[%271%27]\[%27Token%27]%7D\&responsetype=json\&fromdate=$%7BlastScheduledStartTime?date%7D)

<br>

3. **File Create Step**

It is a SFTP/FTP step and here a file is created on the server.

In this step, settings are given to detail on the file format, delimiter, extension and structure.

<br>

Step Type: File Create Adapter

Sub Type: SFTP

<br>

![](https://lh3.googleusercontent.com/nmWn4fQN-0j6hC8neLRyIwob9A0e3irUVmtxzaRqrIRb2Q3wlRhTCzDH5q43X8S4otaBglIVRHhRlNSXk722usqm2iJTTQ1tIBZUjFW43oKEIPhE3VkoF_TC_Wv3lIfoSXtYeVRt_A6TXIYgvEidrg)

4. **File Upload Step**

The generated file in the 3rd step is uploaded to sftp server at this time.&#x20;

As in the third step, here also step settings are added to detailing.&#x20;

![](https://lh6.googleusercontent.com/Sa8OQ_My06C-JXbe6NBsjGsxZSY8r1RY_swRhlrE10D9vastYgSvKsdjpJihvU7_9iR4tVu78GLC3XuClYI8AxkbrwRhaEP1UiWIDmZsWOmrbRq0_6O0fcd4U2ovwFEmZBdltXRy04aBatYbrkmjVA)

Step Type: File Upload Adapter

Sub Type: SFTP

<br>

![](https://lh3.googleusercontent.com/FRdNPwWjHZxI7adBQUcrGmySCiVdOEoVBR8dk-s37CrfAOuY4LBrGMcr8TcSVRZFqNQOhdasGUVcWk50EBwoCAmPqJ1AvvTtrkI3HWi70DiqDS9Ts_akP7SGqjfxAQmswl1kwy6z-6V1oSIrmAbqdQ)

#### File path in OIP:

Parameters:

* user name
* Password
* Host name/IP address
* Port
* Main folder path
* New folder path
* Processed folder path
* inProgress folder path

Separated by delimiter.

\
Example:

PiramalGroup|LpDGNCkP0o|integrationdata.bizom.in|22|/integrationftp.bizom.in/PiramalGroup/bizom/Trishul/prod/PrimaryOrder\_BizomToSAP|new|processed|inProgress

#### Step Settings:

| Step Setting                       | Description                                                                                                        |
| ---------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
| CSV\_DELIMITER                     | To configure the Delimiter by which the values in the file are separated.                                          |
| FILE\_NAME\_FOR\_FILE\_UPLOAD      | Name with which the file is uploaded in the server                                                                 |
| FILE\_EXTENSION\_FOR\_FILE\_UPLOAD | Extension with which the file is uploaded in the server                                                            |
| DATE\_FORMAT\_FOR\_FILE\_UPLOAD    | Date format with which the file is uploaded in the server                                                          |
| APPEND\_DATA\_IN\_SINGLE\_FILE     | This setting is given when the data of different batch or API to be uploaded to the same file or in different file |
| WINDOWS\_LINE\_DELIMITER           | To configure the Windows command line Delimiter by which the values in the file can be separated.                  |
| UPLOAD\_EMPTY\_FILE                | To configure whether to upload an empty file into the server or not                                                |

#### Notes:

* The Step Type and Type are based on the adapter used for the step.
* The Logging enabled is to show the log for the step in step history.
* In the 3rd and 4th step, there is no request and response involved since we are only creating a file and uploading the data into it.

<br>
