0% found this document useful (0 votes)
28 views

Design and Implement of REST API for Data Integration

jurnal dai

Uploaded by

nurisni nirwan
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views

Design and Implement of REST API for Data Integration

jurnal dai

Uploaded by

nurisni nirwan
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Proc.

of the 8th International Conference on Engineering and Emerging Technologies


(ICEET) 27-28 October 2022, Kuala Lumpur, Malaysia

Design and Implement of REST API for Data


Integration
Mohd Kamir Yusof Mustafa Man Azli Ismail
Faculty of Informatics & Computing Faculty of Ocean Engineering Lieos SDN BHD
Universiti Sultan Zainal Abidin Technology and Informatics Lot 37744 Tingkat 1, Wisma Dataran
22200 Besut, Terengganu, Universiti Malaysia Terengganu Rimba Square, 21300 Kuala Nerus,
Malaysia 21030 Kuala Nerus, Terengganu, Terengganu, Malaysia
2022 International Conference on Engineering and Emerging Technologies (ICEET) | 978-1-6654-9106-8/22/$31.00 ©2022 IEEE | DOI: 10.1109/ICEET56468.2022.10007414

[email protected] Malaysia [email protected]


[email protected]

Abstract— Data integration is currently most important to (RPC) [13 - 14]. Most of major websites such as Google,
organization to integrate data from different data sources using Facebook and Twitter have been moved to REST services
different platform or programming languages. A suitable because of easy to provide valuable resources [13].
approach is required to allow one system send the data to
another system using standard data format. REST API is one Section II will be described the definition about REST
approach can used for data integration using JSON format. API. Then, the methodology of proposed REST API will
Three processes are involved in this approach. There are explain detail in Section III. Meanwhile, Section IV will
extract data, send data, received and dump data. In this discuss about the implementation and result, and finally
approach, SAP system willbe sending the data in JSON to FEMS conclusion and future will be discussed in Section V.
system. FEMS system will be exploded and dump the data into
database FEMS. Based the experiment, the result indicates, II. REST API
REST API is successfully implemented by showing less The REST architecture was introduced in the year 2000,
response time and CPU usage during sending and receiving the by Thomas Fielding, and is based on the principles that
data in JSON format.
support the World Wide Web [15]. According to the REST
Keywords—REST API, DATA INTEGRATION, JSON principles [15], REST interfaces rely exclusively on Uniform
Resource Identifiers (URI) for resource detection and
I. INTRODUCTION interaction, and usually on the Hypertext Trans- fer Protocol
The problem in data integration to combine data residing (HTTP) for message transfer [16], [17], [18].
at different sources, and to provide the user with a unified view REST (Representational state transfer) is an architectural
of these data [1-3]. The problem of designing data integration API (Application Programming Interface) which provides
system is important especially for current real-world client-server communications for Web Applications over
applications. Fig. 1 shows the data integration system model HTTP protocol, making it easily implemented since it is not
to extract data from different data sources to produce a unified bound to any transfer protocol. The three main design
view. Once a unified has been establish, any principles of REST are addressability, uniform interface, and
systems/applications can access and view the data. statelessness [19]. REST addresses acceptability by defining
endpoints in a directory structure [20] via different URI for
Data sources extracting the data. The API works on the principle of CRUD
Data (Create, Read, Update, Delete), which correspond to the most
Unified popular functions [19] INSERT, SELECT, UPDATE, and
Integration
System View DELETE, in persistent data-storages such as SQL. Calling a
RESTful service over the HTTP protocol can be done in
multiple programming languages.
Fig. 1: Data integration model In jQuery, a framework of JavaScript, a REST server can
be called from an Ajax query. A common response of data is
Based on the previous research, a few data integration in the form of JSON (Javascript Object Notation) data.
model has been implemented such as Relational Database Typical JSON response can be seen in Fig. 1. Data can be
Model [4], Resource Description Framework [5], Object returned as well in the form of XML (eXtensible Markup
Exchange Model [6], Extensible Markup Language (XML)[7- Language).
8], Native XML [9], XML- Enables [10], Hybrid XML [11]
and JavaScript Object Notation (JSON) [12].
{
However, this approach is less practical to implement for "name":"John",
data integration between two different system using different "age":30,
platform or programming language. This paper proposed a "car":null
new alternative data integration using REST API. }
Currently, the number of services provides by a web Fig. 1: Examples of JSON response
Application Programming Interfaces (APIs) is not growing
rapidly because of organization demand [13]. Based on the
previous study, most of developers used Representational
State Transfer (REST) web services to replace a Simple
Object Access Protocol (SOAP) or Remote Procedure Call

