ConneX_Help.pdf - 第39页

6. Af te r c raf tin g and p e rfe c ti ng your que ri e s as d esi re d, paste them i nto y ou r manuf a c turi ng ex e c uti o n syst e m (MES ) o r othe r ap p l i c ati o n and t e st t he que ri e s aga i n f rom th…

100%1 / 86
API Overview
ConneX provides API hooks using the following standards:
GraphQL
MQTT
GraphQL
ConneX provides a GraphQL endpoint for querying data.
What is GraphQL?
GraphQL is a query language for APIs and a runtime for fulfilling those queries with your existing
data. GraphQL provides a complete and understandable description of the data in your API, gives
clients the power to ask for exactly what they need and nothing more, makes it easier to evolve APIs
over time, and enables powerful developer tools.
Source: https://graphql.org/
To get started with GraphQL in ConneX, expand GraphQL (in the left navigation pane) and review the available types of data fields you can
retrieve from the GraphQL API in ConneX. Then create a list of desired fields and begin to construct queries to retrieve them from ConneX.
To test your queries:
1. Visit http://localhost:5001/graphql from the ConneX Server.
2. Paste your query in the left pane, and then click Run.
3. Review the query results/output in the right pane. For example:
4. For help on modifying your queries, click the Operations drop-down arrow (near the top-left corner) to access the Schema
Reference and Definition.
5. Similarly, click the Response drop-down arrow (in the right pane) for more information about how ConneX processed the query.
connexion:5001»graphql
u
®
0
untitled
1
+
Execute
1
7
query
{
1
2
\z
entities
{
3
entityidentifier
4
entityType
5
entityName
6
}
7
}
2
Variables
HTTP
Headers
Response
200
11
ms
9.44
KB
duration
size
1
v
2
v
3
v
4
v
5
10
11
12
13
14
v
15
16
17
18
19
v
•data":
{
"entities":
[
I
{
"entityldentifier"
:
-001-035-032-071-024-126-008-211-238",
-entityType":
"ADAPTER",
"entityName"
:
null
},
{
•entityldentifier":
"0Ol-035-037-062-024-126-O08-211-238M
,
•entityType":
"ADAPTER"
f
"entityName"
:
null
(J
-entityldentifier"
:
"001-035-081-056-024-126-008-211-238",
-entityType"
:
"ADAPTER"
,
-entityName":
null
},
{
•■■TKad;
al
.AAA
1
Responses
0
query
0
query
15:1(^22241
49
ms
15:10^5448
11
ms
connexion:5001f'graphql
0
3)
Operations
Schema
Reference
Schema
Definition
.
©5
{
3
entityidentifier
4
entityType
5
entityName
6
}
7
}
6. After crafting and perfecting your queries as desired, paste them into your manufacturing execution system (MES) or other
application and test the queries again from there.
MQTT
ConneX provides an MQTT broker that your MES (or other data processing application) can subscribe to.
What is MQTT?
MQTT is a lightweight, publish-subscribe network protocol that transports messages between
devices. The protocol usually runs over TCP/IP, however, any network protocol that provides ordered,
lossless, bi-directional connections can support MQTT. It is designed for connections with remote
locations where a resource constraints exist or the network bandwidth is limited. The protocol is an
open OASIS standard and an ISO recommendation (ISO/IEC 20922).
Source: https://en.wikipedia.org/wiki/MQTT
To get started with MQTT in ConneX, expand MQTT (in the left navigation pane) and review the available types of event notifications to
which you can subscribe from the MQTT API in ConneX. Then create a list of desired events and begin to construct queries to receive them
from ConneX.
To test your queries:
1. Install MQTT Explorer and launch it.
2. Add a new connection by specifying the appropriate host settings, then click Connect. For example:
D
untitled
1
+
Response
f
Hi
0
Operations
Transport
Request
Body
3)
Transport
Details
[
xz
Transport
Error
Logs
I
}
Responses
MQTT
Connection
mqtt://localhost:1883/
Name
new
connection
Validate
certificate
Encryption
(tls)
2
Protocol
Host
Port
mqtt://
localhost
1883
Username
Password
3
DELETE
jj
0SAVE
ADVANCED
1
2
3
4
5
6
7
connexion:500t'graphql
11
ms
duration
.
200
status
7
8
9
v
new
connection
mqtt.//localhost1883/
9.44
KB
size
0
叵]
query
0
叵)
query
15:10:25448
11
ms
15:10:22.241
49
ms
tyldentifier"
:
"001-035-032-071-024-126-008-211-238",
tyType":
"ADAPTER"
,
:
null
},
Connections
[
Execute
query
{
entities
{
entityldentifi
entityType
entityName
0
CONNECT
3. In the left pane treeview, navigate to the desired event.
4. In the right pane, scroll down to the Publish section, and confirm/modify the event query in the Topic box. For example:
5. Select a desired output format (raw, xml, or json) and click Publish to run the event query.
6. Review the query results/output in the right pane.
7. After crafting and perfecting your queries as desired, paste them into your manufacturing execution system (MES) or other
application and test the queries again from there.
X
@
MQTT
Explorer
Value
History
04/26/2023
3.45
20
PM
Publish
2
Topic
connex/programmer/currentprogrammerstatuses
x
raw
3
o o
Application
Edit
View
MQTT
Explorer
DISCONNECT
0
A
PUBLISH
QoS:
0
04/26/2023
3:45:20
PM
xml
json
connexion
connex
programmer
currentprogrammerstatuses