Работа с модулями ввода/вывода ioLogik с помощью RESTful API


Чтобы посмотреть этот PDF файл с форматированием и разметкой, скачайте его и откройте на своем компьютере.
Copyright
20
Moxa
Inc.
Released on
June
13
, 20
About M
Moxa is a leading
provider
of
edge connectivity,
industrial networking, and
network
infrastructure
solutions
for enabling connectivity for the Industrial Internet of Things
. With
over
worldwide and has a distribution and service network that reaches customers in more than
70 countri
es. Moxa delivers lasting business value by empowering industry with reliable
networks and sincere service for
industrial communications
infrastructures
. Information
about Moxa’s solutions is available at
How to Contact M
oxa
Tel:
+886
8919
1230
Fax:
+886
8919
1231
Using a RESTful API to Connect
to Remote I/Os
Moxa Technical Support Team
[email protected]
oxa
Tech
Note
Using a RESTful API to
Connect to Remote I/Os
Copyright
Moxa
Inc.
Page
of
1.
Introduction
he latest firmware version
of
ioLogik E1200 series
products
support
RESTful API protocol. In
this
tech
note, we explain what
a
RESTful API is, why using
a
RESTful API is easy for web service
development
and
show
how to implement
RES
Tful API for IIoT applications.
RESTful API function
ality
can only be implemented
the
latest
firmware and utility versions
have
been installed on your ioLogik E1200 product
. Refer to the information listed below for details
Firmware
Logik E1210 V2.5 (std. version)
ioLogik E1211 V2.4 (std. version)
ioLogik E1212 V2.5 (std. version)
ioLog
ik E1213 V2.6 (std. version)
ioLogik E1214 V2.5 (std. version)
ioLogik E1240 V2.4 (std. version)
ioLogik E1241 V2.5 (std. version)
ioLogik E1242 V2.5 (std. version)
ioLogik E1260 V2.5 (std. version)
ioLogik E1262 V2.5 (std. version)
Utility
ioSearch V1.15
(std. version)
2.
What is
RESTful API?
REST
ful API is an API
that is
based on REST (
REpresentational State Transfer
) principles. A
RESTful API
provides
programmers
with convenient programming functions for trans
mitt
ing dat
oxa
Tech
Note
Using a RESTful API to
Connect to Remote I/Os
Copyright
Moxa
Inc.
Page
of
RESTful API
can be used to
turn
an
ioLogik E1200 series
product
into an IoT device. Users
will
be able to
monitor production line
, check machine status
and receive active alarm messages
quickly
anytime, anywhere. Furthermore,
it is easy to connect
ioLogik E1200 series
products
the
Microsoft Azure cloud
with the a
id of
Moxa
MX
AOPC UA
erver and MX
AOPC UA
ogger.
RESTful API can reduc
the need for
specialized
gateway
hardware
, protocol converters
and
middleware.
Not only are RESTful APIs
easy for IT experts
to use
since they are
already
familiar
with HTTP
ESTful APIs
also
be used by automation engineers, who are generally more
familiar with OT protocols. From the automation engineer
s point of view, RESTful APIs are an
ideal tool for
connect
ing
legacy industrial devices to the Internet.
4.
Using
RESTful
API
with
Remote I/O
devices
How to use
RESTful API
with remote I/O devices
Since RESTful API
are based on
HTTP,
they are
highly compatible with
vari
ety of
programming
languages (
including
and
JavaScript)
Consequently, you
t need to learn a new
programming language to communicate with
Moxa
ioLogik E1200 products
The
RESTful API
GET
method
makes
it eas
for IT professionals to get data
and
the PUT
method
allows you to
easily
change
the configuration and/or
status
of you
r devices
The following examples
give step
step instructions on
how
to use a
web service or Postman
to
PUT and GET data.
Using RESTful API v
ia
eb service
The example uses the Windows 7 OS, with the server configured as follows:
Note.js: v5.3.0
Expres
s: v4
15.0
The following flowchart
illustrate
how
only
four
steps are needed to implement the GET and PUT
oxa
Tech
Note
Using a RESTful API to
Connect to Remote I/Os
Copyright
Moxa
Inc.
Page
of
oxa
Tech
Note
Using a RESTful API to
Connect to Remote I/Os
Copyright
Moxa
Inc.
Page
of
Note:
When sending requests, headers should be included
to ensure that the RESTful
API is implemented
successfully
. Headers should include the following
information:
� Accept: vdn.dac.v1
� Content
Type: application/json
Send JSON file: The ioLogik E1200 sends a response to the server in JSON format.
Parse
JSON file: The content is parsed and saved by the server.
oxa
Tech
Note
Using a RESTful API to
Connect to Remote I/Os
Copyright
Moxa
Inc.
Page
of
Show value: The information can be displayed in various interfaces. Here, we take a web
browser as an example:
GET: Show current I/O status
PUT: The counter status will be changed from STOP
to START.
oxa
Tech
Note
Using a RESTful API to
Connect to Remote I/Os
Copyright
Moxa
Inc.
Page
of
Using RESTful API v
ia Postman
s an a
lternative, test tool
offer another
easier solution. Postman
for
example
is an
application that helps users build, test, and document APIs. Step
step procedures
on how to
Postman are
described
below
Introduction
to Postman
In th
example
illustrated
below
Postman is the master and the ioLogik E1200 is the slave.
We
first
explain how to set up Postman, and the
explain how to deploy GET and PUT methods to get
data
from,
and change data in
the ioLogik E1200.
How to set up Postman
irst
check the
type of
data your product
is transmitting
(e.g., DI, relay, or RTD).
Refer to Chapter 3
of the
ioLogik E1200 series user
s manual to enable
the
RESTful API.
Open Postman, and use the tabs near the top to create a
GET example
and
PUT example
Postman
IP address
192.168.127.100
Moxa ioLogik E1200 series
IP address
192.168.127.254
oxa
Tech
Note
Using a RESTful API to
Connect to Remote I/Os
Copyright
Moxa
Inc.
Page
of
Click
Headers
on the menu bar and
then
create the
following
content:
Content
Type: application/json
Accept: vdn.dac.v1
Note:
hen typing commands (e.g., headers)
keep in mind that
the
commands are
sensitive.