978-1-6654-9106–8/22/$31.00 ©2022 IEEE


Authorized licensed use limited to: Universitas Indonesia. Downloaded on September 15,2024 at 15:07:37 UTC from IEEE Xplore. Restrictions apply.
III. METHODOLOGY C. Received and Dump Data
In this section, REST API has been developed to allow Fig. 4 show the algorithm where system B received data from
other system/application send/receive data to another system A.
system/application. Based on Fig. 2, two system will be
integrate using REST API. The purpose of REST API is to Input: R and MSG
send and receive data using JSON format. Assume A represent Process:
dataset of application, A = {S1, S2, Sn} where S1 until Sn is an Step 1: Fetch the data in JSON format, R
element of A. Three (3) main processes involved; there are Step 2: Explode the data in array format
data extraction, send data, receive data, and dump the data. 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)
System REST System Step 7: Response message to SAP system
A API B Output: MSG
Fig. 4: Receive and dump data using REST API algorithm

IV. IMPLEMENTATION AND RESULT


This section will be explained the implementation of REST
API for data integration to send and receive data from one to
Data sources Data sources another application. Fig. 5 represent how SAP system
communicate with FEMS system. In this figure, SAP will
Fig. 2: Data integration model send a data to FEMS system using REST API.
A. Extract Data
In this phase, data from database will be extract and convert REST
into JSON format. SAP FEMS
API

Definition 1: Fig. 5: Data integration model


Assume B represent dataset of JSON format, B = {D1, D2, D3,
A. Extract Data
Dn} where D1 until Dn is element of B.
This section shows how the data from SAP will be extracted
Definition 2: and convert into JSON format.
Assume C represent dataset of D, C = {a1, a2, a3, an} where a1 B = {Purchase Order, Sales Order, …}
until an is element of C.
Purchase Order = {EBLEN, LIFNR, BEDAT, ….}

B. Send Data Sales Order = {VBELN, KUNNR, BSTD_E, …}


