forked from zack9433/generic-bundle-api-doc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapiary.apib
1853 lines (1369 loc) · 49.6 KB
/
apiary.apib
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
FORMAT: 1A
HOST: http://www.google.com
# MXcloud Generic
Notes API is a *short texts saving* service similar to its physical paper presence on your table.
# Group Cellular
Notes related resources of the **Cellular API**
## Cellular Collection [/network/cellulars]
### List all Cellular Configurations [GET]
The Collection response has following attributes:
+ Response 200 (application/json)
[
{
"id": 1,
"name": "wwan1",
"mode": "umts",
"signal": -96,
"operatorName": "Chunghwa Telecom",
"iccId": "",
"imei": "356853050370859",
"connected": true,
"ip": "111.70.146.125",
"netmask": "255.255.255.252",
"gateway": "111.70.146.126",
"dns": ["168.95.1.1" , "168.95.192.1"],
"usage": {
"txkbyte": 40023,
"rxkbyte": 3493
},
"enable": true,
"apn": "internet",
"pinCode": "0000",
"keepalive":
{
"enable": true,
"targetHost": "8.8.8.8",
"intervalSec": 60
}
}
]
## Cellular [/network/cellulars/{id}]
A single Cellular object with all its details
+ Parameters
+ id (required, number, `1`) ... Numeric `id` of the Cellular to perform action with. Has example value.
### Retrieve an Cellular [GET]
The response for GET has following attributes:
- **id** (number, `1`): Identifier for an Cellular interface.
- **name** (string, `wwan0`): Interface name.
- **mode** (string, `umts`): Given cellular connection mode. Could be one of `"umts"`, `"lte"`.
- **signal** (number, `-99`): Cellular RF signal strength, in `dbm`. Value `0` indicates no SIM card found.
- **operatorName** (string, ``): Indicate current operator name if exist.
- **iccId** (string, `""`): ICC ID of SIM card.
- **imei** (string, `"356853050370859"`): IMEI of cellular module.
- **connected** (boolean, `true`): Indicate current status of connection.
- **ip** (IP address, `111.70.146.125`): IP address. `""` when not connected.
- **netmask** (IP address, `255.255.255.252`): Subnet mask. `""` when not connected.
- **gateway** (IP address, `192.168.3.254`): Gateway IP address. `""` when not connected.
- **dns** (IP address array): A list of DNS IP addresses. `[]` when not connected.
- **usage** (object): Data usage.
- **txkbyte**(number, `40023`): Amount of data transmitted, in Kbytes.
- **rxkbyte**(number, `3493`): Amount of data received, in Kbytes.
- **enable** (boolean, `true`): Enable Cellular Networking.
- **apn** (string, `internet`): APN used when dialing up to Cellular Network.
- **pinCode** (string, `0000`): PIN code of SIM card. Takes no effect when SIM card PIN weren't not set.
- **keepalive** (object): Keep-alive configuration.
- **enable** (boolean, `true`): Enable/disable Cellular connection keep-alive by ping.
- **targetHost** (string, `8.8.8.8`): IP address to ping.
- **intervalSec** (number, `60`): Check alive interval.
+ Response 200 (application/json; charset=utf-8)
{
"id": 1,
"name": "wwan1",
"mode": "umts",
"signal": -96,
"operatorName": "Chunghwa Telecom",
"iccId": "",
"imei": "356853050370859",
"connected": true,
"ip": "111.70.146.125",
"netmask": "255.255.255.252",
"gateway": "111.70.146.126",
"dns": ["168.95.1.1" , "168.95.192.1"],
"usage": {
"txkbyte": 40023,
"rxkbyte": 3493
},
"enable": true,
"apn": "internet",
"pinCode": "0000",
"keepalive":
{
"enable": true,
"targetHost": "8.8.8.8",
"intervalSec": 60
}
}
### Update Cellular Configuration [PUT]
The request for PUT has following attributes:
- **id** (required, number, `1`): Identifier for an Cellular interface. Should match `id` in URL.
- **enable** (required, boolean, `true`): Enable/disable Cellular connection.
- **pinCode** (required, string, `0000`): Use this code to auth when exits.
- **apn** (required, string, ``): Indicate apn of SIM card.
- **keepalive** (required, object): Keep-alive configuration.
- **enable** (required, boolean, `true`): Enable/disable Cellular connection keep-alive by ping.
- **targetHost** (required, string, `8.8.8.8`): IP address to ping.
- **intervalSec** (required, number, `60`): Check alive interval. Criteria `60 <= v < 86400`.
The response for PUT is same as that for GET but:
- **restart** (optional, number, `0`): `1` means that view must be restarted after receiving the response.
The error response has following attributes:
- **message** (required, string): Error message in English.
+ Request (application/json)
{
"id": 1,
"enable": true,
"apn": "internet",
"pinCode": "0000",
"keepalive":
{
"enable": true,
"targetHost": "8.8.8.8",
"intervalSec": 60
}
}
+ Response 200 (application/json)
{
"id": 1,
"name": "wwan1",
"mode": "umts",
"signal": -96,
"operatorName": "Chunghwa Telecom",
"iccId": "",
"imei": "356853050370859",
"connected": true,
"ip": "111.70.146.125",
"netmask": "255.255.255.252",
"gateway": "111.70.146.126",
"dns": ["168.95.1.1" , "168.95.192.1"],
"usage": {
"txkbyte": 40023,
"rxkbyte": 3493
},
"enable": true,
"apn": "internet",
"pinCode": "0000",
"keepalive":
{
"enable": true,
"targetHost": "8.8.8.8",
"intervalSec": 60
}
}
+ Response 400 (application/json)
{
"message": "Unable to apply!"
}
# Group Ethernet
Notes related resources of the **Ethernet API**
## Ethernet Collection [/network/ethernets]
### List all Ethernets [GET]
The Collection response has following attributes:
+ Response 200 (application/json; charset=utf-8)
[
{
"id":1,
"wan":1,
"name": "eth0",
"ip": "192.168.3.127",
"mac": "FF:FF:FF:FF:FF:FF",
"netmask": "255.255.255.0",
"subnet": "192.168.3.0",
"gateway": "192.168.3.254",
"dns":["8.8.8.8", "8.8.4.4"],
"currentStatus":1,
"enable":1,
"enableDhcp":0
},
{
"id":2,
"wan":0,
"name": "eth1",
"ip": "192.168.3.127",
"mac": "FF:FF:FF:FF:FF:FF",
"netmask": "255.255.255.0",
"subnet": "192.168.3.0",
"gateway": "192.168.3.254",
"dns":["8.8.8.8", "8.8.4.4"],
"currentStatus":1,
"enable":1,
"enableDhcp":0
}
]
### Update some Ethernets [PUT]
The collection request/response for update has following attributes:
+ Request (application/json; charset=utf-8)
[
{
"id":2,
"wan":0,
"ip": "192.168.100.127",
"netmask": "255.255.255.0",
"subnet": "192.168.100.0",
"gateway": "192.168.100.254",
"dns":["8.8.8.8", "8.8.4.4"],
"enable":1,
"enableDhcp":0
}
]
+ Response 200 (application/json; charset=utf-8)
[
{
"id":1,
"wan":1,
"name": "eth0",
"ip": "192.168.3.127",
"mac": "FF:FF:FF:FF:FF:FF",
"netmask": "255.255.255.0",
"subnet": "192.168.3.0",
"gateway": "192.168.3.254",
"dns":["8.8.8.8", "8.8.4.4"],
"currentStatus":1,
"enable":1,
"enableDhcp":0
},
{
"id":2,
"wan":0,
"name": "eth1",
"ip": "192.168.100.127",
"mac": "FF:FF:FF:FF:FF:FF",
"netmask": "255.255.255.0",
"subnet": "192.168.100.0",
"gateway": "192.168.100.254",
"dns":["8.8.8.8", "8.8.4.4"],
"currentStatus":1,
"enable":1,
"enableDhcp":0,
"restart":1
}
]
## Ethernet [/network/ethernets/{id}]
A single Ethernet object with all its details
+ Parameters
+ id (required, number, `1`) ... Numeric `id` of the Ethernet to perform action with. Has example value.
### Retrieve an Ethernet [GET]
The response for GET has following attributes:
- **id** (required, number, `1`): Identifier for an Ethernet interface.
- **wan** (required, number, `1`, default `0`): Define the interface type is WAN (`1`) or LAN (`0`)
- **name** (required, string, `eth0`): Indicate the interface name.
- **ip** (required, IP address, `192.168.3.127`): IP address for the Ethernet interface.
- **mac** (required, MAC, `FF:FF:FF:FF:FF:FF`): The identical MAC address.
- **netmask** (required, IP address, `255.255.255.0`): Subnet mask for the Ethernet interface.
- **subnet** (required, IP address, `192.168.3.0`): A subnet (short for "subnetwork") is an identifiably separate part of an organization's network.
- **gateway** (required, IP address, `192.168.3.254`): Gateway is a router or a proxy server that routes between networks.
- **dns** (required, IP address array): The Domain Name System (DNS) is a hierarchical distributed naming system for computers, services, or any resource connected to the Internet or a private network.
- **currentStatus** (required, number `1`): Current status for the Ethernet interface, 0 for down and 1 for up.
- **enable** (required, number, `1`): Indicate the link status of Ethernet interface should be set to up (`1`) or down (`0`).
- **enableDhcp** (required, number, `0`): Enable (`1`) the dhcp client or using the static IP (`0`).
+ Response 200 (application/json; charset=utf-8)
+ Body
{
"id":1,
"wan":1,
"name": "eth0",
"ip": "192.168.3.127",
"mac": "FF:FF:FF:FF:FF:FF",
"netmask": "255.255.255.0",
"subnet": "192.168.3.0",
"gateway": "192.168.3.254",
"dns":["8.8.8.8", "8.8.4.4"],
"currentStatus":1,
"enable":1,
"enableDhcp":0
}
### Update an Ethernet [PUT]
The request for PUT has following attributes:
- **wan** (optional, number, `1`, default `0`): Define the interface type is WAN (`1`) or LAN (`0`)
- **ip** (required, IP address, `192.168.3.127`): IP address for the Ethernet interface.
- **netmask** (required, IP address, `255.255.255.0`): Subnet mask for the Ethernet interface.
- **subnet** (required, IP address, `192.168.3.0`): A subnet (short for "subnetwork") is an identifiably separate part of an organization's network.
- **gateway** (optional, IP address, `192.168.3.254`): Gateway is a router or a proxy server that routes between networks.
- **dns** (optional, IP address array): The Domain Name System (DNS) is a hierarchical distributed naming system for computers, services, or any resource connected to the Internet or a private network.
- **enable** (required, number, `1`): Indicate the link status of Ethernet interface should be set to up (`1`) or down (`0`).
- **enableDhcp** (required, number, `0`): Enable (`1`) the dhcp client or using the static IP (`0`).
The response for PUT is same as that for GET.
The error response has following attributes:
- **status** (required, number, `1100`): Status code for error message.
- **message** (required, string): Error message in English.
+ Request (application/json; charset=utf-8)
{
"id": 2,
"wan":0,
"ip": "192.168.3.127",
"netmask": "255.255.255.0",
"subnet": "192.168.3.0",
"gateway": "192.168.3.254",
"dns":["8.8.8.8", "8.8.4.4"],
"enable":1,
"enableDhcp":0
}
+ Response 200 (application/json; charset=utf-8)
{
"id":2,
"wan":0,
"name": "eth1",
"ip": "192.168.100.127",
"mac": "FF:FF:FF:FF:FF:FF",
"netmask": "255.255.255.0",
"subnet": "192.168.100.0",
"gateway": "192.168.100.254",
"dns":["8.8.8.8", "8.8.4.4"],
"currentStatus":1,
"enable":1,
"enableDhcp":0
}
+ Response 404 (application/json; charset=utf-8)
{
"status": 2101,
"message": "Interface not found!"
}
# Group DHCP Server
Notes related resources of the **DHCP Server API**
## DHCP server Collection [/network/dhcpd]
### List all DHCP Interfaces [GET]
The Collection response has following attributes:
- **currentStatus** (required, integer, 1): DHCP server status, 1: server is on, 0: server is off.
- **collection** (required, object array): An object array to perform all queried entries.
+ Response 200 (application/json; charset=utf-8)
{
"currentStatus": 1,
"collection": [
{
"id": 1,
"name": "eth0",
"enable": 0,
"subnet": "192.168.3.0",
"netmask": "255.255.255.0",
"startIP": "192.168.3.100",
"endIP": "192.168.3.150",
"domainNameServers": ["8.8.8.8", "1.1.1.1", "2.2.2.2"],
"domainName": "cloud 5566",
"leaseTime": "3600"
}
]
}
## DHCP server [/network/dhcpd/{id}]
+ Parameters
+ id (required, number, `1`) ... ID of the request in the form of a integer
### List request DHCP Interfaces [GET]
The response has following attributes:
- **currentStatus** (required, integer, 1): 1: server is on, 0: server is off.
- **collection** (required, object array): An object array to perform all queried entries.
+ Response 200 (application/json; charset=utf-8)
{
"id": 1,
"name": "eth0",
"enable": 0,
"subnet": "192.168.3.0",
"netmask": "255.255.255.0",
"startIP": "192.168.3.100",
"endIP": "192.168.3.150",
"domainNameServers": ["8.8.8.8", "1.1.1.1", "2.2.2.2"],
"domainName": "cloud 5566",
"leaseTime": "3600"
}
### Update some DHCP Interfaces [PUT]
The collection request/response for update has following attributes:
- **currentStatus** (required, integer, 1): server status, 1: server is on, 0: server is off.
- **collection** (required, object array): An object array to perform all queried entries.
- **collection[]id** (required, integer): index
- **collection[]name** (required, string): interfece of DHCP server, user can select eth0 or eth1
- **collection[]enable** (required, integer): interfece DHCP server enable bit
- **collection[]subnet** (required, string): subnet
- **collection[]netmask** (required, string): netmask
- **collection[]startIP** (required, string): start IP of DHCP server
- **collection[]endIP** (required, string): end IP of DHCP server
- **collection[]domainNameServers** (optional, object array): an object array to save dns list
- **collection[]domainName** (optional, string): DHCP server domain name
- **collection[]leaseTime** (required, string): leasetime of DHCP server
Suppose user want to update DHCP server of eth0 interface
+ Request (application/json; charset=utf-8)
{
"id": 1,
"name": "eth0",
"enable": 1,
"subnet": "192.168.3.0",
"netmask": "255.255.255.0",
"startIP": "192.168.3.100",
"endIP": "192.168.3.150",
"domainNameServers": ["8.8.8.8", "1.1.1.1", "2.2.2.2"],
"domainName": "cloud 7788",
"leaseTime": "3600"
}
+ Response 200 (application/json; charset=utf-8)
{
"id": 1,
"name": "eth0",
"enable": 1,
"subnet": "192.168.3.0",
"netmask": "255.255.255.0",
"startIP": "192.168.3.100",
"endIP": "192.168.3.150",
"domainNameServers": ["8.8.8.8", "1.1.1.1", "2.2.2.2"],
"domainName": "cloud 5566",
"leaseTime": "3600"
}
# Group Firmware
Notes related resources of the **Firmware API**
## Firmware Upgrade [/system/firmware]
The firmware information with all its details
### Firmware Upgrade [POST]
The request for PUT has following attributes:
- **delay** (optional, number, `3`): Delay time in seconds before execute the upgrading process.
- **file.url** (required, string, `3`): Reboot delay time in seconds.
- **file.headers** (optional, object): Headers for fetch the file if necessary.
+ Request (application/json)
{
"id": 3,
"resource": "/system/firmware",
"method": "post",
"data": {
"delay": 3,
"file": {
"url": "http://192.168.31.81:5000/api/v1/download/1234",
"headers": {
"accessToken": "MOXAMOXA-TEST-SYSTEM"
}
}
}
}
+ Response 200 (application/json)
{}
# Group ImportExport
Notes related resources of the **ImportExport API**
## Import [/system/import]
The importexport object allows user to import/export configuration files to/from the system.
### Import the system [PUT]
The request for PUT has following attributes:
- **file.url** (required, string, `3`): File http url.
- **file.headers** (optional, object): Headers for fetch the file if necessary.
- **scopes** (required, array): List of import scopes. Now avaliable scopes: modbus, relay, time, dns, ethernet, cellular, dhcpd, serial, portforwarding
+ Request (application/json)
{
"id": 3,
"resource": "/system/import",
"method": "put",
"data": {
"scopes": ["modbus", "cellular", "time"],
"file": {
"url": "http://192.168.31.81:5000/api/v1/download/1234",
"headers": {
"accessToken": "MOXAMOXA-TEST-SYSTEM"
}
}
}
}
+ Response 200 (application/json)
{}
## Export [/system/export]
### Export the system [GET]
The response for GET would be a file.
(From web to backend)
+ Request (application/json)
+ Response 200 (application/octet-stream)
```binary data goes here```
### Export the system [POST]
(From backend to bundle)
The response for GET has following attributes:
+ Request (application/json)
{
"url": "https://server/upload",
"headers": {
"accessToken": "MOXAMOXA-TEST-SYSTEM"
}
}
+ Response 200 (application/json)
{
"url": "https://server/upload/xxxxxxx"
}
# Group Reboot
Notes related resources of the **Reboot API**
## Reboot [/system/reboot]
The reboot object allows user to reboot the system
### Reboot the system [PUT]
The response for PUT has following attributes:
- **enable** (required, number, `1`): Indicate the system will be reboot soon.
+ Request (application/json)
{
"enable": 1
}
+ Response 200 (application/json)
{
"enable": 1
}
+ Response 404 (application/json)
{
"status": 1002,
"message": "Resource busy!"
}
# Group Time
Notes related resources of the **Time API**
## Time [/system/time]
The system time information include NTP client settings
### Retrieve system time information [GET]
The response for GET has following attributes:
- **time** (string, `2014-10-21 00:00:00`): Current system time. (iso 8601)
- **timezone** (string, `+08,00,0`): System timezone settings.
- **ntp.enable** (boolean, `enable`): Enable/Disable Ntp client.
- **ntp.server** (string, `pool.ntp.org`): Ntp server.
- **ntp.interval** (integer, `86400`): Ntp update interval in seconds. (at least: 60 seconds.)
+ Response 200 (application/json; charset=utf-8)
+ Body
{
"time": "2015-03-26T16:27:48.611441Z",
"timezone": "+08:00,0",
"ntp": {
"enable": 1,
"server": "pool.ntp.org",
"interval": 86400
}
}
### Update system time properties [PUT]
The response for PUT has following attributes:
+ Request (application/json; charset=utf-8)
+ Body
{
"time": "2015-03-26T16:27:48.611441Z",
"timezone": "+08:00,0",
"ntp": {
"enable": 0,
"server": "pool.ntp.org",
"interval": 86400
}
}
+ Response 200 (application/json; charset=utf-8)
+ Body
{
"time": "2015-03-26T16:27:48.611441Z",
"timezone": "+08:00,0",
"ntp": {
"enable": 1,
"server": "pool.ntp.org",
"interval": 86400
}
}
# Group DNS
Notes related resources of the **DNS API**
## Current DNS [/network/dns]
### List DNS Settings [GET]
The response has following attributes:
- **source** (optional, string): show the current dns corresponging source (maybe network interface or fixed DNS)
- **dns** (required, object array): show current running dns servers.
- **enableFixed** (required, bool): using fixed DNS (`true`) or by interface (`false`)
- **fixedDNS** (required, object array): show fixed dns servers.
+ Response 200 (application/json; charset=utf-8)
{
"enableFixed": false,
"fixedDNS": [],
"source": "eth0",
"dns": ["8.8.8.8", "8.8.4.4", "192.168.50.33"]
}
### Update DNS Settings [PUT]
The request for PUT has following attributes:
- **source** (optional, string, "fixed"): show the current dns corresponging interface
- **dns** (optional, string array, `["8.8.8.8", "8.8.4.4"]`): show current running dns servers.
- **enableFixed** (required, bool, `false`): using fixed DNS (`true`) or by interface (`false`), `false` if not given
- **fixedDNS** (optional, object array, `[]`): fixed dns servers.
+ Request (application/json; charset=utf-8)
{
"source": "eth0"
}
+ Response 200 (application/json; charset=utf-8)
{
"enableFixed": false,
"source": "eth0",
"dns": ["8.8.8.8", "8.8.4.4", "192.168.50.33"],
"fixedDNS": []
}
+ Request (application/json; charset=utf-8)
{
"dns": ["8.8.8.8", "8.8.4.4", "192.168.50.33"]
}
+ Response 200 (application/json; charset=utf-8)
{
"enableFixed": false,
"fixedDNS": [],
"dns": ["8.8.8.8", "8.8.4.4", "192.168.50.33"]
}
+ Request (application/json; charset=utf-8)
{
"enableFixed": true,
"fixedDNS": ["8.8.8.8", "8.8.4.4"]
}
+ Response 200 (application/json; charset=utf-8)
{
"enableFixed": true,
"source": "fixed",
"dns": ["8.8.8.8", "8.8.4.4"],
"fixedDNS": ["8.8.8.8", "8.8.4.4"]
}
+ Request (application/json; charset=utf-8)
## DNS Database [/network/dns/db]
### List DNS Settings by Interfaces [GET]
The response has following attributes:
- **source** (required, string): interface that dns servers belong to
- **dns** (required, object array): dns servers
+ Response 200 (application/json; charset=utf-8)
[
{
"source": "fixed",
"dns": ["8.8.8.8", "8.8.4.4"],
},
{
"source": "eth0",
"dns": ["192.168.50.36", "192.168.50.33"],
},
{
"source": "eth1",
"dns": ["8.8.8.8", "8.8.4.4"],
},
{
"source": "wwlan0",
"dns": ["168.95.1.1"]
}
]
### Update DNS Database [PUT]
+ Request (application/json; charset=utf-8)
{
"source": "eth0"
"dns": ["8.8.8.8", "8.8.4.4"]
}
+ Response 200 (application/json; charset=utf-8)
{
"source": "eth0"
"dns": ["8.8.8.8", "8.8.4.4"]
}
+ Request (application/json; charset=utf-8)
[
{
"source": "eth0"
"dns": ["8.8.8.8", "8.8.4.4"]
},
{
"source": "eth1",
"dns": ["8.8.8.8", "8.8.4.4", "192.168.50.33"],
},
{
"source": "wwlan0",
"dns": ["8.8.8.8", "8.8.4.4", "192.168.50.33"],
}
]
+ Response 200 (application/json; charset=utf-8)
[
{
"source": "eth0"
"dns": ["8.8.8.8", "8.8.4.4"]
},
{
"source": "eth1",
"dns": ["8.8.8.8", "8.8.4.4", "192.168.50.33"],
},
{
"source": "wwlan0",
"dns": ["8.8.8.8", "8.8.4.4", "192.168.50.33"],
}
]
## DNS Servers of Given Interface [/network/dns/{source}]
### List DNS Servers of Given Interface [GET]
The response has following attributes:
- **dns** (required, object array): dns servers
+ Response 200 (application/json; charset=utf-8)
["8.8.8.8", "8.8.4.4"]
### Update DNS Database by Interface [PUT]
+ Request (application/json; charset=utf-8)
["8.8.8.8", "8.8.4.4"]
+ Response 200 (application/json; charset=utf-8)
["8.8.8.8", "8.8.4.4"]
# Group Status
Notes related resources of the **Status API**
## System status [/system/status]
### Get System Status data [GET]
The response has following attributes:
- **hostname** (required, string): show hostname
- **version** (required, string): show product version
- **uptime** (required, integer): show uptime of machine
- **memory** (required, integer): system memory size (unit: byte)
- **disks[].name** (required, string): disk alias
- **disks[].mount** (required, string): mount point
- **disks[].device** (required, string): disk device
- **disks[].usage.total** (required, integer): show total storage size (unit: byte)
- **disks[].usage.used** (required, integer): show used storage size (unit: byte)
- **disks[].usage.free** (required, integer): show free storage size (unit: byte)
- **disks[].usage.percent** (required, integer): show used storage percent
+ Response 200 (application/json; charset=utf-8)
{
"hostname": "Moxa",
"version": "1.1.0-1",
"uptimeSec": 312956,
"memory": 257286144,
"disks": [
{
"name": "system",
"mount": "/",
"device": "rootfs",
"usage": {
"total": 770695168,
"used": 497655808,
"free": 217038848,
"percent": 64.6
}
},
{
"name": "sd1",
"mount": "/media/sd-mmcblk1p1",
"device": "/dev/mmcblk1p1",
"usage": {
"total": 770695168,
"used": 497655808,
"free": 217038848,
"percent": 64.6
}
}
]
}
### Set system hostname [PUT]
+ Request (application/json; charset=utf-8)
{
"hostname": "moxa"
}
+ Response 200 (application/json; charset=utf-8)
{
"hostname": "moxa"
}
# Group Watchdog
Notes related resources of the **Watchdog API**
## Watchdog [/system/watchdog]
### List Watchdog Register Process [GET]
The response has following attributes:
- **process** (required, object array): list of register watchdog.
+ Response 200 (application/json)
[
{
"id" : 1,
"process" : "process name",
"path" : "/usr/bin/process_name"
}
{
"id" : 2,
"process" : "process name",
"path" : "/usr/bin/process_name"
}
]
### Add Process to watchdog [PUT]
+ Request (application/json)
{
"process": "process_name",
"path": "/usr/bin/process_name"
}
+ Response 200 (application/json)
{
"id": 1,
"message": "success"
}
+ Response 400 (application/json)
{
"id": 1,
"message": "Process already register"
}
### Delete Monitor Process from watchdog [DELETE]
/system/watchdog/1