API - API IFlow
In this I flow the data flows from one system to another system. We fetch data from one API and post the required fields to the other API. The flow can be from Bizom API to the client API or vice versa.
There two Following flow in this integration
Bizom API to Client API
Client API to Bizom API
BIZOM TO CLIENT
INTERFACE NAME: PrimarySaleReturn_Bizom_API_To_OEL_API_Prod
REQUIREMENT:
We need to fetch data Sale return data coming from bizom API and filter the required fields and post the same to Client API.
FLOW STRUCTURE:
STEP 1:
Post the bizom access token API using REST adapter
By using the provided credentials, we will hit the bizom token API and generate token.
API: https://api.bizom.in/oauth/directLogin/xml
REQUEST:
<User>
<username>orientintegration</username>
<Password>kucDJ{5EHL></Password>
</User>
STEP 2:
Bizom Sale Return API
This step is used to get the data from bizom list order API.
PARAMETERS
VALUES
Access token
Get the token from first step
Fromdate
Value taken from last scheduled start date in OIP
Fromtime
Value taken from last scheduled start time inOIP
Todate
Value taken from Next run date in OIP
Totime
Value taken from Next run time in OIP
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/fordate based on the client requirements
Is_primary
Hard coded as 1 , Depends on the business requirement of client
We get all the data present in the given time range when we hit API using the Rest Adaptor.
We need to fetch required fields from the data,
As the data coming in JSON format here hence the response type will be given as JSON. If the response from the API is in XML format then response type would be CUSTOM_XML.
STEP 3:
Posting to Client API.
URL: http://182.76.227.190:8010/sap/opu/odata/sap/ZB_PRIMARY_SALES_RETURN_SRV/SOHeaders
We post data fetched from the Bizom API to client API using the rest adaptor by writing freemarker code in request template.
Here Bizom 's API step is given as parent ID because after posting one record it goes back to the parent step to fetch another record.
Response type is based on response from the Client API after posting the data. Here it is CUSTOM_XML.
UPDATE_SUCCESS_COUNT, so that the number of success records is updated in the Job run screen.
STEP_SEARCH_CRITERIA, this is configured so that we can find any particular record in Step history by giving the key field in request search criteria of step history.
The username and password is given for the authentication purpose, as it is applicable for this API.
CLIENT TO BIZOM
INTERFACE NAME: PrimarySales_OEL_API_To_Bizom_API_Prod
STEP 1:
Post the bizom access token API using REST adapter
By using the provided credentials, we will hit the bizom token API and generate token.
API: https://api.bizom.in/oauth/directLogin/xml
REQUEST:
<User>
<username>orientintegration</username>
<Password>kucDJ{5EHL></Password>
</User>
STEP 2:
This step is used to fetch the data from client’s SAP API.
URL: http://182.76.227.190:8010/sap/opu/odata/sap/ZB_PRIMARY_SALES_SRV/Primary_SalesSet?$filter=ChangedOnFrom eq (datetime'${lastScheduledStartTime?date}T${lastScheduledStartTime?time}') and ChangedOnTo eq (datetime'${nextRunTime?date}T${nextRunTime?time}')&$format=json
PARAMETER
VALUES
Filter
This is customized to take the time range between last scheduled start date and time and next run time’s date and time, and fetches data for that particular period. It works as a pagination for this API.
Format
It Specifies the format in which we are getting the data
We get all the data present in the given time range when we hit API using the Rest Adaptor.
We need to code the response formatter to fetch the required fields from the data is coming
As the data coming in JSON format hence the response type will be given as JSON.
STEP 3:
Post data to Bizom API
URL: http15s://api.bizom.in/payments/addprimarysale?access_token=${configs['0'].values['1']['Token']}
After fetching data from the client API, we have to post to Bizom post API.
Get the token from first step
Here we give the request in XML/JSON format in request template. with freemarker, the data fetched is changed in required format to post
characters coming in data must be handled in the Response formatter itself as we are sending request in XML format, Bizom API will throw a error.
We need to configure success key and success Value based on the response of the API, in Bizom API we get the response in JSON format, the value coming in result field is used as success key and value, in the below example if the result is 0 means failure and 1 means success. Hence success key will be 1 here. If there is no result flag in the response it might throw null pointer exception error in OIP.
SAMPLE RESPONSE:
SUCCESS:
{"Result":"1","Reason":"","schemeBudgetAlert":"0","data":{"printerType":"regular","invoiceid":"3204048601","paymentId":"266757"}}
FAILURE:
{"Result":"0","Reason":"ERP SKU Code 5003602 does not exist. \n"}
UPDATE_SUCCESS_COUNT, so that number of success records is updated in Job run Screen.
STEP_SEARCH_CRITERIA, this is configured so that we can find any particular record in Step history by giving the key field in request search criteria of step history.
Last updated