Fig. 3 shows the algorithm to send a data from system A to Meanwhile, Fig. 6 and Fig. 7 show the sample data in JSON
system B. format has been extracted from database SAP, then this data
will be transferred to FEMS system.
{
Input: Data in JSON format, B "PurchaseOrder": [
{
Process: "EBELN": 4400019951,
Step 1: Assign a new end point of URL, EP "LIFNR": 100006334,
Step 2: Map R = B → EP "LIFNR_NAME": "ASTRA SIMFONI SDN BHD",
Step 3: Response message from EP "BEDAT": 20220223,
Output: Response message (MSG) and set of JSON data "UNSEZ": "Test2302-1",
(R) "WAERS": "RM",
"Items": [
Fig. 3: Send data using REST API algorithm {
"EBELP": "00010",
"MATNR": 95000093,
"MAKTX": "9 KG ABC DRY POWDER",
"MENGE": "10.000 ",
"MEINS": "UN",
"WERKS": 6600,
"WERKS_NAME": "FGV Security Services Sdn. B",
"NETPR": "790.00 "
},
{
"EBELP": "00020",
"MATNR": 95000120,
"MAKTX": "4 KG ABC DRY POWDER",

Authorized licensed use limited to: Universitas Indonesia. Downloaded on September 15,2024 at 15:07:37 UTC from IEEE Xplore. Restrictions apply.
"MENGE": "5.000 ", $myObj->Type = "S";
"MEINS": "UN", $myObj->Message = "Purchase data has been saved";
"WERKS": 6600, $response->Response = $myObj;
"WERKS_NAME": "FGV Security Services Sdn. B",
"NETPR": "350.00 " }
},
:
else {
: // sql statement insert record
Fig. 6: Purchase Order Data $data_array['Id']="".$list['EBELN']."";
$data_array['Type']="S";
$data_array['Message']="Sales data has been saved";
{ }
"SalesOrder": [ }
{ Fig. 8: Purchase Order Data
"VBELN": "26000003",
"KUNNR": "6700",
Meanwhile, Fig. 9 and Fig. 10 represent structured data after
"BSTKD_E": "",
"VKBUR": "6600", exploding and dump process in JSON format from SAP
"VKBUR_BEZ": "", system.
"ITEMS": [{
"POSNR": "000001",
"MATNR": "95000093",
"ARKTX": "9 KG ABC DRY POWDER",
"WERKS": "6619",
"WERKS_NAME":
"FGVSSSB- Pasir Gudang",
"KWMENG": "1.000", Fig. 9: Purchase Order Data
"VRKME": "UN",
"WAERK": "RM",
"NETWR": "10.00",
"MWSBP": "0.00"
}],
"CUSTOMER": {
"NAME": "FGV Prodata Systems Sdn Bhd",
"STREET": "LEVEL 19 EAST, WISMA FGV",
"STR_SUPPL1": "JALAN RAJA LAUT",
"STR_SUPPL2": "",
"STR_SUPPL3": "",
"POST_CODE1": "50350",
"CITY1": "Kuala Lumpur",
"BEZEI": "", Fig. 10: Purchase Order Data
"TEL_NUMBER": "03-27890900"
} Based on these experiments, REST API is successfully
}, implemented by sending and receiving the data from two
: different systems using different platform and programming
:
Fig. 7: Purchase Order Data language. TABLE I and TABLE II represent the performance
of response time and CPU usage for sending and receiving
B. Send Data data from SAP to FEMS system. Based on TABLE I and
This section shows how the data in JSON will transferred to TABLE II, the result indicate performance of response time
FEMS system by declaration of end point (specified URL). and CPU is consistent increase according to size of data.
Let end point (EP) of URL in FEMS system is
https://myfems.net/get-data.php. Assign data in JSON TABLE I. RESPONSE TIME (SEND AND RECEIVED DATA -PURCHASE
ORDER)
format, R = B → EP. Then data set of data, R will be
transferred automatically to end point of FEMS system. Purchase Order
Data (MB)
Response Time (Seconds) CPU Usage (%)
C. Received and Dump data
200 0.200 10
This section shows how the data in JSON will be exploded 300 0.231 12
and transferred into database of FEMS system. Fig. 8
400 0.345 13
represent code segment which is represent how the data in
500 0.401 15
JSON will exploded and transferred into FEMS database.
TABLE II. RESPONSE TIME (SEND AND RECEIVED DATA -SALES
$json_array = json_decode($data,true); ORDER)
foreach($json_array as $key => $arrays){
if ($key=='PurchaseOrder') {
// sql statement insert record
$myObj->Id = "".$elem['EBELN']."";

Authorized licensed use limited to: Universitas Indonesia. Downloaded on September 15,2024 at 15:07:37 UTC from IEEE Xplore. Restrictions apply.
Sales Order [8] Balamurugan, S., & Ayyasamy, A. (2017). Performance evaluation of
Data (MB) native XML database and XML enable database. International Journal
Response Time (Milliseconds) CPU Usage (%) of Advanced Research in Computer Science and Software Engineering.
200 0.250 9 Vol. 7, Issue 5.
300 0.351 11 [9] Saba, A. M., Shahab, E., Abdolrahimpour, H., Hakimi, M., Moazzam,
400 0.445 14 A. (2017). A comparative analysis of XML documents, XML enabled
databases and native XML databases. Computer Science: Databases.
500 0.512 16
[10] Lazetic, G. M. P. (2007). Native XML Databases vs. Relational
Databases in Dealing with XML Documents. Kragujevac J. Math. Vol
30, pp: 181 – 199.
V. CONCLUSION AND FUTURE WORK [11] Liru, Z., Tadashi, O., Mamoru, H. (2008). Keyword search over Hybrid
Data integration is one of the most important to organizations XML- Relational Databases. SICE Annual Conference, Aug 20 – 22,
2008.
to exchange the data between one to another system. REST
[12] Haw, S. C., & Lee, C. S., (2014). “Efficient Preprocesses for Fast
API is one the alternative solution can be used to data Storage and Query Retrieval in Native XML Database”. IETE
exchange between two different system using different Technical Review, vol. 26, issue. 1, pp. 28 – 40.
platform. This solution is hopefully can help most of the [13] M. Maleshkova, C. Pedrinaci, and J. Domingue, “Investigating Web
organization to implement data integration. In future work, APIs on the World Wide Web,” in 2010 Eighth IEEE Euro- pean
this research will extend to compared with another REST API Conference on Web Services, 2010, pp. 107–114.
using different data format such as XML, TEXT, etc. [14] J. Kopecky, P. Fremantle, and R. Boakes, “A history and future of Web
APIs,” It - Inf. Technol., vol. 56, 2014.
ACKNOWLEDGMENT [15] R. T. Fielding, “Architectural Styles and the Design of Network- based
Software Architectures,” Univ. of California, Irvine, 2000.
The authors are greatly acknowledged to the research grants
[16] F. Bulthoff and M. Maleshkova, “RESTful or RESTless – Current State
of FRGS Grant (FRGS/1/2020/ICT06/UNISZA/03/2). of Today’s Top Web APIs,” in The Semantic Web: ESWC 2014
Satellite Events, 2014, pp. 64–74.
REFERENCES
[17] R. Battle and E. Benson, “Bridging the semantic Web and Web 2.0
[1] A. Y. Halevy. Answering queries using views: A survey. Very Large with Representational State Transfer (REST),” Web Semant. Sci. Serv.
Database J., 10(4):270–294, 2001. Agents World Wide Web, vol. 6, no. 1, pp. 61–69, Feb. 2008.
[2] R. Hull. Managing semantic heterogeneity in databases: A theoretical [18] B. Costa, P. F. Pires, F. C. Delicato, and P. Merson, “Evaluating a
perspective. In Proc. of the 16th ACM SIGACT SIGMOD SIGART Representational State Transfer (REST) Architecture: What is the
Symp. on Principles of Database Systems (PODS’97), 1997. Impact of REST in My Architecture?,” in 2014 IEEE/IFIP Confer-
[3] A. Y. Levy and M.-C. Rousset. CARIN: A represen- tation language ence on Software Architecture, 2014, pp. 105–114.
combining Horn rules and description logics. In Proc. of the 12th Eur. [19] Belqasmi, F., Singh, J., Melhem, S.Y.B., Glitho, R.H., “SOAP-Based
Conf. on Artificial In- telligence (ECAI’96), pages 323–327, 1996. vs. RESTful Web Services: A Case Study for Multimedia”,
[4] Lee, K. K. Y., Tang, W. C., Choi, K. S. (2013). “Alternatives to Conferencing IEEE Internet Comput. Volume: 16 Issue: 4, pp. 54–63,
relational database: Comparison of NoSQL and XML approaches for 2012, doi: 10.1109/MIC.2012.62
clinical data storage.” Computer Method and Programs in [20] Choi M. 2012, “A Performance Analysis of RESTful Open API
Biomedicine, Vol. 110, No. 1, pp. 99 - 109. Information System Future Generation Information Technology”,
[5] Sakr, S., & Naymat, G. A. (2009). Relational Processing of RDF FGIT'12: Proceedings of the 4th international conference on Future
Queries: A Survey. ACM Sigmod Record, Vol. 38, No. 4, pp: 23 – 28. Generation Information Technology, pp. 59–64, doi:
[6] Suciu, D. (2001). Semistructured data and XML. Book: Information doi.org/10.1007/978-3-642-35585-1_8
Organization and Databases: Foundations of Data Organizations. pp: 9
– 30.
[7] Papaleo, L. (2013). Introduction to XML and its applications. Research
in Semantic Web Technologies, pp: 1 – 32

Authorized licensed use limited to: Universitas Indonesia. Downloaded on September 15,2024 at 15:07:37 UTC from IEEE Xplore. Restrictions apply.

You might also like