-
Notifications
You must be signed in to change notification settings - Fork 16
/
meetings-api-examples.json
5997 lines (5997 loc) · 172 KB
/
meetings-api-examples.json
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
{
"info": {
"_postman_id": "6ffd0285-a021-495f-a256-30b1029909f6",
"name": "Meetings RESTful API Examples",
"description": "These tests excersise the /meetings API and validate the results. They are designed to provide developers who are unfamilar with the Meetings API with a set of examples to understand the basic concepts of how to use them.\n\n1) Create a non recurring meeting tommorow and verify it is gettable\n2) Create a recurring meeting starting tommorow recurring daily for 10 instances, and verify it is gettable\n3) Create a second non recurring meeting tommorow and modify some of its attributes\n\n\nBefore running these tests the following environment variables must be set:\n* WEBEX_TOKEN -- an OAuth token for a user configured for meetings in the test environment. These tests require a token with all the meetings scopes and the spark:people_read scopy. To get started quickly, developers can copy their temporary token from the [Webex For Developers Gettings Started Guide](https://developer.webex.com/docs/api/getting-started#accounts-and-authentication). \n* MEETINGS_API_URL -- the URL of the meetings API under test, generally the default value of \"https://webexapis.com/v1/\" does not need to be changed\n* TIMEZONE_STRING -- the [Time Zone String](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) that you want your results to be returned in (ie: \"America/New_York\" for the US East Coast)\n* UTCOFFSET - the [offset from UTC Time](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) to set your meetings (ie: \"-04:00\" for New York during Daylight Savings Time). This is used by the tests pre-request scripts to create start and end time parameters that will make sense in your timezone\n* OTHER_USERS_EMAIL -- an email of another CI user to invite to a meeting. This user must belong to the same org as the caller of the APIs in order for the PUT /meetingInvitees sample to work.\n\nPre set:\n* MAX_RESULTS -- the max number of meetings to query for -- initially set to 2\n\n\n",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
"_exporter_id": "17540584"
},
"item": [
{
"name": "Meeting",
"item": [
{
"name": "Create a non recurring meeting for tommorow",
"event": [
{
"listen": "prerequest",
"script": {
"exec": [
"",
"var moment = require('moment');",
"// If the \"timezone\" field is set, then the start/end time must match",
"// If you are comfortable scheduling everything in UTC times",
"// simply omit the timezone field from the request body",
"",
"// We will use the UTCOFFSET and TIMEZONE_STRING environment variables",
"// The API will return an error if these don't match",
"var utcoffset = pm.variables.get(\"UTCOFFSET\");",
"// Start tommorow at noon",
"let start_time = moment().startOf(\"day\");",
"start_time = start_time.add(1, \"day\");",
"start_time = start_time.add(12, \"hours\");",
"// Format to our timezone, note that milliseconds are not required",
"let _start_time = start_time.utcOffset(utcoffset).format('YYYY-MM-DDTHH:mm:ssZ');",
"pm.collectionVariables.set(\"_start_time\", _start_time);",
"//pm.collectionVariables.set(\"_start_time\", start_time);",
"",
"// End at 12:30",
"let end_time = start_time;",
"end_time = end_time.add(30, 'minutes');",
"let _end_time = end_time.utcOffset(utcoffset).format('YYYY-MM-DDTHH:mm:ssZ');",
"pm.collectionVariables.set(\"_end_time\", _end_time);",
""
],
"type": "text/javascript"
}
},
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {",
" pm.response.to.have.status(200);",
"});",
"",
"var theMeeting = pm.response.json();",
"pm.collectionVariables.set(\"_theMeeting\", JSON.stringify(theMeeting));",
"",
"pm.test(\"Response is valid and has an id\", function () {",
" console.log(theMeeting.id);",
" pm.expect(theMeeting.id).to.be.a(\"string\");",
" pm.collectionVariables.set(\"_singleMeetingId\", theMeeting.id);",
" console.log(pm.collectionVariables.get(\"_singleMeetingId\"));",
"});",
"",
"pm.test(\"Response has a meeting number\", function () {",
" pm.expect(theMeeting.meetingNumber).to.be.a(\"string\");",
" pm.collectionVariables.set(\"_singleMeetingNumber\", theMeeting.meetingNumber);",
"});",
"",
"pm.test(\"Response has webLink\", function () {",
" pm.expect(theMeeting.webLink).to.be.a(\"string\");",
"});",
"",
"pm.test(\"Response has sipAddress\", function () {",
" pm.expect(theMeeting.sipAddress).to.be.a(\"string\");",
"});",
"",
"pm.test(\"Recurrance is single\", function () {",
" pm.expect(theMeeting.meetingType).to.equal(\"meetingSeries\");",
"});",
"",
"pm.test(\"Start time is as expected\", function () {",
" pm.expect(theMeeting.start).to.equal(pm.collectionVariables.get(\"_start_time\"));",
"});",
"",
"pm.test(\"End Time time is as expected\", function () {",
" pm.expect(theMeeting.end).to.equal(pm.collectionVariables.get(\"_end_time\"));",
"});",
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"title\": \"Sample Title\",\n \"agenda\": \"Sample Agenda\",\n \"password\": \"A@ssword123\",\n \"start\": \"{{_start_time}}\",\n \"end\": \"{{_end_time}}\",\n \"timezone\": \"{{TIMEZONE_STRING}}\", \n \"enabledAutoRecordMeeting\": false,\n \"allowAnyUserToBeCoHost\": false\n}"
},
"url": {
"raw": "{{MEETINGS_API_URL}}/meetings",
"host": [
"{{MEETINGS_API_URL}}"
],
"path": [
"meetings"
]
},
"description": "Our prerequest script will examine the UTCOFFSET and TIMEZONE variables and generate a to/from team for a meeting that starts at noon tommorow and lasts for 30 minutes\nOur request body will use the temporary _start_time and _end_time variables that our prerequest script _start_time\nOur tests will validate that we got the expected result and set some additional temporary environment variables that will be used in subseqent tests"
},
"response": []
},
{
"name": "Get meeting by ID",
"event": [
{
"listen": "test",
"script": {
"exec": [
"var moment = require('moment');",
"",
"pm.test(\"Status code is 200\", function () {",
" pm.response.to.have.status(200);",
"});",
"",
"var theMeeting = pm.response.json();",
"pm.test(\"Meeting ID matches\", function () {",
" pm.expect(theMeeting.id).to.equal(pm.collectionVariables.get(\"_singleMeetingId\"));",
"});",
"",
"pm.test(\"Meeting Number matches\", function () {",
" pm.expect(theMeeting.meetingNumber).to.equal(pm.collectionVariables.get(\"_singleMeetingNumber\"));",
"});",
"",
"pm.test(\"Response has webLink\", function () {",
" pm.expect(theMeeting.webLink).to.be.a(\"string\");",
"});",
"",
"pm.test(\"Response has sipAddress\", function () {",
" pm.expect(theMeeting.sipAddress).to.be.a(\"string\");",
"});",
"",
"pm.test(\"Recurrance is single\", function () {",
" pm.expect(theMeeting.meetingType).to.equal(\"meetingSeries\");",
"});",
"",
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "{{Authorization}}",
"type": "text"
}
],
"url": {
"raw": "{{MEETINGS_API_URL}}/meetings/{{_singleMeetingId}}",
"host": [
"{{MEETINGS_API_URL}}"
],
"path": [
"meetings",
"{{_singleMeetingId}}"
]
},
"description": "You can pass an ID directly to the /meetings API to get that object. In this case we will get the non-recurring meetingType:meetingSeries object that we just created."
},
"response": []
},
{
"name": "Get meeting using meetingSeriesId query param",
"event": [
{
"listen": "test",
"script": {
"exec": [
"var moment = require('moment');",
"",
"pm.test(\"Status code is 200\", function () {",
" pm.response.to.have.status(200);",
"});",
"",
"var jsonData = pm.response.json();",
"",
"pm.test(\"Result contains a list\", function () {",
" pm.expect(jsonData).to.have.keys('items');",
"})",
"",
"pm.test(\"List contains one element\", function () {",
" pm.expect(jsonData.items.length).to.equal(1);",
"});",
"",
"var theMeeting = jsonData.items[0];",
"",
"pm.test(\"scheduledMeeting has meetingSeriesId\", function () {",
" pm.expect(theMeeting.meetingSeriesId).to.equal(pm.collectionVariables.get(\"_singleMeetingId\"));",
"});",
"",
"",
"pm.test(\"Meeting ID matches meetingSeriesId\", function () {",
" pm.expect(theMeeting.id).to.equal(pm.collectionVariables.get(\"_singleMeetingId\"));",
"});",
"",
"pm.test(\"Meeting Number matches\", function () {",
" pm.expect(theMeeting.meetingNumber).to.equal(pm.collectionVariables.get(\"_singleMeetingNumber\"));",
"});",
"",
"pm.test(\"Response has webLink\", function () {",
" pm.expect(theMeeting.webLink).to.be.a(\"string\");",
"});",
"",
"pm.test(\"Response has sipAddress\", function () {",
" pm.expect(theMeeting.sipAddress).to.be.a(\"string\");",
"});",
"",
"pm.test(\"Meeting type is scheduledMeeting\", function () {",
" pm.expect(theMeeting.meetingType).to.equal(\"scheduledMeeting\");",
"});",
"",
"var utcoffset = pm.variables.get(\"UTCOFFSET\");",
"pm.test(\"Start time is as expected in UTC Time\", function () {",
" let _start_time = pm.collectionVariables.get('_start_time');",
" let start_time = moment.utc(_start_time);",
" pm.expect(theMeeting.start).to.equal(start_time.format());",
"});",
"",
"pm.test(\"End Time time is as expected in UTC Time\", function () {",
" let _end_time = pm.collectionVariables.get('_end_time');",
" let end_time = moment.utc(_end_time);",
" pm.expect(theMeeting.end).to.equal(end_time.format());",
"});",
""
],
"type": "text/javascript"
}
},
{
"listen": "prerequest",
"script": {
"exec": [
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"type": "text",
"value": "{{Authorization}}"
}
],
"url": {
"raw": "{{MEETINGS_API_URL}}/meetings?meetingSeriesId={{_singleMeetingId}}",
"host": [
"{{MEETINGS_API_URL}}"
],
"path": [
"meetings"
],
"query": [
{
"key": "meetingSeriesId",
"value": "{{_singleMeetingId}}"
}
]
},
"description": "If we pass the id as a meetingSeriesId query param, we get a list of scheduledMeeting meetingTypes that are associated with this series. In this case since the meeting was non-recurring there is only one result. This scheduledMeeting DTO is exactly the same as it's non-recurring meetingSeries parent, except that the meetingType is different (scheduledMeeting vs meetingSeries), and it provides an explicit meetingSeriesId. Note that this matches the id, since in the caase of a non-recurring meeting the meetingSeries object and the scheduleMeeting object are the same thing."
},
"response": []
},
{
"name": "Update the meeting",
"event": [
{
"listen": "prerequest",
"script": {
"exec": [
"var moment = require('moment');",
"",
"// Get the response body from the previous GET",
"let theMeeting = JSON.parse(pm.collectionVariables.get(\"_theMeeting\"));",
"",
"// Change a couple of attributes",
"theMeeting.enabledAutoRecordMeeting = (theMeeting.enabledAutoRecordMeeting) ? false : true;",
"",
"// Save the new expected values for our test",
"pm.collectionVariables.set(\"_expectedAutoRecordMeeting\", theMeeting.enabledAutoRecordMeeting);",
"",
"// Write the updated body for the PUT back to the environment",
"pm.collectionVariables.set(\"_theMeeting\", JSON.stringify(theMeeting));",
""
],
"type": "text/javascript"
}
},
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {",
" pm.response.to.have.status(200);",
"});",
"",
"var jsonData = pm.response.json();",
"",
"pm.test(\"Meeting ID matches\", function () {",
" pm.expect(jsonData.id).to.equal(pm.collectionVariables.get(\"_singleMeetingId\"));",
"});",
"",
"pm.test(\"enabledAutoRecordMeeting is now true\", function () {",
" pm.expect(jsonData.enabledAutoRecordMeeting).to.equal(pm.collectionVariables.get(\"_expectedAutoRecordMeeting\"));",
"});",
"",
"",
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "PUT",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"type": "text",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{{_theMeeting}}\n"
},
"url": {
"raw": "{{MEETINGS_API_URL}}/meetings/{{_singleMeetingId}}",
"host": [
"{{MEETINGS_API_URL}}"
],
"path": [
"meetings",
"{{_singleMeetingId}}"
]
},
"description": "In our pre-request script we grab the saved version of this meeting that we saved when we created it. We toggle the boolean value `enabledAutoRecordMeeting`. We then write the new meeting object to an environment and use that as the body of our PUT request. Our test validates that the result has the new value."
},
"response": []
},
{
"name": "Create series meeting",
"event": [
{
"listen": "prerequest",
"script": {
"exec": [
"var moment = require('moment');",
"var utcoffset = pm.variables.get(\"UTCOFFSET\");",
"// Start tommorow at one pm",
"let start_time = moment().startOf(\"day\");",
"start_time = start_time.add(1, \"day\");",
"start_time = start_time.add(13, \"hours\");",
"let _start_time = start_time.utcOffset(utcoffset).format('YYYY-MM-DDTHH:mm:ssZ');",
"pm.collectionVariables.set(\"_start_time\", _start_time);",
"console.log(pm.collectionVariables.get(\"_start_time\"));",
"",
"// End at 13:30",
"let end_time = start_time;",
"end_time = end_time.add(30, 'minutes');",
"let _end_time = end_time.utcOffset(utcoffset).format('YYYY-MM-DDTHH:mm:ssZ');",
"pm.collectionVariables.set(\"_end_time\", _end_time);",
"console.log(pm.collectionVariables.get(\"_end_time\"));",
""
],
"type": "text/javascript"
}
},
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {",
" pm.response.to.have.status(200);",
"});",
"",
"var jsonData = pm.response.json();",
"pm.collectionVariables.set(\"_theMeetingSeries\", JSON.stringify(jsonData));",
"",
"pm.test(\"Response is valid and has an id\", function () {",
" pm.expect(jsonData.id).to.be.a(\"string\");",
" pm.collectionVariables.set(\"_recurringMeetingId\", jsonData.id);",
"});",
"",
"pm.test(\"Response is valid and has an meeting number\", function () {",
" pm.expect(jsonData.meetingNumber).to.be.a(\"string\");",
" pm.collectionVariables.set(\"_recurringMeetingNumber\", jsonData.meetingNumber);",
"});",
"",
"pm.test(\"Response has webLink\", function () {",
" pm.expect(jsonData.webLink).to.be.a(\"string\");",
"});",
"",
"pm.test(\"Response has sipAddress\", function () {",
" pm.expect(jsonData.sipAddress).to.be.a(\"string\");",
"});",
"",
"pm.test(\"meetingType is meetingSeries\", function () {",
" pm.expect(jsonData.meetingType).to.equal(\"meetingSeries\");",
"});",
"",
"pm.test(\"Start time is as expected\", function () {",
" pm.expect(jsonData.start).to.equal(pm.collectionVariables.get(\"_start_time\"));",
"});",
"",
"pm.test(\"End Time time is as expected\", function () {",
" pm.expect(jsonData.end).to.equal(pm.collectionVariables.get(\"_end_time\"));",
"});",
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\r\n \"title\": \"Series Title\",\r\n \"agenda\": \"Series Agenda\",\r\n \"password\": \"A@ssword123\",\r\n \"start\": \"{{_start_time}}\",\r\n \"end\": \"{{_end_time}}\",\r\n \"timezone\": \"{{TIMEZONE_STRING}}\",\r\n \"recurrence\": \"FREQ=DAILY;INTERVAL=1;COUNT=10\",\r\n \"enabledAutoRecordMeeting\": false,\r\n \"allowAnyUserToBeCoHost\": false\r\n}"
},
"url": {
"raw": "{{MEETINGS_API_URL}}/meetings",
"host": [
"{{MEETINGS_API_URL}}"
],
"path": [
"meetings"
]
},
"description": "This request is like the first POST request except that we add the reccurence field in our request body"
},
"response": []
},
{
"name": "Get recurring meeting by number",
"event": [
{
"listen": "test",
"script": {
"exec": [
"var moment = require('moment');",
"pm.test(\"Status code is 200\", function () {",
" pm.response.to.have.status(200);",
"});",
"",
"pm.test(\"List of items was returned\", function () {",
" var jsonData = pm.response.json();",
" pm.expect(jsonData.items).to.be.an('array');",
"});",
"",
"var theMeeting = pm.response.json().items[0];",
"// console.log(theMeeting);",
"",
"pm.test(\"Meeting ID matches\", function () {",
" pm.expect(theMeeting.id).to.not.equal(pm.collectionVariables.get(\"_recurringMeetingId\"));",
"});",
"",
"pm.test(\"meetingSeriesId matches\", function () {",
" pm.expect(theMeeting.meetingSeriesId).to.equal(pm.collectionVariables.get(\"_recurringMeetingId\"));",
"});",
"",
"pm.test(\"Meeting Number matches\", function () {",
" pm.expect(theMeeting.meetingNumber).to.equal(pm.collectionVariables.get(\"_recurringMeetingNumber\"));",
"});",
"",
"pm.test(\"Response has webLink\", function () {",
" pm.expect(theMeeting.webLink).to.be.a(\"string\");",
"});",
"",
"pm.test(\"Response has sipAddress\", function () {",
" pm.expect(theMeeting.sipAddress).to.be.a(\"string\");",
"});",
"",
"pm.test(\"meetingType is meetingSeries\", function () {",
" pm.expect(theMeeting.meetingType).to.equal(\"scheduledMeeting\");",
"});",
"",
"pm.test(\"Start time is as expected in UTC Time\", function () {",
" let start_time = moment.utc(pm.collectionVariables.get(\"_start_time\"));",
" pm.expect(theMeeting.start).to.equal(start_time.format());",
"});",
"",
"pm.test(\"End Time time is as expected in UTC Time\", function () {",
" let end_time = moment.utc(pm.collectionVariables.get(\"_end_time\"));",
" pm.expect(theMeeting.end).to.equal(end_time.format());",
"});",
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{MEETINGS_API_URL}}/meetings?meetingNumber={{_recurringMeetingNumber}}",
"host": [
"{{MEETINGS_API_URL}}"
],
"path": [
"meetings"
],
"query": [
{
"key": "meetingNumber",
"value": "{{_recurringMeetingNumber}}"
}
]
},
"description": "In addition to including the ID of a meeting in the GET /meetings url, you can specify query parameters to get a meeting. In this example, we specify the meetingNumber. The result is always a list of items although in this case we get back just one element in the list, the meetingSeries that we just created with that meeting number."
},
"response": []
},
{
"name": "Get recurring meeting by meetingSeriesId",
"event": [
{
"listen": "test",
"script": {
"exec": [
"var moment = require('moment');",
"pm.test(\"Status code is 200\", function () {",
" pm.response.to.have.status(200);",
"});",
"",
"pm.test(\"List of items was returned\", function () {",
" var jsonData = pm.response.json();",
" pm.expect(jsonData.items).to.be.an('array');",
"});",
"",
"// Let's examine the first item in the list",
"var theMeeting = pm.response.json().items[0];",
"pm.collectionVariables.set(\"_aScheduledMeeting\", JSON.stringify(theMeeting));",
"pm.collectionVariables.set(\"_aScheduledMeetingId\", theMeeting.id);",
"",
"pm.test(\"meetingType is scheduledMeeting\", function () {",
" pm.expect(theMeeting.meetingType).to.equal(\"scheduledMeeting\");",
"});",
"",
"pm.test(\"scheduledMeeting type ID does not match parents'\", function () {",
" pm.expect(theMeeting.id).to.not.equal(pm.collectionVariables.get(\"_recurringMeetingId\"));",
"});",
"",
"pm.test(\"meetingSeriesId does match\", function () {",
" pm.expect(theMeeting.meetingSeriesId).to.equal(pm.collectionVariables.get(\"_recurringMeetingId\"));",
"});",
"",
"pm.test(\"Meeting Number matches\", function () {",
" pm.expect(theMeeting.meetingNumber).to.equal(pm.collectionVariables.get(\"_recurringMeetingNumber\"));",
"});",
"",
"pm.test(\"Response has webLink\", function () {",
" pm.expect(theMeeting.webLink).to.be.a(\"string\");",
"});",
"",
"pm.test(\"Response has sipAddress\", function () {",
" pm.expect(theMeeting.sipAddress).to.be.a(\"string\");",
"});",
"",
"pm.test(\"Start time is as expected in UTC Time\", function () {",
" let start_time = moment.utc(pm.collectionVariables.get(\"_start_time\"));",
" pm.expect(theMeeting.start).to.equal(start_time.format());",
"});",
"",
"pm.test(\"End Time time is as expected in UTC Time\", function () {",
" let end_time = moment.utc(pm.collectionVariables.get(\"_end_time\"));",
" pm.expect(theMeeting.end).to.equal(end_time.format());",
"});",
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{MEETINGS_API_URL}}/meetings/?meetingSeriesId={{_recurringMeetingId}}",
"host": [
"{{MEETINGS_API_URL}}"
],
"path": [
"meetings",
""
],
"query": [
{
"key": "meetingSeriesId",
"value": "{{_recurringMeetingId}}"
}
]
},
"description": "We can perform the same request by specfing the meetingSeriesId as the query parameter instead of the meetingNumber. In this case the response will be a list of scheduledMeeting meetingType objects associated with the series. In this case each scheduledMeeting object has a unique id, but they all share a common meetingSeriesId."
},
"response": []
},
{
"name": "List a week's worth of recurring meeting instances",
"event": [
{
"listen": "prerequest",
"script": {
"exec": [
"var moment = require('moment');",
"var utcoffset = pm.variables.get(\"UTCOFFSET\");",
"// Get a weeks worth of meetings starting at the start time",
"let start_time = pm.collectionVariables.get(\"_start_time\");",
"start_time = moment(start_time);",
"let to_time = moment().startOf(start_time);",
"to_time = to_time.add(7, \"days\");",
"let _to_time = to_time.utcOffset(utcoffset).format('YYYY-MM-DDTHH:mm:ssZ');",
"pm.collectionVariables.set(\"_to_time\", _to_time);",
"let from = encodeURIComponent(pm.collectionVariables.get(\"_start_time\"));",
"let to = encodeURIComponent(_to_time);",
"pm.collectionVariables.set(\"_from_time\", from);",
"pm.collectionVariables.set(\"_to_time\", to);",
"",
"",
""
],
"type": "text/javascript"
}
},
{
"listen": "test",
"script": {
"exec": [
"var moment = require('moment');",
"",
"pm.test(\"Status code is 200\", function () {",
" pm.response.to.have.status(200);",
"});",
"",
"pm.test(\"List of items was returned\", function () {",
" var jsonData = pm.response.json();",
" pm.expect(jsonData.items).to.be.an('array')",
"});",
"",
"pm.test(\"List length does not exceed expected length of 7\", function () {",
" var jsonData = pm.response.json();",
" pm.expect(jsonData.items.length).to.be.below(8);",
"});",
"",
"",
"var jsonData = pm.response.json();",
"if (Array.isArray(jsonData.items)) {",
" let from = pm.collectionVariables.get(\"_start_time\");",
" let date = moment.utc(from);",
" from = date.format(\"YYYY-MM-DDTHH:mm:ss\") + \"Z\";",
" let to = pm.collectionVariables.get(\"_to_time\");",
" date = moment.utc(to);",
" to = date.format(\"YYYY-MM-DDTHH:mm:ss\") + \"Z\";",
" let date_in_range = true;",
" for (let meeting of jsonData.items) {",
" if ((meeting.end <= from) || (meeting.start >= to)) {",
" tests[`Got meeting calendar view: Got meeting with start date:${meeting.start},end date:${meeting.end}, outside of range{from:${from}, to:${to}}`] = false;",
" date_in_range = false;",
" }",
" }",
" if (date_in_range) {",
" tests[`Got meeting calendar view: All meeting start times in range{from:${from}, to:${to}}`] = true;",
" }",
"}"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{CITOKEN}}",
"type": "text"
},
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"url": {
"raw": "{{MEETINGS_API_URL}}/meetings?meetingSeriesId={{_recurringMeetingId}}&from={{_from_time}}&to={{_to_time}}",
"host": [
"{{MEETINGS_API_URL}}"
],
"path": [
"meetings"
],
"query": [
{
"key": "",
"value": "",
"disabled": true
},
{
"key": "",
"value": "\n",
"disabled": true
},
{
"key": "meetingSeriesId",
"value": "{{_recurringMeetingId}}"
},
{
"key": "from",
"value": "{{_from_time}}"
},
{
"key": "to",
"value": "{{_to_time}}"
}
]
},
"description": "When querying for a list of scheduled meetings you can use the `to` and `from` query params. In this case we set it for a week which is the same as the default."
},
"response": []
},
{
"name": "Test max param on meeting instances",
"event": [
{
"listen": "prerequest",
"script": {
"exec": [
"var moment = require('moment');",
"",
"// start from today",
"let from_time = moment().startOf(\"day\");",
"pm.collectionVariables.set(\"_from_time\", from_time);",
"",
"// End after 7 days",
"let to_time = moment().startOf(\"day\");",
"to_time = to_time.add(7, \"day\");",
"pm.collectionVariables.set(\"_to_time\", to_time);",
""
],
"type": "text/javascript"
}
},
{
"listen": "test",
"script": {
"exec": [
"var moment = require('moment');",
"",
"pm.test(\"Status code is 200\", function () {",
" pm.response.to.have.status(200);",
"});",
"",
"pm.test(\"List of items was returned\", function () {",
" var jsonData = pm.response.json();",
" pm.expect(jsonData.items).to.be.an('array')",
"});",
"",
"pm.test(\"List length does not exceed max specified\", function () {",
" let max_results =parseInt(pm.variables.get(\"MAX_RESULTS\"));",
" var jsonData = pm.response.json();",
" pm.expect(jsonData.items.length).to.be.below(max_results+1);",
"});",
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"type": "text",
"value": "Bearer {{CITOKEN}}"
},
{
"key": "Content-Type",
"type": "text",
"value": "application/json"
}
],
"url": {
"raw": "{{MEETINGS_API_URL}}/meetings?meetingSeriesId={{_recurringMeetingId}}&from={{_from_time}}&to={{_to_time}}&max={{MAX_RESULTS}}",
"host": [
"{{MEETINGS_API_URL}}"
],
"path": [
"meetings"
],
"query": [
{
"key": "meetingSeriesId",
"value": "{{_recurringMeetingId}}"
},
{
"key": "from",
"value": "{{_from_time}}"
},
{
"key": "to",
"value": "{{_to_time}}"
},
{
"key": "max",
"value": "{{MAX_RESULTS}}"
}
]
},
"description": "You can also limit the number of results returned by setting the `max` query param. Here we make the same call as before but limit it to our MAX_RESULTS environment variable."
},
"response": []
},
{
"name": "Update a scheduled MeetingInstance",
"event": [
{
"listen": "prerequest",
"script": {
"exec": [
"var moment = require('moment');",
"",
"// Get the response body from the previous GET",
"let theMeeting = JSON.parse(pm.collectionVariables.get(\"_aScheduledMeeting\"));",
"",
"// Change a couple of attributes",
"theMeeting.enabledAutoRecordMeeting = (theMeeting.enabledAutoRecordMeeting) ? false : true;",
"",
"// Save the new expected values for our test",
"pm.collectionVariables.set(\"_expectedAutoRecordMeeting\", theMeeting.enabledAutoRecordMeeting);",
"",
"// Write the updated body for the PUT back to the environment",
"pm.collectionVariables.set(\"_aScheduledMeeting\", JSON.stringify(theMeeting));",
""
],
"type": "text/javascript"
}
},
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {",
" pm.response.to.have.status(200);",
"});",
"",
"var jsonData = pm.response.json();",
"",
"pm.test(\"Meeting ID matches\", function () {",
" pm.expect(jsonData.id).to.equal(pm.collectionVariables.get(\"_aScheduledMeetingId\"));",
"});",
"",
"pm.test(\"isModified attribute is now true\", function () {",
" pm.expect(jsonData.isModified).to.equal(true);",
"});",
"",
"",
"pm.test(\"enabledAutoRecordMeeting is now true\", function () {",
" pm.expect(jsonData.enabledAutoRecordMeeting).to.equal(pm.collectionVariables.get(\"_expectedAutoRecordMeeting\"));",
"});",
"",
"",
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "PUT",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"type": "text",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{{_aScheduledMeeting}}\n"
},
"url": {
"raw": "{{MEETINGS_API_URL}}/meetings/{{_aScheduledMeetingId}}",
"host": [
"{{MEETINGS_API_URL}}"
],
"path": [
"meetings",
"{{_aScheduledMeetingId}}"
]
},
"description": "This time we will modify just a single scheduledMeeting instance. Our prequest script will read in a copy of that meeting that we saved when we first listed the scheduledMeeting instances, and our test will validate that the value has changed as expected. Note that when a scheduleMeeting is updated the `isModified` attribute is set to true."
},
"response": []
},
{
"name": "Validate just one scheduledMeeting was updated",
"event": [
{
"listen": "prerequest",
"script": {
"exec": [
"var moment = require('moment');",
"",
"// start from today",
"let from_time = moment().startOf(\"day\");",
"pm.collectionVariables.set(\"_from_time\", from_time);",
"",
"// End after 7 days",
"let to_time = moment().startOf(\"day\");",
"to_time = to_time.add(7, \"day\");",
"pm.collectionVariables.set(\"_to_time\", to_time);",
""
],
"type": "text/javascript"
}
},
{
"listen": "test",
"script": {
"exec": [
"var moment = require('moment');",
"",
"pm.test(\"Status code is 200\", function () {",
" pm.response.to.have.status(200);",
"});",
"",
"pm.test(\"List of items was returned\", function () {",
" var jsonData = pm.response.json();",
" pm.expect(jsonData.items).to.be.an('array')",
"});",
"",
"pm.test(\"List length is two\", function () {",
" var jsonData = pm.response.json();",
" pm.expect(jsonData.items.length).to.be.equal(2);",
"});",
"",
"pm.test(\"Meetings have different enabledAutoRecordMeeting settings\", function () {",
" var jsonData = pm.response.json();",
" var theList = jsonData.items;",
" pm.expect(theList[0].enabledAutoRecordMeeting).to.not.equal(theList[1].enabledAutoRecordMeeting)",
"});",
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"type": "text",
"value": "Bearer {{CITOKEN}}"
},
{
"key": "Content-Type",
"type": "text",
"value": "application/json"
}
],