oxa
Tech
Note
Using a RESTful API to
Connect to Remote I/Os
Copyright
Moxa
Inc.
Page
of
How to deploy GET and PUT methods
with
the ioLogik E1200
Refer to
ppendi
of the
E1200 series user's manual: RESTful API Default Address
Mappings
for API map details.
The
oxa
Tech
Note
Using a RESTful API to
Connect to Remote I/Os
Copyright
Moxa
Inc.
Page
of
To use the PUT method, first locate the
Body
tag and select
raw
to edit the contents. The
format is the same as
for
the GET results.
Note:
You must perform a GET first before performing a PUT.
Click
Send
. You should see the status code, response time, and results.
oxa
Tech
Note
Using a RESTful API to
Connect to Remote I/Os
Copyright
Moxa
Inc.
Page
of
Troubleshooting reference
The
ioLogik E1200 series
supports
various combinations of I/O points. To get detailed
data
structure
information for troubleshooting
purposes
use the
ioSearch ut
ility’
built
in
help
tool
Path:
Help
椀漀匀攀愀爀挀栀⁈攀氀瀠
刀䕓吀昀甀氀⁁倀䤀
椀漀䰀漀最椀欠䔀ㄲ〰⁒䔀匀吀昀甀氀⁁倀䤀

help file
includes
information
related to
5.
oxa
Tech
Note
Using a RESTful API to
Connect to Remote I/Os
Copyright
Moxa
Inc.
Page
of
MQTT requires a higher degree of complexity
compared with a RESTful API implementation.
RESTful API system structure
MQTT system structure
oxa
Tech
Note
Using a RESTful API to
Connect to Remote I/Os
Copyright
Moxa
Inc.
Page
of
6.
Conclusion
Currently, a number of
different protocols
are available for implementing
IIoT
applications
However,
efore
implementing your own
IIoT
application
research the various protocols to


Приложенные файлы

  • pdf 3571090
    Размер файла: 699 kB Загрузок: 0

Добавить комментарий