-
Notifications
You must be signed in to change notification settings - Fork 0
/
protocol.html
1953 lines (1666 loc) · 83.9 KB
/
protocol.html
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>
<html>
<head>
<meta charset="utf-8" />
<title>Unofficial Plug.dj protocol documentation</title>
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,600' rel='stylesheet' type='text/css'>
<style>
html {
background-color: #ededff;
font-family: 'Open Sans', Helvetica, sans-serif, Arial;
font-weight: 400;
color: rgba(0, 0, 0, 0.8);
}
body {
margin: 0px auto;
width: 1200px;
padding-bottom: 500px;
}
h1, h2 {
font-weight: 400;
border-bottom: 1px solid rgba(0, 0, 0, 0.3);
}
h3 {
font-weight: 600;
border-bottom: 1px solid rgba(0, 0, 0, 0.16);
padding-bottom: 2px;
}
h4 {
font-weight: 600;
margin: 20px 0px 10px;
}
h1 > a, h2 > a, h3 > a, h4 > a {
color: rgba(0, 0, 0, 0.8);
text-decoration: none;
}
.jsondesc {
margin: 10px 0px 20px;
padding-left: 10px;
}
.jsondesc, .jsondesc ul {
list-style: none;
}
.jsondesc > li ul {
padding-left: 0px;
margin-left: 2px;
}
.jsondesc li {
background-position: 0px 4px;
background-repeat: no-repeat;
padding-left: 20px;
}
.jsondesc li.object {
/* Image borrowed from Minecraft Wiki http://minecraft.gamepedia.net/ */
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3goaABkRYETxTwAAAB1pVFh0Q29tbWVudAAAAAAAQ3JlYXRlZCB3aXRoIEdJTVBkLmUHAAACK0lEQVQ4y42Sz0uUQRjHP8+8+5ZZSx0rCSJQKi0q9SJEsHaVLkKHIOgmHTp6E4WF7A8IdGmhDCyQ7BBUINGpn0SytIQ/6hJKhdLu1r6vqzvzznTQ3VbeiOb0MPOdz8znmRHnHAD9w8N9yrkD/Gto/XxqdPRz41SiVjhrD94ZGRmvRhE6itDWEjlH7YBcLsfEzMxA/9CQPEinP9X2qTrAGLHWEmlNpDXV9XUqYUgQBJTLZYIgYDqdHrfG9PYNDrbGAJFzIoASwfc8mnyfHYkECaUQEQqFAjcnJ0l1dIzN5fMXYwpGa6VEUCIA+J73R9QYUqkUzjmSySRPZ2eLMUAURSINgExuhcyHFXBw+fg+Lh3di7G2no0rRFFdQYlwN79KV1c3Xd3dTM2Vtuk0AuIKSoG1mGKRhfn5zbVSiSbfB8ATwWit4jcwRgmwks3ysacHFa6R8H0Svo8K1+qN9T2PyJg4QG/1YDmb5WRzC9e+52l7PI335T5HWp5w/cVZ3ixP4CuF/puCq1aVABsiuNb9XImWOP/jG7fPFDl1+hjQyct39+htHcBVqyoG0MYoEaECrL7Oo0u/KCYThOUmFhcWASgVNpCtbFzBWhFgT2cnb3dr3rfsYrXtEJXQojyF8hSVYPOVtLVxhfUwTACcy2RwzmGdwwEPxy7w6tlXnIMThzuRhuw2wM9CYWetrn0o5xy3rj7CbcGsc4hS27J1QBAES83t7Tf4jyEiS7X6N7IhD8PTqdH+AAAAAElFTkSuQmCC');
}
.jsondesc li.string {
/* Image borrowed from Minecraft Wiki http://minecraft.gamepedia.net/ */
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3goaAQIl6QSkVwAAAB1pVFh0Q29tbWVudAAAAAAAQ3JlYXRlZCB3aXRoIEdJTVBkLmUHAAAB4ElEQVQ4y42Sv2obQRCHv1nrIhMQOlUifwhBUiBgq/IbKGndGfIKeQJ3xgYVzgME4jIp3ISkDrhIlVoYXKRIiAyufSH4dBK3ezMpfCdkToQsLDsss9/85jcrZgbA3uHhrjN7wL+W918/Hh//XL1qVIGpPnx/dHSSFwW+KPCqFGZUBc7Pz/lwdvZ67+BAPo3HP6p3bgkIQVSVwnsK78kXC+azGWmacnNzQ5qmfB6PTzSEF7v7+89qgMJMBHAiRBsbbEYR9xoNGs4hIiRJwtvTU0bb2+++X1y8qrUQvHdOhG+TCWZGHMdkWcbzwQBCYDQaYWa0Wi2+TCa/a4CiKEREGAwGqCpmRqfTYTOKygqBoLrMXQ8AptMpcRxzfX2NmfGrNLLdbjOfzxkOh+sBVQv9fn9ZvVJSbVVlQ4TgvasrCMEJcHl5uXxYKYnjGDMjyzIedbsUIdQBvvSgUrDqw2ocOYdf14LluVv1IEkSVPVO9WazydNuF8vzNQpCcCJCr9cDoNPpYGY8brdRVdQMNUPK3DpAdTmFSm6WZTyJY3AOyhE6EbxqvYXFbNYAeLmzc+uBGQao2e13LSGyknsH8CdJmlUsIjgRzAwpTweoc4hzd3KXgDRNr+5vbb3hP5aIXFXxX/oVN9MJBzEkAAAAAElFTkSuQmCC');
}
.jsondesc li.integer {
/* Image borrowed from Minecraft Wiki http://minecraft.gamepedia.net/ */
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3goaAQAHDlKHMQAAAB1pVFh0Q29tbWVudAAAAAAAQ3JlYXRlZCB3aXRoIEdJTVBkLmUHAAAByklEQVQ4y42Sv2pUURCHv5m76z9cey20skpqGxFkRSRFQCQg6Av4BOlCAlvEBxBMqUgQRQVBVFKkyAMsCxEEFVIsdrKie5eEe86ZsfDe6653Eac5w2HOd+Y3vxF3B2BlfX1Z3c/yrwhh9/nm5pfpq1aVuNm5RxsbW0VKhJQIZiR3qg8GgwGPd3buraytyYte73P1TmtAjGJmpBBIIVAcHXE4mZDnOePxmDzPednrbVmM15ZXVy82AMldBFAR2lnGiXabY60WLVVEhNFoxIPtbbqLiw8/7u/fbkiIIaiKoCIAtLPsj9AY6Xa7uDudTod3/f73BiClJDIFmAeJZnXtfEApYTr+hojIfEAtQRXM2Hs/Zu/tTwAu3zjNpesnAchEiCFos4MYte5AlatLZ0gxcfDpkCtLHay0M8syUoxNQChnICK/rVElpUgowsxgM1XCPAleFHUHVvqbUqIIxcxcMhG8KLSxByFGFREqyOunQ149OeBD/xtvnn2lsljK2qYEs9oFc+fW3QvcvHMed8fcsdJCFSGYNSUcTSYtoJ6Buc/IoXRHpmpnAD9Go+NVXi2UuyPlqYCpIqoztTUgz/PhqYWF+/xHiMiwyn8BGQ/sdWM9mu0AAAAASUVORK5CYII=');
}
.jsondesc li.float {
/* Image borrowed from Minecraft Wiki http://minecraft.gamepedia.net/ */
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3goaAQEDECRyaQAAAB1pVFh0Q29tbWVudAAAAAAAQ3JlYXRlZCB3aXRoIEdJTVBkLmUHAAABv0lEQVQ4y42SsWpUURCGv5m7m4TgksIUrp1gBEkKn8BirUOagK+QysIiXcjCgvEBBFNqkUa0FCGFjxAWUgQxYBFsV2Tv4u4958zY3Hvd9S7iNGc4zHzn/+eMuDsA+8fHu+re5V8Rwud3JyfX81etKnGzu2/6/dMiJUJKBDOSO9UDw+GQt+fnB/tHR/J+MPha9WkNiFHMjBQCKQSK6ZRfkwl5njMej8nznA+DwanF+GT38HCrAUjuIoCK0M4y1tptVlotWqqICKPRiFdnZ/R2dl5fXV4+bViIIaiKoCIAtLPsj9EY6fV6uDudTodPFxc/GoCUksgcYBkkmtW1ywGlhfn4GyIiywG1BVUw48uz73Xf2v0VNg82AMhEiCFoU0GMWitQpSgK7j3vsr61irlj5XdmWUaKsQkI5QxEBAWm0ylXL74B0N3b5M7ebdpZRqZKWGbBi6JWYCXgUf8BGw9vLSoQwYtiiYIYVUQQd1SE2WwGTj2TKqSsbQLM6l8wd3Y/PsaqVZ6DqAjBrGlhOpm0gHoGViqxal1LiMzVLgB+jkartcxyodwdKU8FTBVRXaitAXme36xvb7/kP0JEbqr8Nwnu6wapuwMkAAAAAElFTkSuQmCC');
}
.jsondesc li.boolean {
/* Image borrowed from Minecraft Wiki http://minecraft.gamepedia.net/ */
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3goaAQIzHdARBgAAAB1pVFh0Q29tbWVudAAAAAAAQ3JlYXRlZCB3aXRoIEdJTVBkLmUHAAAB5ElEQVQ4y42SsWsUURDGfzN7l0ThUBEDaiWiCIn+BVYnwSpWAUvBShDsTBcSvSJWFkEwpSnSiFYiSgp7C8NBChG1kIBN8IK5Pdzseztj4e3m4h3iVMPje7833/dG3B2AucXFWXU/zb8qhHfPl5e/DB7VysbNzjxbWlrNi4JQFAQzCnfKB9rtNmsbG3fmFhbkRav1ubynFSBGMTOKEChCIM8yfvV6pGlKt9slTVNetlqrFuO12fn5C0OAwl0EUBHqScJEvc5YrUZNFRGh0+nwZH2d5vT0049bWzeHLMQQVEVQEQDqSXJgNEaazSbuTqPR4M3m5u4QoCgKkQHAKEg0q7SjAX0Lg/U3RERGAyoLquSfvtNZeVvdG79+mYmZaQASEWIIOhxijDo4QZ7nTK7conF3hu6rD1Ww9SShiFGHJgj9DEQEdyfLMr7dXyPs7HHk0lmKH13qJxskqoQBCwd7kOcHE7iRZRnnH9/m4to9dttfiTt7qAiJCJ7nIyaIUUUEccfM2d/f5/2NB38ymDzO2KljqAjS1w4DzKpfOHHlHFdfP8T6q2zumBnmjooQzIZ/Iev1agAigkIlttKnKpghA9pDgJ+dznjZlwvl7lWoCpgqonpIWwHSNN0+OjX1iP8oEdku+9/iN/l11k+mEQAAAABJRU5ErkJggg==');
}
.jsondesc li.array {
/* Image borrowed from Minecraft Wiki http://minecraft.gamepedia.net/ */
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3goaAQIXIdP11wAAAB1pVFh0Q29tbWVudAAAAAAAQ3JlYXRlZCB3aXRoIEdJTVBkLmUHAAACFElEQVQ4y42TwUvUQRTHP29+u/0iWDyXh05d1MDF6JbQRqfwJvQHBBGdOhkkpiBpQreCDILq4CXqGIFBQVCHCFm1XLAuuh3Ew0b4W1t2Zt7rsrutrEQPHvMYvvP9ft+bGTEzAManp8ec2XH+Fd6/fT4//717K9cuTPXE05mZxWaM+BjxqkQz2gLlcplny8vXxqem5MXs7Lf2OdchCEFUleg90XuajQa/63WyLGNvb48sy3g5O7uoIVwYm5g41UMQzUQAJ0I+STiaz3MklyPnHCJCrVbjwdISpaGhh5X19cs9LQTvnRPh4qvTvLm0zqfVVfr6+jjZ3w8hUCqVMDMKhQKvV1Z+9hDEGEVEeDf2FTXj3MgIaoaPsaUQCKod7OEEQPnWTYbnFvhcqZCmKfv7+6RpiqqSpimFQuFwgnYLZxbuoaqcHRhAzTrpY6ThPYkIwXvXO8QQnAA3nuRxzvFxbY3K9jaVrS1+7Ox0BptPEmIIrseBb83g/pWImTBaLKKqB1zkk4TEOXxXC3/fQbPpBLg9OYmI8GFtjY1qlZXNzY4TJ0IigjWbhzgIwYkId+bmMGB0eBhrq3c5kRa2x4FXFQGuP3YI8L5c5sv2NhvVKtXdXZxIJ71q7y006vUcwKOrYCacLxYxQFv/Qc1AFenCHiD4Vaul7VpaSmaGtFYHqHOIcwewHYIsy6rHBgfv8h8hItV2/Qe1PzbsQ1FA1gAAAABJRU5ErkJggg==');
}
.jsondesc > li + ul {
margin-bottom: 6px;
}
.jsondesc ul {
position: relative;
}
/*.jsondesc ul:before {
content: '';
position: absolute;
top: 0px;
left: 0px;
bottom: 12px;
width: 1px;
border-left: 1px solid #000000;
}*/
.jsondesc > li > ul li {
position: relative;
}
.jsondesc > li > ul li:before {
content: '';
position: absolute;
top: 12px;
left: -13px;
width: 9px;
height: 0px;
border-bottom: 1px solid #000000;
}
.jsondesc > li > ul li:after {
content: '';
position: absolute;
top: 0px;
bottom: 0px;
left: -14px;
border-left: 1px solid #000000;
}
.jsondesc > li > ul li:last-child:after {
height: 13px;
bottom: initial;
}
.jsondesc li > b:nth-of-type(1), b.code {
color: #000000;
font-family: "Lucida Console", Monaco, monospace;
font-weight: 400;
background-color: rgba(0, 0, 50, 0.1);
}
i {
font-family: "Courier New", Courier, monospace;
font-style: normal;
background-color: rgba(0, 0, 100, 0.06);
}
.badge {
padding: 0px 6px;
background-color: rgba(200, 200, 200, 0.5);
}
h3 .badge {
font-size: 15px;
}
.badge.notauthed, .badge.unnameduser { /* Not authenticated, Unnamed user */
background-color: rgba(255, 60, 60, 0.5);
}
.badge.isinroom, .badge.role-rdj, .badge.role-bouncer, .badge.role-manager, .badge.role-cohost, .badge.host { /* Is in room, Resident DJ+, Bouncer+, Manager+, Co-Host+, Host */
background-color: rgba(60, 60, 255, 0.5);
}
.badge.isdjing, .badge.isinwaitlist { /* Is DJing, Is in wait list */
background-color: rgba(60, 200, 60, 0.5);
}
</style>
</head>
<body>
<h1><a id="intro" href="#intro">Introduction</a></h1>
This document has been made to help other developers struggling with Plug's silly procotol. Maybe I'll write a bit more here later.
<h1><a id="rest" href="#rest">REST API</a></h1>
All requests to REST API require <i class="string">Cookie</i> header to be sent with them with a session cookie containing a valid <a href="#rest-standard-session">session identifier</a>. Each request's URL starts with <i class="string">https://plug.dj/_/</i>. If the request contains any content it must have <b class="code">Content-Type</b> header set to <i class="string">application/json</i>.<br />
If no Request payload, Request variables or Response payload section is defined, then such is empty or doesn't exist.
<h2><a id="rest-standard" href="#rest-standard">Standard response elements</a></h2>
<h4><a id="rest-standard-response-codes" href="#rest-standard-response-codes">Standard response codes</a></h4>
These are the response statuses alone with their respective HTTP response codes that you can receive from all endpoints.
<ul class="jsondesc">
<li class="string"><b>ok 200</b> - Successfully completed the request. Included in all response payloads, even if no data is returned.</li>
<li class="string"><b>notAuthorized 401</b> - Authentication required. Returned when no <a href="#rest-standard-session">session</a> is supplied or the session identificator is invalid.</li>
<li class="string"><b>notAuthorized 401</b> - Returned from all endpoints but the ones marked <span class="badge unnameduser">Unnamed user</span> if this user is logged in but doesn't have a name yet. <b>TODO: u sure?</b></li>
<li class="string"><b>notInRoom 400</b> - Returned from all endpoints marked with <span class="badge isinroom">Is in room</span> when this user isn't in a room. May be returned even if websocket is receiving messages from a room.</li>
<li class="string"><b>maintenanceMode 403</b> - Returned when plug.dj is in maintenance mode.</li>
<li class="string"><b>*html 400 page* 400</b> - Invalid or empty http request payload.</li>
<li class="string"><b>500 500</b> - Invalid or empty http request payload. Please note that the <b class="code">status</b> field is an integer in this case.</li>
<li class="string"><b>*empty payload* 503</b> - Plug.dj is down. Expect this to happen <strike>from time to time</strike> constantly.</li>
<li class="string"><b>TODO</b> - Write more about those if any more of them exists.</li>
</ul>
<h4><a id="rest-standard-response-payload" href="#rest-standard-response-payload">Standard response payload</a></h4>
<ul class="jsondesc">
<li class="object">Root object.
<ul>
<li class="array"><b>data</b> - Varies across different endpoints.</li>
<li class="object"><b>meta</b> - Unknown. Seems to be always empty.</li>
<li class="string"><b>status</b> - Status code. <i class="string">ok</i> if request was successfully completed, other values vary across different endpoints.</li>
<li class="float"><b>time</b> - Time it took to complete the request in milliseconds.</li>
</ul>
</li>
</ul>
Below is the format used to describe different <b class="code">data</b> contents depending on <b class="code">status</b>:
<ul class="jsondesc">
<li class="array"><b>ok 200</b> - Status code this payload description corresponds to followed by HTTP response code.
<ul>
<li class="object">Root object.
<ul>
<li class="string"><b>fieldName</b> - Description describing it's purpose. Icon represents the type of that field. Example below.</li>
<li class="integer"><b>currentDJ</b> - Current DJ's user ID.</li>
</ul>
</li>
</ul>
</li>
<li class="array"><b>anotherStatus 403</b> - Another response status.
<ul>
<li class="object">Object #1
<ul>
<li class="boolean"><b>booleanValue</b> - <i class="boolean">true</i> if something, <i class="boolean">false</i> otherwise.</li>
</ul>
</li>
<li class="object">Object #2
<ul>
<li class="string">...</li>
</ul>
</li>
</ul>
</li>
<li class="array"><b>yetAnotherOne 400</b> - One more status code, this time with empty <b class="code">data</b> array.</li>
</ul>
<h4><a id="rest-standard-session" href="#rest-standard-session">Session identificator</a></h4>
Every response from Plug.dj contains a <i class="string">Set-Cookie</i> header containing <i class="string">session</i> cookie. After acquiring that session ID you should use it for every request you make to the REST API, as it's what Plug.dj uses to tell that it's you.
<h2><a id="rest-endpoints" href="#rest-endpoints">Endpoints</a></h2>
<h3><a id="rest-post-auth-login" href="#rest-post-auth-login">POST auth/login</a> <span class="badge notauthed">Not authenticated</span></h3>
Used for authenticating user using Plug.dj account.
<h4><a id="rest-post-auth-login-request" href="#rest-post-auth-login-request">Request payload</a></h4>
<ul class="jsondesc">
<li class="object">Root object.
<ul>
<li class="string"><b>csrf</b> - A string retrieved from rooms HTML. More about CSRF on <a href="http://en.wikipedia.org/wiki/Cross-site_request_forgery">Wikipedia</a>.</li>
<li class="string"><b>email</b> - User's email.</li>
<li class="string"><b>password</b> - User's password.</li>
</ul>
</li>
</ul>
<h4><a id="rest-post-auth-login-response" href="#rest-post-auth-login-response">Response payload</a></h4>
<ul class="jsondesc">
<li class="array"><b>ok 200</b>
<ul>
<li class="object">Users object. See <a href="#rest-get-users-me-response">GET users/me <b class="code">ok 200</b> response payload</a>.</li>
</ul>
</li>
<li class="array"><b>csrfTokenExpired 403</b> - CRSF token not specified, invalid or expired.
<ul>
<li class="string"><i class="string">This CSRF token has expired.</i></li>
</ul>
</li>
<li class="array"><b>requestError 400</b> - Missing <b class="code">email</b> or <b class="code">password</b> fields in request payload.
<ul>
<li class="string"><i class="string">email is required</i> or <i class="string">password is required</i></li>
</ul>
</li>
<li class="array"><b>badLogin 401</b> - Invalid email and password combination.</li>
</ul>
<h3><a id="rest-post-auth-facebook" href="#rest-post-auth-facebook">POST auth/facebook</a> <span class="badge notauthed">Not authenticated</span></h3>
Used for authenticating user using Facebook account.<br />
<br />
<b>TODO</b>
<h3><a id="rest-get-auth-token" href="#rest-get-auth-token">GET auth/token</a></h3>
Returns an auth token used by WebSocket to authenticate to the server.
<h4><a id="rest-post-auth-login-response" href="#rest-post-auth-login-response">Response payload</a></h4>
<ul class="jsondesc">
<li class="array"><b>ok 200</b>
<ul>
<li class="string">The requested auth token.</li>
</ul>
</li>
</ul>
<h3><a id="rest-delete-auth-session" href="#rest-delete-auth-session">DELETE auth/session</a></h3>
<b>TODO</b>
<h3><a id="rest-post-auth-reset-me" href="#rest-post-auth-reset-me">POST auth/reset/me</a></h3>
<b>TODO</b>
<h3><a id="rest-post-users-signup" href="#rest-post-users-signup">POST users/signup</a> <span class="badge notauthed">Not authenticated</span></h3>
request: {"csrf":"f000ea39af045ef7640adf33b1dc07708e1156361fc95a68b6d114e0025c","email":"email","password":"pass","confirm":"pass","challenge":"long challenge thingy","response":"captcha"}<br />
ok 200: {"data": [{"avatarID": null, "badge": null, "blurb": null, "gRole": 0, "id": 5573564, "joined": "2014-12-02 17:04:33.804045", "level": 1, "slug": null, "status": 0, "username": null}], "meta": {}, "status": "ok", "time": 314.29505348205566}
<b>TODO</b>
<h3><a id="rest-get-users-validate-1" href="#rest-get-users-validate-1">GET users/validate/$1</a> <span class="badge unnameduser">Unnamed user</span></h3>
Used to check username before making a request to <a href="#rest-post-users">POST users</a>.
<h4><a id="rest-get-users-validate-1-response" href="#rest-get-users-validate-1-response">Request variables</a></h4>
<ul class="jsondesc">
<li class="string"><b>$1</b> - URL encoded username to test.</li>
</ul>
<h4><a id="rest-get-users-validate-1-response" href="#rest-get-users-validate-1-response">Response payload</a></h4>
<ul class="jsondesc">
<li class="array"><b>ok 403</b> - Username is shorter than 2 characters or creates a slug that's already in use.</li>
<li class="array"><b>requestError 403</b> - Username is longer than 24 characters.
<ul>
<li class="object">Root object.
<ul>
<li class="array"><b>username</b>
<ul>
<li class="string"><i class="string">usernameLong</i></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
ok 200: {"data": [{"slug": "users-slug"}], "meta": {}, "status": "ok", "time": 9.778976440429688}<br />
ok 403 (too short (one char), in use or contains illegal chars like @(?)): {"data": [], "meta": {}, "status": "ok", "time": 5.145072937011719}
requestError 400 (more than 24 chars): {
"data": [
{
"username": [
"usernameLong"
]
}
],
"meta": {},
"status": "requestError",
"time": 8.69297981262207
}
<b>TODO</b>
<h3><a id="rest-post-users" href="#rest-post-users">POST users</a> <span class="badge unnameduser">Unnamed user</span></h3>
Used to set this users username and avatar for the first time.
<h4><a id="rest-post-users-request" href="#rest-post-users-request">Request payload</a></h4>
<ul class="jsondesc">
<li class="object">Root object.
<ul>
<li class="string"><b>avatarID</b> - This user's first avatar. Value: <i class="string">base[01-15]</i></li>
<li class="string"><b>username</b> - This user's first username.</li>
</ul>
</li>
</ul>
<h4><a id="rest-post-users-response" href="#rest-post-users-response">Response payload</a></h4>
<ul class="jsondesc">
<li class="array"><b>ok 200</b> - See <a href="#rest-get-users-1-response">GET users/$1 response payload</a></li>
<li class="array"><b>requestError 400</b> - Missing <b class="code">avatarID</b> field or invalid <b class="code">avatarID</b> value.
<ul>
<li class="object">Root object.
<ul>
<li class="array"><b>avatarID</b>
<ul>
<li class="string"><i class="string">avatarIDInvalid</i></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li class="array"><b>requestError 400</b> - Missing <b class="code">username</b> field or it's value is shorter than 3 characters.
<ul>
<li class="object">Root object.
<ul>
<li class="array"><b>username</b>
<ul>
<li class="string"><i class="string">usernameShort</i></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li class="array"><b>requestError 400</b> - <b class="code">username</b> is longer than 24 characters.
<ul>
<li class="object">Root object.
<ul>
<li class="array"><b>username</b>
<ul>
<li class="string"><i class="string">usernameShort</i></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li class="array"><b>alreadySignedUp 403</b> - This user already chose username and first avatar.
<ul>
<li class="string"><i class="string">This request was understood but is forbidden.</i></li>
</ul>
</li>
</ul>
<h3><a id="rest-get-users-1" href="#rest-get-users-1">GET users/$1</a></h3>
Returns all public data about requested user.
<h4><a id="rest-get-users-1-variables" href="#rest-get-users-1-variables">Request variables</a></h4>
<ul class="jsondesc">
<li class="integer"><b>$1</b> - The ID of the desired user.</li>
</ul>
<h4><a id="rest-get-users-1-response" href="#rest-get-users-1-response">Response payload</a></h4>
<ul class="jsondesc">
<li class="array"><b>ok 200</b>
<ul>
<li class="object">Root object.
<ul>
<li class="string"><b>avatarID</b> - User's avatar ID.</li>
<li class="string"><b>badge</b> - User's <a href="#std-vars-badge">badge ID</a>. Nullable.</li>
<li class="integer"><b>gRole</b> - User's <a href="#std-vars-global-role">global role</a>. Nullable.</li>
<li class="integer"><b>id</b> - User's ID.</li>
<li class="string"><b>joined</b> - User's join <a href="#std-vars-date">date</a>.</li>
<li class="string"><b>language</b> - This user's <a href="#std-vars-language">language</a>.</li>
<li class="integer"><b>level</b> - User's experience level.</li>
<li class="string"><b>slug</b> - User's name without some characters. Used for profile URLs.</li>
<li class="string"><b>username</b> - User's display name. May change.</li>
</ul>
</li>
</ul>
</li>
<li class="array"><b>notFound 404</b> - User with requested ID doesn't exist.</li>
</ul>
<h3><a id="rest-get-users-me" href="#rest-get-users-me">GET users/me</a></h3>
Returns all data about this user.
<h4><a id="rest-get-users-me-response" href="#rest-get-users-me-response">Response payload</a></h4>
<ul class="jsondesc">
<li class="array"><b>200 ok</b>
<ul>
<li class="object">Root object. In addition to the fields below, contains all fields from <a href="#rest-get-users-1-response">GET users/$1 <b class="code">200 ok</b> response payload</a>.
<ul>
<li class="boolean"><b>canGift</b> - <i class="boolean">true</i> if this user can gift Plug Notes to other users, <i class="boolean">false</i> otherwise.</li>
<li class="integer"><b>ep</b> - Amount of this user's Plug Points.</li>
<li class="array"><b>ignores</b> - Array containing IDs of all users ignored by this user.</li>
<li class="array"><b>notifications</b> - This user's notifications. See: <a href="#std-objs-notification">standard notification object</a>.</li>
<li class="integer"><b>pp</b> - Amount of this user's Plug Notes.</li>
<li class="boolean"><b>pw</b> - <i class="boolean">true</i> if this user can reset his password, <i class="boolean">false</i> otherwise. Related to Facebook authentication.</li>
<li class="object"><b>settings</b> - Contains some of this users settings.
<ul>
<li class="integer"><b>chatTimestamps</b> - Chat timestamp format. Values: <i class="integer">24</i> if 24 hour format, <i class="integer">12</i> if 12 hour format, <i class="integer">0</i> if disabled.</li>
<li class="boolean"><b>emoji</b> - <i class="boolean">true</i> if emojis are enabled, <i class="boolean">false</i> otherwise.</li>
<li class="boolean"><b>notifyDJ</b> - <i class="boolean">true</i> if notification about new DJ should be displayed on advance, <i class="boolean">false</i> otherwise.</li>
<li class="boolean"><b>notifyFriendJoin</b> - <i class="boolean">true</i> if notification about user on friends list should be displayed when they join, <i class="boolean">false</i> otherwise.</li>
<li class="boolean"><b>notifyScore</b> - <i class="boolean">true</i> if notification about votes for previous song should be displayed, <i class="boolean">false</i> otherwise.</li>
<li class="boolean"><b>tooltips</b> - <i class="boolean">true</i> if tooltips should be shown, <i class="boolean">false</i> otherwise.</li>
<li class="boolean"><b>videoOnly</b> - <i class="boolean">true</i> if video only mode is enabled, <i class="boolean">false</i> otherwise.</li>
</ul>
</li>
<li class="integer"><b>xp</b> - Amount of this user's experience points.</li>
</ul>
</li>
</ul>
</li>
</ul>
<h3><a id="rest-get-users-me-history" href="#rest-get-users-me-history">GET users/me/history</a></h3>
Returns at most last 50 songs played by this user.
<!--
{"data": [
{
"id": "0000000-0000-0000-0000-000000000000",
"media": {standard media object},
"room": {"name": "Room name", "slug": "roomslug"},
"score": {"grabs": int, "listeners": int, "negative": int, "positive": int, "skipped": int},
"timestamp": "2014-10-11 21:11:02.203029",
"user": {"id": user id, "username": "user's name"}
}, ...
], "meta": {}, "status": "ok", "time": 2.4499893188476562} -->
<b>TODO</b>
<b>TODO: check what happens if you never played any songs (empty data array?)</b>
<h4><a id="rest-put-users-avatar-response" href="#rest-put-users-avatar-response">Response payload</a></h4>
<b>TODO: rephrase some of that?</b>
<ul class="jsondesc">
<li class="array"><b>ok 200</b> - Array containing at most last 50 songs played by this user.
<ul>
<li class="string"><b>id</b> - Song's history ID.</li>
<li class="object"><b>media</b> - Song's <a href="#std-objs-media">media</a> object.</li>
<li class="object"><b>room</b> - Room song was played in.
<ul>
<li class="string"><b>name</b> - Room's name.</li>
<li class="string"><b>slug</b> - Room's slug.</li>
</ul>
</li>
<li class="object"><b>score</b> - Song's rating after that play.
<ul>
<li class="integer"><b>grabs</b> - Amount of grabs song received.</li>
<li class="integer"><b>listeners</b> - Amount of users in the room when the song was played.</li>
<li class="integer"><b>negative</b> - Amount of mehs song received.</li>
<li class="integer"><b>positive</b> - Amount of woots song received.</li>
<li class="integer"><b>skipped</b> - <b>TODO</b></li>
</ul>
</li>
<li class="string"><b>timestamp</b> - <a href="#std-vars-date">Date</a> when this song started playing.</li>
<li class="object"><b>user</b> - User who played this song. Always this user.
<ul>
<li class="integer"><b>id</b> - This user's ID.</li>
<li class="string"><b>name</b> - This user's username.</li>
</ul>
</li>
</ul>
</li>
</ul>
<h3><a id="rest-get-users-me-transactions" href="#rest-get-users-me-transactions">GET users/me/transactions</a></h3>
<b>TODO</b>
<h3><a id="rest-post-users-bulk" href="#rest-post-users-bulk">POST users/bulk</a></h3>
<b>TODO</b>
<h3><a id="rest-put-users-avatar" href="#rest-put-users-avatar">PUT users/avatar</a></h3>
Used to change this user's avatar.
<h4><a id="rest-put-users-avatar-request" href="#rest-put-users-avatar-request">Request payload</a></h4>
<ul class="jsondesc">
<li class="object">Root object.
<ul>
<li class="string"><b>id</b> - This user's new avatar ID.</li>
</ul>
</li>
</ul>
<h4><a id="rest-put-users-avatar-response" href="#rest-put-users-avatar-response">Response payload</a></h4>
<ul class="jsondesc">
<li class="array"><b>requestError 403</b> - Invalid <b class="code">id</b> value.</li>
<li class="array"><b>requestError 400</b> - Missing <b class="code">id</b> field.
<ul>
<li class="string"><i class="string">id is required</i></li>
</ul>
</li>
</ul>
<h3><a id="rest-put-users-language" href="#rest-put-users-language">PUT users/language</a></h3>
Used to change this user's language.
<h4><a id="rest-put-users-language-request" href="rest-put-users-language-request">Request payload</a></h4>
<ul class="jsondesc">
<li class="object">Root object.
<ul>
<li class="string"><b>language</b> - User's new <a href="#std-vars-language">language</a>.</li>
</ul>
</li>
</ul>
<h4><a id="rest-put-users-language-response" href="rest-put-users-language-response">Response payload</a></h4>
<ul class="jsondesc">
<li class="array"><b>requestError 400</b> - Invalid <b class="code">language</b> value.</li>
<li class="array"><b>requestError 400</b> - Missing <b class="code">language</b> field.
<ul>
<li class="string"><i class="string">language is required</i></li>
</ul>
</li>
</ul>
<h3><a id="rest-put-users-settings" href="#rest-put-users-settings">PUT users/settings</a></h3>
Used to change this user's settings.
<h4><a id="rest-put-users-settings-request" href="rest-put-users-settings-request">Request payload</a></h4>
<b>TODO</b>
<h4><a id="rest-put-users-settings-response" href="rest-put-users-settings-response">Response payload</a></h4>
<b>TODO</b>
<h3><a id="rest-put-profile-blurb" href="#rest-put-profile-blurb">PUT profile/blurb</a></h3>
Used to change this user's blurb (profile description).
<h4><a id="rest-put-profile-blurb-request" href="#rest-put-profile-blurb-request">Request payload</a></h4>
<ul class="jsondesc">
<li class="object">Root object.
<ul>
<li class="string"><b>blurb</b> - This user's new blurb. Gets cut to 80 characters if longer than that.</li>
</ul>
</li>
</ul>
<h4><a id="rest-put-profile-blurb-response" href="#rest-put-profile-blurb-response">Response payload</a></h4>
<ul class="jsondesc">
<li class="array"><b>requestError 400</b> - Missing <b class="code">blurb</b> field.
<ul>
<li class="string"><i class="string">blurb is required</i></li>
</ul>
</li>
</ul>
<h3><a id="rest-get-rooms-q-1-page-2-limit-3" href="#rest-get-rooms-q-1-page-2-limit-3">GET rooms?q=$1&page=$2&limit=$3</a></h3>
<h4><a id="rest-get-rooms-q-1-page-2-limit-3-variables" href="#rest-get-rooms-q-1-page-2-limit-3-variables">Request variables</a></h4>
<ul class="jsondesc">
<li class="string"><b>$1</b> - Search query.</li>
<li class="integer"><b>$2</b> - Page number.</li>
<li class="integer"><b>$3</b> - Maximum amount of rooms to return.</li>
</ul>
<h4><a id="rest-get-rooms-q-1-page-2-limit-3-response" href="#rest-get-rooms-q-1-page-2-limit-3-response">Response payload</a></h4>
<ul class="jsondesc">
<li class="object"><b>ok 200</b>
<ul>
<li class="array"><b>data</b> - Array containing requested rooms.
<ul>
<li class="object">Root object.
<ul>
<li class="integer"><b>capacity</b> - Unknown. Nullable.</li>
<li class="string"><b>cid</b> - Room's current media's CID.</li>
<li class="string"><b>dj</b> - Room's current DJ's username.</li>
<li class="boolean"><b>favorite</b> - <i class="boolean">true</i> if this user favorited this room, <i class="boolean">false</i> otherwise.</li>
<li class="integer"><b>format</b> - Room's current media's source. See <a href="#std-vars-media-format">standard media formats</a>.</li>
<li class="string"><b>host</b> - Room's host's username.</li>
<li class="integer"><b>id</b> - Room's ID.</li>
<li class="string"><b>image</b> - Room's current media's thumbnail URL.</li>
<li class="string"><b>name</b> - Room's name.</li>
<li class="integer"><b>population</b> - Room's user count.</li>
<li class="boolean"><b>private</b> - Unknown. <b>TODO</b></li>
<li class="string"><b>slug</b> - Room's slug.</li>
</ul>
</li>
</ul>
</li>
<li class="object"><b>meta</b>
<ul>
<li class="integer"><b>limit</b> - Limit used for this request. Default: <i class="integer">50</i></li>
<li class="integer"><b>page</b> - Page returned this request.</li>
<li class="integer"><b>total</b> - Total amount of rooms on Plug.dj.</li>
</ul>
</li>
</ul>
</li>
</ul>
<h3><a id="rest-get-rooms-favorites-page-1-limit-2" href="#rest-get-rooms-favorites-page-1-limit-2">GET rooms/favorites?page=$1&limit=$2</a></h3>
<b>TODO</b>
<h3><a id="rest-post-rooms" href="#rest-post-rooms">POST rooms</a></h3>
Used to create rooms.<br />
<b>TODO: check what happens if your level is not high enough</b>
<h4><a id="rest-post-rooms-request" href="#rest-post-rooms-request">Request payload</a></h4>
<ul class="jsondesc">
<li class="object">Root object.
<ul>
<li class="string"><b>name</b> - New room's name.</li>
<li class="string"><b>private</b> - New room's visibility. <i class="boolean">true</i> if private, <i class="boolean">false</i> if public.</li>
</ul>
</li>
</ul>
<h4><a id="rest-post-rooms-response" href="#rest-post-rooms-response">Response payload</a></h4>
<ul class="jsondesc">
<li class="array"><b>ok 200</b>
<ul>
<li class="object">Root object.
<ul>
<li class="integer"><b>id</b> - New room's ID.</li>
<li class="string"><b>name</b> - New room's name.</li>
<li class="string"><b>slug</b> - New room's slug.</li>
</ul>
</li>
</ul>
</li>
<li class="array"><b>requestError 403</b> - Room with slug generated from that name already exists.
<ul>
<li class="string"><i class="string">Room already exists</i></li>
</ul>
</li>
<li class="array"><b>requestError 400</b> - Name is empty or longer than 32 characters.
<ul>
<li class="object">Root object.
<ul>
<li class="string"><i class="string">Room name must be at least 1 character in length and no more than 32</i></li>
</ul>
</li>
</ul>
</li>
<li class="array"><b>requestError 400</b> - Missing <b class="code">name</b> field.
<ul>
<li class="string"><i class="string">name is required</i></li>
</ul>
</li>
<li class="array"><b>requestError 400</b> - Missing <b class="code">private</b> field.
<ul>
<li class="string"><i class="string">private is required</i></li>
</ul>
</li>
</ul>
<h3><a id="rest-get-rooms-validate-1" href="#rest-get-rooms-validate-1">GET rooms/validate/$1</a></h3>
Used to check if room name enetered by user is a correct name for a room and if it's not already in use. Please note that leaving <b class="code">$1</b> empty results in http 404 response.<br />
<b>TODO: check what happens if your level is not high enough</b>
<h4><a id="rest-rooms-validate-1-variables" href="#rest-rooms-validate-1-variables">Request variables</a></h4>
<ul class="jsondesc">
<li class="string"><b>$1</b> - Tested room name.</li>
</ul>
<h4><a id="rest-get-rooms-validate-1-response" href="#rest-get-rooms-validate-1-response">Response payload</a></h4>
<ul class="jsondesc">
<li class="array"><b>ok 200</b>
<ul>
<li class="object">Root object.
<ul>
<li class="string"><b>slug</b> - Room slug created from tested room name.</li>
</ul>
</li>
</ul>
</li>
<li class="array"><b>requestError 403</b> - Invalid name.</li>
</ul>
<h3><a id="rest-post-rooms-update" href="#rest-post-rooms-update">POST rooms/update</a> <span class="badge isinroom">Is in room</span> <span class="badge role-cohost">Co-Host+</span></h3>
Used to update rooms description, name and welcome message. At least one of the request fields has to be present.
<h4><a id="rest-post-rooms-update-request" href="#rest-post-rooms-update-request">Request payload</a></h4>
<ul class="jsondesc">
<li class="object">Root object.
<ul>
<li class="string"><b>description</b> - New room description.</li>
<li class="string"><b>name</b> - New room name.</li>
<li class="string"><b>welcome</b> - New room welcome message.</li>
<li class="string"><b>minChatLevel</b> - New minimum chat level.</li>
</ul>
</li>
</ul>
<h4><a id="rest-post-rooms-update-response" href="#rest-post-rooms-update-response">Response payload</a></h4>
<ul class="jsondesc">
<li class="array"><b>requestError 400</b> - At least one field is required.
<ul>
<li class="string"><i class="string">At least 1 of these fields is required: name, description, welcome, minChatLevel</i></li>
</ul>
</li>
<li class="array"><b>requestError 400</b> - This user is not a staff member.
<ul>
<li class="string"><i class="string">Not a staff member of room</i></li>
</ul>
</li>
<li class="array"><b>requestError 403</b> - This user's role has to be at least Co-Host.
<ul>
<li class="string"><i class="string">Must be a Co-Host or Host to edit room meta</i></li>
</ul>
</li>
</ul>
<h3><a id="rest-get-rooms-state" href="#rest-get-rooms-state">GET rooms/state</a> <span class="badge isinroom">Is in room</span></h3>
Used to get all data about room this user is currently in.
<h4><a id="rest-get-rooms-state-response" href="#rest-get-rooms-state-response">Response payload</a></h4>
<ul class="jsondesc">
<li class="array"><b>ok 200</b>
<ul>
<li class="object">Root object.
<ul>
<li class="object"><b>booth</b>
<ul>
<li class="integer"><b>currentDJ</b> - Currently DJing user's ID.</li>
<li class="boolean"><b>isLocked</b> - </li>
<li class="boolean"><b>shouldCycle</b> - </li>
<li class="array"><b>waitingDJs</b> - An array containing IDs of users in wait list.</li>
</ul>
</li>
<li class="array"><b>fx</b> - <b>TODO</b></li>
<li class="array"><b>grabs</b> - An array containing IDs as strings of users who grabbed this song.</li>
<li class="object"><b>meta</b>
<ul>
<li class="string"><b>description</b> - Room's description.</li>
<li class="boolean"><b>favorite</b> - <i class="boolean">true</i> if this user favorited this room, <i class="boolean">false</i> otherwise.</li>
<li class="integer"><b>hostId</b> - Room's host's ID.</li>
<li class="string"><b>hostName</b> - Room's host's username.</li>
<li class="integer"><b>id</b> - Room's ID.</li>
<li class="integer"><b>minChatLevel</b> - Minimal experience level for a user to be able to chat.</li>
<li class="integer"><b>population</b> - Amount of users in this room.</li>
<li class="string"><b>slug</b> - Room's slug.</li>
<li class="string"><b>welcome</b> - Room's welcome message. <i class="string">%u</i> is replaced by Plug.dj to this user's username.</li>
</ul>
</li>
<li class="object"><b>mutes</b> - Array of integers containing IDs of muted users as strings as keys and seconds until they're unmuted as values.</li>
<li class="object"><b>playback</b>
<ul>
<li class="string"><b>historyID</b> - Currently played song's history ID.</li>
<li class="object"><b>media</b> - See <a href="#std-objs-media">standard media object</a>.</li>
<li class="integer"><b>playlistID</b> - ID of the playlist currently played song is in.</li>
<li class="string"><b>startTime</b> - <a href="#std-vars-date">Date</a> of when currently played song started playing.</li>
</ul>
</li>
<li class="integer"><b>role</b> - This user's role in this room.</li>
<li class="array"><b>users</b> - Array containing all users in this room. <b>TODO: add format</b></li>
<li class="array"><b>votes</b> - Array containing IDs as strings of every user who voted as keys and value <i class="integer">1</i> if the user wooted for this song or <i class="integer">-1</i> if the user mehed.</li>
</ul>
</li>
</ul>
</li>
</ul>
<h3><a id="rest-get-rooms-users" href="#rest-get-rooms-users">GET rooms/users</a> <span class="badge isinroom">Is in room</span></h3>
<b>TODO</b>
<h3><a id="rest-get-rooms-history" href="#rest-get-rooms-history">GET rooms/history</a> <span class="badge isinroom">Is in room</span></h3>
<b>TODO</b>
<h3><a id="rest-get-rooms-me" href="#rest-get-rooms-me">GET rooms/me</a></h3>
Returns your rooms.<br />
<br />
<b>TODO</b>
<b>TODO: check what happens if you dont have high enough level</b>
<h3><a id="rest-post-rooms-join" href="#rest-post-rooms-join">POST rooms/join</a></h3>
<b>TODO</b>
<h3><a id="rest-post-rooms-favorites" href="#rest-post-rooms-favorites">POST rooms/favorites</a></h3>
<b>TODO</b>
<h3><a id="rest-delete-rooms-favorites-1" href="#rest-delete-rooms-favorites-1">DELETE rooms/favorites/$1</a></h3>
<b>TODO</b>
<h3><a id="rest-post-votes" href="#rest-post-votes">POST votes</a> <span class="badge isinroom">Is in room</span></h3>
Used to vote for the currently played song. If the <b class="code">historyID</b> value doesn't match the one of currently played song's or there is no song playing at the moment then the vote doesn't count, but the response code is still <b class="code">ok 200</b>.<br />
<h4><a id="rest-post-votes-request" href="#rest-post-votes-request">Request payload</a></h4>
<ul class="jsondesc">
<li class="object">Root object.
<ul>
<li class="integer"><b>direction</b> - <i class="integer">1</i> if woot, <i class="integer">-1</i> if meh.</li>
<li class="string"><b>historyID</b> - Currently played song's history ID.</li>
</ul>
</li>
</ul>
<h4><a id="rest-post-votes-response" href="#rest-post-votes-response">Response payload</a></h4>
<ul class="jsondesc">
<li class="array"><b>invalidVote 400</b> - Invalid <b class="code">direction</b> value.</li>
<li class="array"><b>requestError 400</b> - Missing <b class="code">direction</b> field.
<ul>
<li class="string"><i class="string">direction is required</i></li>
</ul>
</li>
<li class="array"><b>requestError 400</b> - Missing <b class="code">historyID</b> field.
<ul>
<li class="string"><i class="string">historyID is required</i></li>
</ul>
</li>
</ul>
<h3><a id="rest-post-grabs" href="#rest-post-grabs">POST grabs</a> <span class="badge isinroom">Is in room</span></h3>
Used to grab currently played song.
<h4><a id="rest-post-grabs-request" href="#rest-post-grabs-request">Request payload</a></h4>
<ul class="jsondesc">
<li class="object">Root object.
<ul>
<li class="integer"><b>playlistID</b> - ID of the playlist the song should be added to. <b>TODO: rephrase this</b></li>
<li class="string"><b>historyID</b> - Currently played song's history ID.</li>
</ul>
</li>
</ul>
<h4><a id="rest-post-grabs-response" href="#rest-post-grabs-response">Response payload</a></h4>
<ul class="jsondesc">
<li class="array"><b>ok 200</b>
<ul>
<li class="object">Root object.
<ul>
<li class="boolean"><b>active</b> - <i class="boolean">true</i> if the playlist is active, <i class="boolean">false</i> otherwise.</li>
<li class="integer"><b>count</b> - Playlist's new item count.</li>
<li class="integer"><b>id</b> - Playlist's ID.</li>
<li class="string"><b>name</b> - Playlist's name.</li>
</ul>
</li>
</ul>
</li>
<li class="array"><b>forbidden 403</b> - <b class="code">historyID</b> doesn't match the one of currently played song's or specified playlist doesn't exist/belong to this user or this user is currently DJing.
<ul>
<li class="string"><i class="string">This request was understood but is forbidden.</i></li>
</ul>
</li>
</ul>
<h3><a id="rest-get-booth" href="#rest-get-booth">GET booth</a> <span class="badge isinroom">Is in room</span></h3>
<b>TODO</b>
<h3><a id="rest-post-booth" href="#rest-post-booth">POST booth</a> <span class="badge isinroom">Is in room</span></h3>
Add yourself to waitlist.<br />
<br />
<b>TODO</b>
<h3><a id="rest-delete-booth" href="#rest-delete-booth">DELETE booth</a> <span class="badge isinroom">Is in room</span></h3>
Quit DJing.<br />
<br />
<b>TODO</b>
<h3><a id="rest-post-booth-add" href="#rest-post-booth-add">POST booth/add</a> <span class="badge isinroom">Is in room</span> <span class="badge role-bouncer">Bouncer+</span></h3>
Used to add other users to the wait list.
<h4><a id="rest-post-booth-add-request" href="#rest-post-booth-add-request">Request payload</a></h4>
<ul class="jsondesc">
<li class="object">Root object.
<ul>
<li class="integer"><b>id</b> - Target's ID.</li>
</ul>
</li>
</ul>
<h4><a id="rest-post-booth-add-response" href="#rest-post-booth-add-response">Response payload</a></h4>
<ul class="jsondesc">
<li class="array"><b>requestError 403</b> - This user's role has to be at least bouncer.
<ul>
<li class="string"><i class="string">Not a moderator in the room</i></li>
</ul>
</li>
<li class="array"><b>noValidPlaylist 403</b> - Target has no activated playlist or it is empty.
<ul>
<li class="string"><i class="string">This request was understood but is forbidden.</i></li>
</ul>
</li>
<li class="array"><b>roomMismatch 400</b> - Target's not in this room.</li>
</ul>
<h3><a id="rest-delete-booth-remove-1" href="#rest-delete-booth-remove-1">DELETE booth/remove/$1</a> <span class="badge isinroom">Is in room</span></h3>
$1 - id of user to remove<br />
403 (as user): {
"data": [
"Not a moderator in the room"
],
"meta": {},
"status": "requestError",
"time": 7.232189178466797
}
<b>TODO</b>
<b>TODO: add role badge</b>
<h3><a id="rest-post-booth-move" href="#rest-post-booth-move">POST booth/move</a> <span class="badge isinroom">Is in room</span></h3>
Used to move users on the wait list.
<h4><a id="rest-post-booth-move-request" href="#rest-post-booth-move-request">Request payload</a></h4>
<ul class="jsondesc">
<li class="object">Root object.
<ul>
<li class="integer"><b>userID</b> - Target's user ID.</li>
<li class="integer"><b>position</b> - New target's position.</li>
</ul>
</li>
</ul>
<h4><a id="rest-post-booth-move-response" href="#rest-post-booth-move-response">Response payload</a></h4>
<ul class="jsondesc">
<li class="array"><b>requestError 400</b> - Missing <b class="code">userID</b> field.
<ul>
<li class="string"><i class="string">userID is required</i></li>
</ul>
</li>
<li class="array"><b>requestError 400</b> - Missing <b class="code">position</b> field.
<ul>
<li class="string"><i class="string">position is required</i></li>
</ul>
</li>
</ul>
<b>TODO</b>
<b>TODO: add role badge</b>
<h3><a id="rest-post-booth-skip" href="#rest-post-booth-skip">POST booth/skip</a> <span class="badge isinroom">Is in room</span></h3>
<b>TODO</b>
<b>TODO: add role badge</b>
<h3><a id="rest-post-booth-skip-me" href="#rest-post-booth-skip-me">POST booth/skip/me</a> <span class="badge isinroom">Is in room</span> <span class="badge isdjing">Is DJing</span></h3>
<b>TODO</b>
<h3><a id="rest-put-booth-lock" href="#rest-put-booth-lock">PUT booth/lock</a> <span class="badge isinroom">Is in room</span></h3>
{"isLocked":true,"removeAllDJs":false}<br />
<h4><a id="rest-put-booth-lock-request" href="#rest-put-booth-lock-request">Request payload</a></h4>
<ul class="jsondesc">