-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapi.htm
1642 lines (1482 loc) · 42.2 KB
/
api.htm
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Zello Enterprise Server API reference</title>
<style>
body {
font-family: Tahoma, Arial, Helvetica, sans-serif;
padding: 12px 24px;
}
#logo {
position: absolute;
top: 24px;
right: 24px;
border: 0;
}
h1 {
margin-right: 200px;
}
pre, .code {
font-family: monospace;
background: #eeeeee;
padding: 2px;
overflow-x: scroll;
}
th {
text-align: left;
padding: 8px;
border-bottom: 1px solid gray;
}
td {
padding: 8px;
vertical-align: top;
}
h2, h3, h5 {
color: #444444;
}
h4 {
font-size: 2em;
font-weight: bold;
margin: 0 0 0.5em;
font-family: monospace;
}
h3 {
text-align: right;
border-bottom: 1px dotted black;
}
h6 {
color: #545454;
font-size: 0.8em;
margin: 0 0 0.5em;
}
table.params tr td:nth-child(2) {
white-space: nowrap;
}
sup {
font-size: x-small;
}
</style>
</head>
<body>
<a href="http://zello.com/">
<img id="logo" src="//zello.com/img/logo_32.png" alt="Zello logo"/>
</a>
<h1>Zello server API reference</h1>
<p class="meta"><b>Version:</b> 1.0.0</p>
<p>Zello server API offers an easy way to interact with Zello server in order to manipulate users and channels from your application. The API compliments Zello push-to-talk SDK which allows you to seamlessly integrate push-to-talk into your Android, Windows or Windows Mobile application.</p>
<h2>Overview</h2>
<p>The API is based on JSON over HTTP protocol. Requests are sent using GET and POST HTTP requests, server responses are returned in HTTP response body and presented in <a href="http://www.json.org">JSON</a>. Each response includes "status" and "code" fields, indicating the response success status or error details. In the case of success, <em>code</em> is "200" and <em>status</em> is "OK". Successful response example:</p>
<pre>
{
"status":"OK",
"code":"200"
}
</pre>
<p>Error response example:</p>
<pre>
{
"status":"Unauthorized",
"code":"301"
}
</pre>
<p><a href="#error_codes">The list of possible error codes.</a></p>
<p>All values you send to the server as GET parameters must be <a href="http://en.wikipedia.org/wiki/Percent-encoding">url-encoded</a>. Most programming languages offer functions, which you can use to accomplish that (use <span class="code">urlencode()</span> in PHP, <span class="code">encodeURIComponent()</span> in JavaScript, and <span class="code">URLEncoder.encode()</span> in Java).</p>
<h2>Security model</h2>
<h3>API key</h3>
<p>To access the API you need to enable API access in your Zello for Work admin console or in Zello Enterprise Server configuration file as follows:
</p>
<ul>
<li><b>Zello for Work:</b> Log in to the admin console. On the Dashboard under Account section click <em>Get API key</em> </li>
<li><b>Zello Enterprise Server:</b> Set API_KEY define in <em>common_params.cfg.php</em> to any alpha-numeric sequence.</li>
</ul>
<h3>Application authentication</h3>
<p>Before accessing the API functions the application must authenticate using <em>API key</em> and administrative user <em>username</em> and <em>password</em>. If authentication was successful the Session ID returned should be use for all future API calls. See <a href="#auth_section">authentication methods</a> description for details. When the application ends working with the API (for example the user logs out) it should use <a href="#logout">logout</a> API method to end the session and clear the Session ID.</p>
<h2>Zello server API client libraries</h2>
<p>To simplify the use of the API we offer the following client libraries:</p>
<ul>
<li><b>PHP</b> <a href="http://zellowork.com/zello_api_client_php.zip">Download</a></li>
<li><b>C#</b>: Coming soon</li>
</ul>
<h2>Notation</h2>
<p>This document uses the following notation for requests description:</p>
<ul>
<li><b>Curly brackets "{}"</b> denote parameter values. When using the API replace them with the actual values i.e
<span class="code">GET user/get/login/{username}</span> becomes
<span class="code">GET user/get/login/Test1</span>, where Test1 is the username of the user for which you want to get the details.</li>
<li><b>Square brackets "[]"</b> denote optional parameters. I.e. in <span class="code">GET user/get[/login/{username}]</span> request specifying <span class="code">/login/{username}</span> part of the URL is optional.</li>
</ul>
<p>Responses format is JSON, where "{", "}", "[", and "]" are part of the syntax.</p>
<p>POST methods format uses two lines, separated by an empty line:</p>
<pre>
POST /something <- Request URL
foo=bar&a=b <- Request data
</pre>
<h2>API methods</h2>
<table>
<tr><th>Name</th><th>Description</th></tr>
<tr>
<td><a href="#gettoken">user/gettoken</a></td>
<td>Gets security token — login first phase.</td>
</tr>
<tr>
<td><a href="#login">user/login</a></td>
<td>Authenticates the user and starts API session — login second phase.</td>
</tr>
<tr>
<td><a href="#user_get">user/get</a></td>
<td>Gets the list of the users or detailed information regarding a particular user. </td>
</tr>
<tr>
<td><a href="#user_save">user/save</a></td>
<td>Adds or updates the user.</td>
</tr>
<tr>
<td><a href="#user_delete">user/delete</a></td>
<td>Deletes users.</td>
</tr>
<tr>
<td><a href="#user_addto">user/addto</a></td>
<td>Adds users to the channel. </td>
</tr>
<tr>
<td><a href="#user_removefrom">user/removefrom</a></td>
<td>Removes users from the channel.</td>
</tr>
<tr>
<td><a href="#user_addcontactsto">user/addcontactsto</a></td>
<td>Adds users as direct contacts to the user. </td>
</tr>
<tr>
<td><a href="#user_removecontactsfrom">user/removecontactsfrom</a></td>
<td>Removes users from direct contacts of the user.</td>
</tr>
<tr>
<td><a href="#channel_get">channel/get</a></td>
<td>Gets the list of the channels or detailed information regarding a particular channel. </td>
</tr>
<tr>
<td><a href="#channel_add">channel/add</a></td>
<td>Adds a new channel.</td>
</tr>
<tr>
<td><a href="#channel_delete">channel/delete</a></td>
<td>Deletes channels. </td>
</tr>
<tr>
<td><a href="#channel_roles">channel/roleslist</a></td>
<td>Returns list of channel roles.</td>
</tr>
<tr>
<td><a href="#channel_saverole">channel/saverole</a></td>
<td>Create or update role.</td>
</tr>
<tr>
<td><a href="#channel_addtorole">channel/addtorole</a></td>
<td>Assign channel role to users in channel.</td>
</tr>
<tr>
<td><a href="#channel_addtorole">channel/deleterole</a></td>
<td>Delete channel role.</td>
</tr>
<tr>
<td><a href="#history_getmetadata">history/getmetadata</a></td>
<td>Returns metadata for saved history messages based on filtering criteria, specified in the request.</td>
</tr>
<tr>
<td><a href="#history_getmedia">history/getmedia</a></td>
<td>Requests media by media key from the recording server.</td>
</tr>
</table>
<h3 id="auth_section">Authentication</h3>
<h4 id="gettoken">user/gettoken</h4>
Gets security token — login first phase.
<h5>Request format:</h5>
<pre>
GET /user/gettoken
</pre>
<h5>Response fields:</h5>
<table>
<tr>
<th>Name</th><th>Type</th><th>Description</th>
</tr>
<tr>
<td>status</td><td>String</td><td>Status message — "OK" or error description.</td>
</tr>
<tr>
<td>code</td><td>String</td><td>Status code — "200" or error code.</td>
</tr>
<tr>
<td>token</td><td>String</td><td>Secure token required for <a href="#login">login</a> API method.</td>
</tr>
<tr>
<td>sid</td><td>String</td><td>Session ID. Pass this value as <em>sid</em> GET parameter to all successful API calls.</td>
</tr>
</table>
<h5>Successful response example:</h5>
<pre>
{
"status":"OK",
"code":"200",
"token":"rm7s6g1e3zfujs5fxzc095sw0dp04arl",
"sid":"ad7e61e520fa4167b5ea1489c7e04f8d"
}
</pre>
<h4 id="login">user/login</h4>
Authenticates the user and starts API session — login second phase.
<h5>Request format:</h5>
<pre>
POST /user/login?sid={sid}
username={username}&password={password}
</pre>
<h5>Request fields:</h5>
<table>
<tr>
<th>Name</th><th>Type</th><th>Description</th>
</tr>
<tr>
<td>sid</td><td>GET</td><td>Session ID received in response to <a href="#gettoken">gettoken</a> call.</td>
</tr>
<tr>
<td>username</td><td>POST</td><td>Username of the administrative user accessing the app.</td>
</tr>
<tr>
<td>password</td><td>POST</td><td>Authentication passphrase constructed as <span class="code">md5(md5({password}) + {token} + {api_key})</span>. That is md5 hash of md5 of user's password concatenated with the token received in response to <a href="#gettoken">gettoken</a> and concatenated with API key.</td>
</tr>
</table>
<h5>Response fields:</h5>
<table>
<tr>
<th>Name</th><th>Type</th><th>Description</th>
</tr>
<tr>
<td>status</td><td>String</td><td>Status message — "OK" or error description.</td>
</tr>
<tr>
<td>code</td><td>String</td><td>Status code — "200" or error code.</td>
</tr>
</table>
<h5>Successful response example:</h5>
<pre>
{
"status":"OK",
"code":"200"
}
</pre>
<h4 id="logout">user/logout</h4>
Logs user out and ends the session.
<h5>Request format:</h5>
<pre>
GET /user/logout?sid={sid}
</pre>
<h5>Request fields:</h5>
<table>
<tr>
<th>Name</th><th>Type</th><th>Description</th>
</tr>
<tr>
<td>sid</td><td>GET</td><td>Session ID received in response to <a href="#gettoken">gettoken</a> call.</td>
</tr>
</table>
<h5>Response fields:</h5>
<table>
<tr>
<th>Name</th><th>Type</th><th>Description</th>
</tr>
<tr>
<td>status</td><td>String</td><td>Status message — "OK" or error description.</td>
</tr>
<tr>
<td>code</td><td>String</td><td>Status code — "200" or error code.</td>
</tr>
</table>
<h5>Successful response example:</h5>
<pre>
{
"status":"OK",
"code":"200"
}
</pre>
<h3>Users management</h3>
<h4 id="user_get">user/get</h4>
Gets the list of the users or detailed information regarding a particular user.
<h5>Request format:</h5>
<pre>
GET /user/get[/login/{login}][/gateway/{gateway}][/max/{max}][/start/{start}]?sid={sid}
</pre>
<h5>Request fields:</h5>
<table>
<tr>
<th>Name</th><th>Type</th><th>Description</th>
</tr>
<tr>
<td>sid</td><td>GET</td><td>Session ID received in response to <a href="#gettoken">gettoken</a> call.</td>
</tr>
<tr>
<td>login</td><td>GET</td><td>(Optional) Username of the user to fetch. If omitted all users will be returned.</td>
</tr>
<tr>
<td>gateway</td><td>GET</td><td>(Optional) Gateway users filter. Set to "true" for gateways, omit for normal users.</td>
</tr>
<tr>
<td>max</td><td>GET</td><td>(Optional) Maximum number of results to fetch.</td>
</tr>
<tr>
<td>start</td><td>GET</td><td>(Optional) Index of the first result to fetch.</td>
</tr>
</table>
<h5>Response fields:</h5>
<table>
<tr>
<th>Name</th><th>Type</th><th>Description</th>
</tr>
<tr>
<td>status</td><td>String</td><td>Status message — "OK" or error description.</td>
</tr>
<tr>
<td>code</td><td>String</td><td>Status code — "200" or error code.</td>
</tr>
<tr>
<td>users</td><td>Array</td><td>An array containing user details objects. See response example below.</td>
</tr>
<tr>
<td>limits</td><td>Object</td><td>Restrictions on number of users and gateways imposed by your current service plan or license. See response example below.</td>
</tr>
<tr>
<td>canAddUsers</td><td>Boolean</td><td>Indicates, whether more users can be added.</td>
</tr>
<tr>
<td>canAddGateways</td><td>Boolean</td><td>Indicates, whether more gateways can be added.</td>
</tr>
</table>
<h5>Successful response example:</h5>
<pre>
{
"status":"OK",
"code":"200",
"users":[
{
"name":"A very long user name",
"email":"",
"admin":true,
"limited_access":false,
"job":"",
"full_name":"",
"channels":[]
},{
"name":"john",
"email":"",
"admin":true,
"limited_access":false,
"job":"",
"full_name":"John",
"channels":["Shared"]
},{
"name":"alex",
"email":"alex@zello.com",
"admin":false,
"limited_access":false,
"job":"",
"full_name":"Алексей Гаврилов",
"channels":["Test", "Shared"]
}
],
"limits":{
"maxUsers":"10",
"maxGateways":"2"
},
"canAddUsers":true,
"canAddGateways":true
}
</pre>
<h4 id="user_save">user/save</h4>
Adds or updates the user. If username exists, the user is updated, otherwise new user is created.
<h5>Request format:</h5>
<pre>
POST /user/save?sid={sid}
name={name}&password={password}&email={email}&full_name={full_name}&job={job}&admin={admin}&limited_access={limited_access}&gateway={gateway}&add={add}
</pre>
<h5>Request fields:</h5>
<table>
<tr>
<th>Name</th><th>Type</th><th>Description</th>
</tr>
<tr>
<td>sid</td><td>GET</td><td>Session ID received in response to <a href="#gettoken">gettoken</a> call.</td>
</tr>
<tr>
<td>name</td><td>POST</td><td>Username of the user to be updated. If user doesn't exist the new one is created.</td>
</tr>
<tr>
<td>password</td><td>POST</td><td>(Optional if user already exists) The md5 hash of the new user password.</td>
</tr>
<tr>
<td>email</td><td>POST</td><td>(Optional) User's e-mail address. Required for forgot password function.</td>
</tr>
<tr>
<td>full_name</td><td>POST</td><td>(Optional) Alias used to display the user in contacts.</td>
</tr>
<tr>
<td>job</td><td>POST</td><td>(Optional) User position.</td>
</tr>
<tr>
<td>admin</td><td>POST</td><td>(Optional) "true" or "false". Grant or not web-console (and API) access to that user. Default is "false".</td>
</tr>
<tr>
<td>limited_access</td><td>POST</td><td>(Optional) "true" or "false". Restrict or not user's ability to start one-on-one conversations. Default is "false".</td>
</tr>
<tr>
<td>gateway</td><td>POST</td><td>(Optional) "true" or "false". Defines whether the user a gateway. Default is "false".</td>
</tr>
<tr>
<td>add</td><td>POST</td><td>(Optional) "true" or "false". Force adding a user. If this parameter is set to "true" the method will give an error when trying to update existing user. Default is "false".</td>
</tr>
</table>
<h5>Response fields:</h5>
<table>
<tr>
<th>Name</th><th>Type</th><th>Description</th>
</tr>
<tr>
<td>status</td><td>String</td><td>Status message — "OK" or error description.</td>
</tr>
<tr>
<td>code</td><td>String</td><td>Status code — "200" or error code.</td>
</tr>
</table>
<h5>Successful response example:</h5>
<pre>
{
"status":"OK",
"code":"200",
}
</pre>
<h4 id="user_delete">user/delete</h4>
Deletes users.
<h5>Request format:</h5>
<pre>
POST /user/delete?sid={sid}
{login}
</pre>
<h5>Request fields:</h5>
<table>
<tr>
<th>Name</th><th>Type</th><th>Description</th>
</tr>
<tr>
<td>sid</td><td>GET</td><td>Session ID received in response to <a href="#gettoken">gettoken</a> call.</td>
</tr>
<tr>
<td>login</td><td>POST array</td><td>An array of usernames of users to be deleted. Here is an example of logins array formatted as POST array.
<p><span class="code">login[]=test&login[]=test%202&login[]=test3</span></p>
represents the following array
<p><span class="code">["test", "test 2", "test3"]</span></p></td>
</tr>
</table>
<h5>Response fields:</h5>
<table>
<tr>
<th>Name</th><th>Type</th><th>Description</th>
</tr>
<tr>
<td>status</td><td>String</td><td>Status message — "OK" or error description.</td>
</tr>
<tr>
<td>code</td><td>String</td><td>Status code — "200" or error code.</td>
</tr>
</table>
<h5>Request example:</h5>
<pre>
POST /user/delete?sid=cf48c88ac8732da3bc88bf9b6858ec85
login[]=test&login[]=test%202&login[]=test3
</pre>
<h5>Successful response example:</h5>
<pre>
{
"status":"OK",
"code":"200",
}
</pre>
<h4 id="user_addto">user/addto</h4>
Adds users to the channel.
<h5>Request format:</h5>
<pre>
POST /user/addto/{channel}?sid={sid}
{login}
</pre>
<h5>Request fields:</h5>
<table>
<tr>
<th>Name</th><th>Type</th><th>Description</th>
</tr>
<tr>
<td>sid</td><td>GET</td><td>Session ID received in response to <a href="#gettoken">gettoken</a> call.</td>
</tr>
<tr>
<td>channel</td><td>GET</td><td>Channel name.</td>
</tr>
<tr>
<td>login</td><td>POST array</td><td>An array of usernames of users to be added to the channel. See <a href="#user_delete">user/delete</a>
</tr>
</table>
<h5>Response fields:</h5>
<table>
<tr>
<th>Name</th><th>Type</th><th>Description</th>
</tr>
<tr>
<td>status</td><td>String</td><td>Status message — "OK" or error description.</td>
</tr>
<tr>
<td>code</td><td>String</td><td>Status code — "200" or error code.</td>
</tr>
</table>
<h5>Successful response example:</h5>
<pre>
{
"status":"OK",
"code":"200",
}
</pre>
<h4 id="user_removefrom">user/removefrom</h4>
Removes users from the channel.
<h5>Request format:</h5>
<pre>
POST /user/removefrom/{channel}?sid={sid}
{login}
</pre>
<h5>Request fields:</h5>
<table>
<tr>
<th>Name</th><th>Type</th><th>Description</th>
</tr>
<tr>
<td>sid</td><td>GET</td><td>Session ID received in response to <a href="#gettoken">gettoken</a> call.</td>
</tr>
<tr>
<td>channel</td><td>GET</td><td>Channel name.</td>
</tr>
<tr>
<td>login</td><td>POST array</td><td>An array of usernames of users to be removed from the channel. See <a href="#user_delete">user/delete</a>
</tr>
</table>
<h5>Response fields:</h5>
<table>
<tr>
<th>Name</th><th>Type</th><th>Description</th>
</tr>
<tr>
<td>status</td><td>String</td><td>Status message — "OK" or error description.</td>
</tr>
<tr>
<td>code</td><td>String</td><td>Status code — "200" or error code.</td>
</tr>
</table>
<h5>Successful response example:</h5>
<pre>
{
"status":"OK",
"code":"200",
}
</pre>
<h4 id="user_addcontactsto">user/addcontactsto</h4>
Adds users to the user's direct contacts.
<h5>Request format:</h5>
<pre>
POST /user/addcontactsto/{username}?sid={sid}
{login}
</pre>
<h5>Request fields:</h5>
<table>
<tr>
<th>Name</th><th>Type</th><th>Description</th>
</tr>
<tr>
<td>sid</td><td>GET</td><td>Session ID received in response to <a href="#gettoken">gettoken</a> call.</td>
</tr>
<tr>
<td>username</td><td>GET</td><td>Username of the user, where the contacts will be added.</td>
</tr>
<tr>
<td>login</td><td>POST array</td><td>An array of usernames of users to be added to the contacts. See <a href="#user_delete">user/delete</a>
</tr>
</table>
<h5>Response fields:</h5>
<table>
<tr>
<th>Name</th><th>Type</th><th>Description</th>
</tr>
<tr>
<td>status</td><td>String</td><td>Status message — "OK" or error description.</td>
</tr>
<tr>
<td>code</td><td>String</td><td>Status code — "200" or error code.</td>
</tr>
</table>
<h5>Successful response example:</h5>
<pre>
{
"status":"OK",
"code":"200",
}
</pre>
<h4 id="user_removecontactsfrom">user/removecontactsfrom</h4>
Removes users from direct contacts of the user.
<h5>Request format:</h5>
<pre>
POST /user/removecontactsfrom/{username}?sid={sid}
{login}
</pre>
<h5>Request fields:</h5>
<table>
<tr>
<th>Name</th><th>Type</th><th>Description</th>
</tr>
<tr>
<td>sid</td><td>GET</td><td>Session ID received in response to <a href="#gettoken">gettoken</a> call.</td>
</tr>
<tr>
<td>username</td><td>GET</td><td>Username of the user from who the contacts will be removed.</td>
</tr>
<tr>
<td>login</td><td>POST array</td><td>An array of usernames of users to be removed from the direct contacts. See <a href="#user_delete">user/delete</a>
</tr>
</table>
<h5>Response fields:</h5>
<table>
<tr>
<th>Name</th><th>Type</th><th>Description</th>
</tr>
<tr>
<td>status</td><td>String</td><td>Status message — "OK" or error description.</td>
</tr>
<tr>
<td>code</td><td>String</td><td>Status code — "200" or error code.</td>
</tr>
</table>
<h5>Successful response example:</h5>
<pre>
{
"status":"OK",
"code":"200",
}
</pre>
<!-- channels -->
<h3>Channels management</h3>
<h4 id="channel_get">channel/get</h4>
Gets the list of the channels or detailed information regarding a particular channel.
<h5>Request format:</h5>
<pre>
GET /channel/get[/name/{name}][/max/{max}][/start/{start}]?sid={sid}
</pre>
<h5>Request fields:</h5>
<table>
<tr>
<th>Name</th><th>Type</th><th>Description</th>
</tr>
<tr>
<td>sid</td><td>GET</td><td>Session ID received in response to <a href="#gettoken">gettoken</a> call.</td>
</tr>
<tr>
<td>name</td><td>GET</td><td>(Optional) Name of the channel to fetch. If omitted all channels will be returned.</td>
</tr>
<tr>
<td>max</td><td>GET</td><td>(Optional) Maximum number of results to fetch.</td>
</tr>
<tr>
<td>start</td><td>GET</td><td>(Optional) Index of the first result to fetch.</td>
</tr>
</table>
<h5>Response fields:</h5>
<table>
<tr>
<th>Name</th><th>Type</th><th>Description</th>
</tr>
<tr>
<td>status</td><td>String</td><td>Status message — "OK" or error description.</td>
</tr>
<tr>
<td>code</td><td>String</td><td>Status code — "200" or error code.</td>
</tr>
<tr>
<td>channels</td><td>Array</td><td>An array containing channel details objects. See response example below.</td>
</tr>
</table>
<h5>Successful response example:</h5>
<pre>
{
"status":"OK",
"code":"200",
"channels":[
{
"name":"Dynamic",
"count":"0",
"is_shared":0,
"is_invisible":0
},{
"name":"Shared",
"count":"1",
"is_shared":1,
"is_invisible":0
},{
"name":"Test",
"count":"2",
"is_shared":1,
"is_invisible":1
}
]
}
</pre>
<h4 id="channel_add">channel/add</h4>
Adds a new channel.
<h5>Request format:</h5>
<pre>
GET /channel/add/name/{name}[/shared/{shared}][/invisible/{invisible}]?sid={sid}
</pre>
<h5>Request fields:</h5>
<table>
<tr>
<th>Name</th><th>Type</th><th>Description</th>
</tr>
<tr>
<td>sid</td><td>GET</td><td>Session ID received in response to <a href="#gettoken">gettoken</a> call.</td>
</tr>
<tr>
<td>name</td><td>GET</td><td>Channel name. If channel with such name already exists the error will be returned.</td>
</tr>
<tr>
<td>shared</td><td>GET</td><td>(Optional) "true" or "false". Set to "true" to create group channel, set to "false" to create dynamic channel. Default is "false" </td>
</tr>
<tr>
<td>invisible</td><td>GET</td><td>(Optional) "true" or "false". Set to "true" in combination with shared=true to create a hidden group channel. When combined with shared=false the behavior is not defined. Default is "false" </td>
</tr>
</table>
<h5>Response fields:</h5>
<table>
<tr>
<th>Name</th><th>Type</th><th>Description</th>
</tr>
<tr>
<td>status</td><td>String</td><td>Status message — "OK" or error description.</td>
</tr>
<tr>
<td>code</td><td>String</td><td>Status code — "200" or error code.</td>
</tr>
</table>
<h5>Successful response example:</h5>
<pre>
{
"status":"OK",
"code":"200",
}
</pre>
<h4 id="channel_delete">channel/delete</h4>
Deletes channels.
<h5>Request format:</h5>
<pre>
POST /channel/delete?sid={sid}
{name}
</pre>
<h5>Request fields:</h5>
<table>
<tr>
<th>Name</th><th>Type</th><th>Description</th>
</tr>
<tr>
<td>sid</td><td>GET</td><td>Session ID received in response to <a href="#gettoken">gettoken</a> call.</td>
</tr>
<tr>
<td>name</td><td>POST array</td><td>An array of names of channels to be deleted. See <a href="#user_delete">user/delete</a></td>
</tr>
</table>
<h5>Response fields:</h5>
<table>
<tr>
<th>Name</th><th>Type</th><th>Description</th>
</tr>
<tr>
<td>status</td><td>String</td><td>Status message — "OK" or error description.</td>
</tr>
<tr>
<td>code</td><td>String</td><td>Status code — "200" or error code.</td>
</tr>
</table>
<h5>Successful response example:</h5>
<pre>
{
"status":"OK",
"code":"200",
}
</pre>
<h4 id="channel_roles">channel/roleslist</h4>
Get channel roles list.
<h5>Request format:</h5>
<pre>
GET /channel/roleslsit/name/{name}?sid={sid}
</pre>
<h5>Request fields:</h5>
<table>
<tr>
<th>Name</th><th>Type</th><th>Description</th>
</tr>
<tr>
<td>sid</td><td>GET</td><td>Session ID received in response to <a href="#gettoken">gettoken</a> call.</td>
</tr>
<tr>
<td>name</td><td>GET</td><td>Channel name.</td>
</tr>
</table>
<h5>Response fields:</h5>
<table>
<tr>
<th>Name</th><th>Type</th><th>Description</th>
</tr>
<tr>
<td>status</td><td>String</td><td>Status message — "OK" or error description.</td>
</tr>
<tr>
<td>code</td><td>String</td><td>Status code — "200" or error code.</td>
</tr>
<tr>
<td>roles</td><td>Array</td><td>An array containing channel roles objects list. See response example below.</td>
</tr>
</table>
<h5>Successful response example:</h5>
<pre>
{
"status":"OK",
"code":"200",
"roles": [{
"name": "dispatchers",
"settings": {
"listen_only": false,
"no_disconnect": true,
"allow_alerts": true,
"to": ["dispatchers", "dispatchers", "drivers", "security"]
}
}, {
"name": "drivers",
"settings": {
"listen_only": false,
"no_disconnect": true,
"allow_alerts": false,
"to": ["dispatchers"]
}
}, {
"name": "security",
"settings": {
"listen_only": true,
"no_disconnect": true,
"allow_alerts": true,
"to": []
}
}, {
"name": "superusers",
"settings": {
"listen_only": false,
"no_disconnect": false,
"allow_alerts": true,
"to": []
}
}]
}
</pre>
<h4 id="channel_saverole">channel/saverole</h4>
Create or update channel role.
<h5>Request format:</h5>
<pre>
POST /channel/saverole/channel/{channelname}/name/{name}?sid={sid}
</pre>
<h5>Request fields:</h5>
<table>
<tr>
<th>Name</th><th>Type</th><th>Description</th>
</tr>
<tr>
<td>sid</td><td>GET</td><td>Session ID received in response to <a href="#gettoken">gettoken</a> call.</td>
</tr>
<tr>
<td>channelname</td><td>GET</td><td>Channel name.</td>
</tr>
<tr>
<td>name</td><td>GET</td><td>Role name. If role with this name already exists, it will be updated with new params.</td>
</tr>
<tr>
<td>settings</td><td>POST</td><td>Role settings.</td>
</tr>
</table>
<h5>Response fields:</h5>
<table>
<tr>
<th>Name</th><th>Type</th><th>Description</th>
</tr>
<tr>
<td>status</td><td>String</td><td>Status message — "OK" or error description.</td>
</tr>
<tr>
<td>code</td><td>String</td><td>Status code — "200" or error code.</td>
</tr>
</table>
<h5>Request example:</h5>
<pre>
POST /channel/saverole/channel/Everyone/name/drivers?sid=cf48c88ac8732da3bc88bf9b6858ec85
<b>settings</b>: {"listen_only": false, "no_disconnect": true, "allow_alerts": false, "to": ["dispatchers"]}
</pre>
<h5>Successful response example:</h5>
<pre>
{
"status":"OK",
"code":"200"