This repository has been archived by the owner on Jun 29, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 141
/
channels.yaml
2931 lines (2664 loc) · 90.8 KB
/
channels.yaml
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
/api/v4/channels:
get:
tags:
- channels
summary: Get a list of all channels
description: |
##### Permissions
`manage_system`
operationId: GetAllChannels
parameters:
- name: not_associated_to_group
in: query
description: A group id to exclude channels that are associated with that group via GroupChannel records. This can also be left blank with `not_associated_to_group=`.
schema:
type: string
- name: page
in: query
description: The page to select.
schema:
type: integer
default: 0
- name: per_page
in: query
description: The number of channels per page.
schema:
type: integer
default: 0
- name: exclude_default_channels
in: query
description: Whether to exclude default channels (ex Town Square, Off-Topic) from the results.
schema:
type: boolean
default: false
- name: include_deleted
in: query
description: Include channels that have been archived. This correlates to the `DeleteAt` flag being set in the database.
schema:
type: boolean
default: false
- name: include_total_count
in: query
description: >-
Appends a total count of returned channels inside the response object - ex: `{ "channels": [], "total_count" : 0 }`.
schema:
type: boolean
default: false
- name: exclude_policy_constrained
in: query
schema:
type: boolean
default: false
description: >-
If set to true, channels which are part of a data retention policy will be excluded.
The `sysconsole_read_compliance` permission is required to use this parameter.
__Minimum server version__: 5.35
responses:
"200":
description: Channel list retrieval successful
content:
application/json:
schema:
$ref: "#/components/schemas/ChannelListWithTeamData"
"400":
$ref: "#/components/responses/BadRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"404":
$ref: "#/components/responses/NotFound"
post:
tags:
- channels
summary: Create a channel
description: >
Create a new channel.
##### Permissions
If creating a public channel, `create_public_channel` permission is required. If creating a private channel, `create_private_channel` permission is required.
operationId: CreateChannel
requestBody:
content:
application/json:
schema:
type: object
required:
- name
- display_name
- type
- team_id
properties:
team_id:
type: string
description: The team ID of the team to create the channel on
name:
type: string
description: The unique handle for the channel, will be present in the
channel URL
display_name:
type: string
description: The non-unique UI name for the channel
purpose:
type: string
description: A short description of the purpose of the channel
header:
type: string
description: Markdown-formatted text to display in the header of the
channel
type:
type: string
description: "'O' for a public channel, 'P' for a private channel"
description: Channel object to be created
required: true
responses:
"201":
description: Channel creation successful
content:
application/json:
schema:
$ref: "#/components/schemas/Channel"
"400":
$ref: "#/components/responses/BadRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"403":
$ref: "#/components/responses/Forbidden"
x-code-samples:
- lang: Go
source: >
import "github.com/mattermost/mattermost-server/v5/model"
Client := model.NewAPIv4Client("https://your-mattermost-url.com")
Client.Login("[email protected]", "Password1")
channel := &model.Channel{DisplayName: <YOUR CHANNEL DISPLAYNAME>, Name: <YOUR CHANNEL NAME>, Type: <CHANNEL TYPE OPEN/PRIVATE>, TeamId: <YOUR TEAM ID>}
// CreateChannel
rchannel, resp := Client.CreateChannel(channel)
/api/v4/channels/direct:
post:
tags:
- channels
summary: Create a direct message channel
description: >
Create a new direct message channel between two users.
##### Permissions
Must be one of the two users and have `create_direct_channel` permission. Having the `manage_system` permission voids the previous requirements.
operationId: CreateDirectChannel
requestBody:
content:
application/json:
schema:
type: array
items:
type: string
minItems: 2
maxItems: 2
description: The two user ids to be in the direct message
required: true
responses:
"201":
description: Direct channel creation successful
content:
application/json:
schema:
$ref: "#/components/schemas/Channel"
"400":
$ref: "#/components/responses/BadRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"403":
$ref: "#/components/responses/Forbidden"
x-code-samples:
- lang: Go
source: |
import "github.com/mattermost/mattermost-server/v5/model"
Client := model.NewAPIv4Client("https://your-mattermost-url.com")
Client.Login("[email protected]", "Password1")
// CreateDirectChannel
dm, resp := Client.CreateDirectChannel(<ID OF User1>, <ID OF User2>)
/api/v4/channels/group:
post:
tags:
- channels
summary: Create a group message channel
description: >
Create a new group message channel to group of users. If the logged in
user's id is not included in the list, it will be appended to the end.
##### Permissions
Must have `create_group_channel` permission.
operationId: CreateGroupChannel
requestBody:
content:
application/json:
schema:
type: array
items:
type: string
description: User ids to be in the group message channel
required: true
responses:
"201":
description: Group channel creation successful
content:
application/json:
schema:
$ref: "#/components/schemas/Channel"
"400":
$ref: "#/components/responses/BadRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"403":
$ref: "#/components/responses/Forbidden"
x-code-samples:
- lang: Go
source: |
import "github.com/mattermost/mattermost-server/v5/model"
Client := model.NewAPIv4Client("https://your-mattermost-url.com")
Client.Login("[email protected]", "Password1")
userIds := []string{<ID OF User1>, <ID OF User2>, <ID OF User3> ...}
// CreateGroupChannel
rgc, resp := Client.CreateGroupChannel(userIds)
/api/v4/channels/search:
post:
tags:
- channels
summary: Search all private and open type channels across all teams
description: >
Returns all private and open type channels where 'term' matches on the
name, display name, or purpose of
the channel.
Configured 'default' channels (ex Town Square and Off-Topic) can be excluded from the results
with the `exclude_default_channels` boolean parameter.
Channels that are associated (via GroupChannel records) to a given group can be excluded from the results
with the `not_associated_to_group` parameter and a group id string.
operationId: SearchAllChannels
parameters:
- name: system_console
in: query
description: >
Is the request from system_console. If this is set to true, it filters channels
by the logged in user.
required: false
schema:
type: boolean
default: true
requestBody:
content:
application/json:
schema:
type: object
required:
- term
properties:
term:
type: string
description: The string to search in the channel name, display name, and
purpose.
not_associated_to_group:
type: string
description: A group id to exclude channels that are associated to that
group via GroupChannel records.
exclude_default_channels:
type: boolean
description: Exclude default channels from the results by setting this
parameter to true.
team_ids:
type: array
items:
type: string
description: >
Filters results to channels belonging to the given team ids
__Minimum server version__: 5.26
group_constrained:
type: boolean
description: >
Filters results to only return channels constrained to a group
__Minimum server version__: 5.26
exclude_group_constrained:
type: boolean
description: >
Filters results to exclude channels constrained to a group
__Minimum server version__: 5.26
public:
type: boolean
description: >
Filters results to only return Public / Open channels, can be used in conjunction
with `private` to return both `public` and `private` channels
__Minimum server version__: 5.26
private:
type: boolean
description: >
Filters results to only return Private channels, can be used in conjunction
with `public` to return both `private` and `public` channels
__Minimum server version__: 5.26
deleted:
type: boolean
description: >
Filters results to only return deleted / archived channels
__Minimum server version__: 5.26
page:
type: string
description: The page number to return, if paginated. If this parameter
is not present with the `per_page` parameter then the
results will be returned un-paged.
per_page:
type: string
description: The number of entries to return per page, if paginated. If
this parameter is not present with the `page` parameter then
the results will be returned un-paged.
exclude_policy_constrained:
type: boolean
default: false
description: >
If set to true, only channels which do not have a granular retention policy assigned to
them will be returned. The `sysconsole_read_compliance_data_retention` permission is
required to use this parameter.
__Minimum server version__: 5.35
include_search_by_id:
type: boolean
default: false
description: >
If set to true, returns channels where given search 'term' matches channel ID.
__Minimum server version__: 5.35
description: The search terms and logic to use in the search.
required: true
responses:
"200":
description: Paginated channel response. (Note that the non-paginated
response—returned if the request body does not contain both `page`
and `per_page` fields—is a simple array of channels.)
content:
application/json:
schema:
type: object
properties:
channels:
type: array
description: The channels that matched the query.
items:
$ref: "#/components/schemas/Channel"
total_count:
type: number
description: The total number of results, regardless of page and
per_page requested.
"400":
$ref: "#/components/responses/BadRequest"
"401":
$ref: "#/components/responses/Unauthorized"
/api/v4/channels/group/search:
post:
tags:
- channels
summary: Search Group Channels
description: >
Get a list of group channels for a user which members' usernames match
the search term.
__Minimum server version__: 5.14
operationId: SearchGroupChannels
requestBody:
content:
application/json:
schema:
type: object
required:
- term
properties:
term:
description: The search term to match against the members' usernames of
the group channels
type: string
description: Search criteria
required: true
responses:
"200":
description: Channels search successful
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/Channel"
"400":
$ref: "#/components/responses/BadRequest"
"401":
$ref: "#/components/responses/Unauthorized"
x-code-samples:
- lang: Go
source: |
import "github.com/mattermost/mattermost-server/v5/model"
Client := model.NewAPIv4Client("https://your-mattermost-url.com")
Client.Login("[email protected]", "Password1")
search := &model.ChannelSearch{Term: <MEMBER USERNAME>}
// SearchGroupChannels
channels, resp := Client.SearchGroupChannels(search)
"/api/v4/teams/{team_id}/channels/ids":
post:
tags:
- channels
summary: Get a list of channels by ids
description: |
Get a list of public channels on a team by id.
##### Permissions
`view_team` for the team the channels are on.
operationId: GetPublicChannelsByIdsForTeam
parameters:
- name: team_id
in: path
description: Team GUID
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
type: array
items:
type: string
description: List of channel ids
required: true
responses:
"200":
description: Channel list retrieval successful
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/Channel"
"400":
$ref: "#/components/responses/BadRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"404":
$ref: "#/components/responses/NotFound"
x-code-samples:
- lang: Go
source: >
import "github.com/mattermost/mattermost-server/v5/model"
Client := model.NewAPIv4Client("https://your-mattermost-url.com")
Client.Login("[email protected]", "Password1")
channelIds := []string{<ID OF CHANNEL1>, <ID OF CHANNEL2>, ...}
// GetPublicChannelsByIdsForTeam
channels, resp := Client.GetPublicChannelsByIdsForTeam(<TEAMID>, channelIds)
"/api/v4/channels/{channel_id}/timezones":
get:
tags:
- channels
summary: Get timezones in a channel
description: |
Get a list of timezones for the users who are in this channel.
__Minimum server version__: 5.6
##### Permissions
Must have the `read_channel` permission.
operationId: GetChannelMembersTimezones
parameters:
- name: channel_id
in: path
description: Channel GUID
required: true
schema:
type: string
responses:
"200":
description: Timezone retrieval successful
content:
application/json:
schema:
type: array
items:
type: string
"400":
$ref: "#/components/responses/BadRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"403":
$ref: "#/components/responses/Forbidden"
x-code-samples:
- lang: Go
source: |
import "github.com/mattermost/mattermost-server/v5/model"
Client := model.NewAPIv4Client("https://your-mattermost-url.com")
Client.Login("[email protected]", "Password1")
// GetChannelStats
stats, resp := Client.GetChannelTimezones(<CHANNELID>)
"/api/v4/channels/{channel_id}":
get:
tags:
- channels
summary: Get a channel
description: |
Get channel from the provided channel id string.
##### Permissions
`read_channel` permission for the channel.
operationId: GetChannel
parameters:
- name: channel_id
in: path
description: Channel GUID
required: true
schema:
type: string
responses:
"200":
description: Channel retrieval successful
content:
application/json:
schema:
$ref: "#/components/schemas/Channel"
"401":
$ref: "#/components/responses/Unauthorized"
"403":
$ref: "#/components/responses/Forbidden"
"404":
$ref: "#/components/responses/NotFound"
x-code-samples:
- lang: Go
source: |
import "github.com/mattermost/mattermost-server/v5/model"
Client := model.NewAPIv4Client("https://your-mattermost-url.com")
Client.Login("[email protected]", "Password1")
// GetChannel
channel, resp := Client.GetChannel(<CHANNELID>, "")
put:
tags:
- channels
summary: Update a channel
description: >
Update a channel. The fields that can be updated are listed as
parameters. Omitted fields will be treated as blanks.
##### Permissions
If updating a public channel, `manage_public_channel_members` permission is required. If updating a private channel, `manage_private_channel_members` permission is required.
operationId: UpdateChannel
parameters:
- name: channel_id
in: path
description: Channel GUID
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
type: object
required:
- id
properties:
id:
type: string
description: The channel's id, not updatable
name:
type: string
description: The unique handle for the channel, will be present in the
channel URL
display_name:
type: string
description: The non-unique UI name for the channel
purpose:
type: string
description: A short description of the purpose of the channel
header:
type: string
description: Markdown-formatted text to display in the header of the
channel
description: Channel object to be updated
required: true
responses:
"200":
description: Channel update successful
content:
application/json:
schema:
$ref: "#/components/schemas/Channel"
"400":
$ref: "#/components/responses/BadRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"403":
$ref: "#/components/responses/Forbidden"
"404":
$ref: "#/components/responses/NotFound"
x-code-samples:
- lang: Go
source: >
import "github.com/mattermost/mattermost-server/v5/model"
Client := model.NewAPIv4Client("https://your-mattermost-url.com")
Client.Login("[email protected]", "Password1")
channel := &model.Channel{DisplayName: <YOUR CHANNEL NEW DISPLAYNAME>, ChannelId: <CHANNELID>, TeamId: <YOUR TEAM ID>}
// UpdateChannel
updatedChannel, resp := Client.UpdateChannel(channel)
delete:
tags:
- channels
summary: Delete a channel
description: >
Archives a channel. This will set the `deleteAt` to the current timestamp in the database. Soft deleted channels may not be accessible in the user
interface. They can be viewed and unarchived in the **System Console > User Management > Channels** based on your license. Direct and group message channels cannot be deleted.
As of server version 5.28, optionally use the `permanent=true` query parameter to permanently delete the channel for compliance reasons. To use this feature `ServiceSettings.EnableAPIChannelDeletion` must be set to `true` in the server's configuration.
If you permanently delete a channel this action is not recoverable outside of a database backup.
##### Permissions
`delete_public_channel` permission if the channel is public,
`delete_private_channel` permission if the channel is private,
or have `manage_system` permission.
operationId: DeleteChannel
parameters:
- name: channel_id
in: path
description: Channel GUID
required: true
schema:
type: string
responses:
"200":
description: Channel deletion successful
content:
application/json:
schema:
$ref: "#/components/schemas/StatusOK"
"400":
$ref: "#/components/responses/BadRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"403":
$ref: "#/components/responses/Forbidden"
x-code-samples:
- lang: Go
source: |
import "github.com/mattermost/mattermost-server/v5/model"
Client := model.NewAPIv4Client("https://your-mattermost-url.com")
Client.Login("[email protected]", "Password1")
// DeleteChannel
pass, resp := Client.DeleteChannel(<CHANNELID>)
"/api/v4/channels/{channel_id}/patch":
put:
tags:
- channels
summary: Patch a channel
description: >
Partially update a channel by providing only the fields you want to
update. Omitted fields will not be updated. The fields that can be
updated are defined in the request body, all other provided fields will
be ignored.
##### Permissions
If updating a public channel, `manage_public_channel_members` permission is required. If updating a private channel, `manage_private_channel_members` permission is required.
operationId: PatchChannel
parameters:
- name: channel_id
in: path
description: Channel GUID
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
type: object
properties:
name:
type: string
description: The unique handle for the channel, will be present in the
channel URL
display_name:
type: string
description: The non-unique UI name for the channel
purpose:
type: string
description: A short description of the purpose of the channel
header:
type: string
description: Markdown-formatted text to display in the header of the
channel
description: Channel object to be updated
required: true
responses:
"200":
description: Channel patch successful
content:
application/json:
schema:
$ref: "#/components/schemas/Channel"
"400":
$ref: "#/components/responses/BadRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"403":
$ref: "#/components/responses/Forbidden"
"404":
$ref: "#/components/responses/NotFound"
x-code-samples:
- lang: Go
source: |
import "github.com/mattermost/mattermost-server/v5/model"
Client := model.NewAPIv4Client("https://your-mattermost-url.com")
Client.Login("[email protected]", "Password1")
patch := &model.ChannelPatch{
Name: new(string),
DisplayName: new(string),
Header: new(string),
Purpose: new(string),
}
*patch.Name = "<SOME_NEW_NAME>"
*patch.DisplayName = "<SOME_NEW_DISPLAYNAME>"
*patch.Header = "<SOME_NEW_HEADER>"
*patch.Purpose = "<SOME_NEW_PURPOSE>"
// PatchChannel
channel, resp := Client.PatchChannel(<CHANNELID>, patch)
"/api/v4/channels/{channel_id}/privacy":
put:
tags:
- channels
summary: Update channel's privacy
description: >
Updates channel's privacy allowing changing a channel from Public to
Private and back.
__Minimum server version__: 5.16
##### Permissions
`manage_team` permission for the channels team on version < 5.28.
`convert_public_channel_to_private` permission for the channel if updating privacy to 'P' on version >= 5.28.
`convert_private_channel_to_public` permission for the channel if updating privacy to 'O' on version >= 5.28.
operationId: UpdateChannelPrivacy
parameters:
- name: channel_id
in: path
description: Channel GUID
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
type: object
required:
- privacy
properties:
privacy:
type: string
description: "Channel privacy setting: 'O' for a public channel, 'P' for
a private channel"
required: true
responses:
"200":
description: Channel conversion successful
content:
application/json:
schema:
$ref: "#/components/schemas/Channel"
"400":
$ref: "#/components/responses/BadRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"403":
$ref: "#/components/responses/Forbidden"
"404":
$ref: "#/components/responses/NotFound"
x-code-samples:
- lang: Go
source: >
import "github.com/mattermost/mattermost-server/v5/model"
Client := model.NewAPIv4Client("https://your-mattermost-url.com")
Client.Login("[email protected]", "Password1")
// Update channel's privacy to Public
updatedChannel, resp := Client.UpdateChannelPrivacy(<CHANNELID>, model.CHANNEL_OPEN)
// Update channel's privacy to Private
updatedChannel, resp := Client.UpdateChannelPrivacy(<CHANNELID>, model.CHANNEL_PRIVATE)
"/api/v4/channels/{channel_id}/restore":
post:
tags:
- channels
summary: Restore a channel
description: |
Restore channel from the provided channel id string.
__Minimum server version__: 3.10
##### Permissions
`manage_team` permission for the team of the channel.
operationId: RestoreChannel
parameters:
- name: channel_id
in: path
description: Channel GUID
required: true
schema:
type: string
responses:
"200":
description: Channel restore successful
content:
application/json:
schema:
$ref: "#/components/schemas/Channel"
"401":
$ref: "#/components/responses/Unauthorized"
"403":
$ref: "#/components/responses/Forbidden"
"404":
$ref: "#/components/responses/NotFound"
"/api/v4/channels/{channel_id}/move":
post:
tags:
- channels
summary: Move a channel
description: |
Move a channel to another team.
__Minimum server version__: 5.26
##### Permissions
Must have `manage_system` permission.
operationId: MoveChannel
parameters:
- name: channel_id
in: path
description: Channel GUID
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
type: object
required:
- team_id
properties:
team_id:
type: string
force:
description: "Remove members those are not member of target team before moving the channel."
type: boolean
required: true
responses:
"200":
description: Channel move successful
content:
application/json:
schema:
$ref: "#/components/schemas/Channel"
"400":
$ref: "#/components/responses/BadRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"403":
$ref: "#/components/responses/Forbidden"
"404":
$ref: "#/components/responses/NotFound"
"/api/v4/channels/{channel_id}/stats":
get:
tags:
- channels
summary: Get channel statistics
description: |
Get statistics for a channel.
##### Permissions
Must have the `read_channel` permission.
operationId: GetChannelStats
parameters:
- name: channel_id
in: path
description: Channel GUID
required: true
schema:
type: string
responses:
"200":
description: Channel statistics retrieval successful
content:
application/json:
schema:
$ref: "#/components/schemas/ChannelStats"
"400":
$ref: "#/components/responses/BadRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"403":
$ref: "#/components/responses/Forbidden"
x-code-samples:
- lang: Go
source: |
import "github.com/mattermost/mattermost-server/v5/model"
Client := model.NewAPIv4Client("https://your-mattermost-url.com")
Client.Login("[email protected]", "Password1")
// GetChannelStats
stats, resp := Client.GetChannelStats(<CHANNELID>)
"/api/v4/channels/{channel_id}/pinned":
get:
tags:
- channels
summary: Get a channel's pinned posts
description: Get a list of pinned posts for channel.
operationId: GetPinnedPosts
parameters:
- name: channel_id
in: path
description: Channel GUID
required: true
schema:
type: string
responses:
"200":
description: The list of channel pinned posts
content:
application/json:
schema:
$ref: "#/components/schemas/PostList"
"400":
$ref: "#/components/responses/BadRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"403":
$ref: "#/components/responses/Forbidden"