1 of 20

DESIGN AND IMPLEMENT OF REST API FOR DATA INTEGRATION

Prepared by: Mohd Kamir Yusof

2 of 20

DATA INTEGRATION

Data integration to combine data residing at different sources, and to provide the user with a unified view of these data

3 of 20

DATA INTEGRATION MODEL

Data Integration System

Unified View

Figure 1. Data Integration Model

4 of 20

EXISTING MODEL

Relational Database Model [4],

Resource Description Framework [5],

Object Exchange Model [6],

Extensible Markup Language (XML)[7- 8],

Native XML [9],

XML- Enables [10],

Hybrid XML [11]

JavaScript Object Notation (JSON)

5 of 20

PROBLEM?

  • Less practical - data integration - two different system using different platform or programming language
  • Any solution?

6 of 20

REST API

  • Application programming interface that conforms to the constraints of REST architecture.
  • Replace a Simple Object Access Protocol (SOAP) or Remote Procedure Call (RPC)
  • Used by Google, Facebook and Twitter

7 of 20

DATA REPRESENTATION

Use JSON (JavaScript Object Notation) data

{

"name":"John", "age":30, "car":null

}

8 of 20

METHODOLOGY

REST API has been developed to allow other system/application send/receive data to another system/application

System A

System B

REST API

Data source

Data source

9 of 20

METHODOLOGY…

Steps

Extract Data

Send Data

Received and Dump Data

10 of 20

EXTRACT DATA

Data from database will be extract and convert into JSON format.

Definition 1:

Assume B represent dataset of JSON format, B = {D1, D2, D3, Dn} where D1 until Dn is element of B.

Definition 2:

Assume C represent dataset of D, C = {a1, a2, a3, an} where a1 until an is element of C.

11 of 20

SEND DATA

Input: Data in JSON format, B

Process:

Step 1: Assign a new end point of URL, EP Step 2: Map R = B → EP

Step 3: Response message from EP

Output: Response message (MSG) and set of JSON data (R)

Figure 2. Send data using REST API algorithm

12 of 20

RECEIVED & DUMP DATA

Input: R and MSG

Process:

Step 1: Fetch the data in JSON format, R

Step 2: Explode the data in array format

Step 3: Assign data to item set, I = {data1, data2, datan}

Step 4: Dump I into database

Step 5: Repeat Step 1 until Step 5

Step 6: Assign MSG equal to S if success (S) Else assign MSG equal to fail (F)

Step 7: Response message to SAP system

Output: MSG

Figure 3. Send data using REST API algorithm

13 of 20

IMPLEMENTATION

Communication between SAP and FEMS via REST API

SAP

FEMS

REST API

Data source

Data source

14 of 20

EXTRACT DATA…

Extract Data:-

Data from SAP will be extracted and convert into JSON format

B = {Purchase Order, Sales Order, …}

Purchase Order = {EBLEN, LIFNR, BEDAT, ….}

Sales Order = {VBELN, KUNNR, BSTD_E, …}

15 of 20

JSON FORMAT

16 of 20

SEND DATA

  • JSON will transfer to FEMS system by declaration of end point (specified URL).
  • Let end point (EP) of URL in FEMS system is https://myfems.net/get-data.php.
  • Assign data in JSON format, R = B → EP.
  • Then data set of data, R will be transferred automatically to end point of FEMS system

17 of 20

RECEIVED & DUMP DATA

18 of 20

RESULT

Response time

Data (MB)

Purchase Order

Response Time (Seconds)

CPU Usage (%)

200

0.200

10

300

0.231

12

400

0.345

13

500

0.401

15

19 of 20

RESULT

Response time

Data (MB)

Sales Order

Response Time (Milliseconds)

CPU Usage (%)

200

0.250

9

300

0.351

11

400

0.445

14

500

0.512

16

20 of 20

CONCLUSION

  • REST API is one the alternative solution can be used to data exchange between two different system using different platform.
  • In future work, this research will extend to compared with another REST API using different data format such as XML, TEXT, etc.