mirror of
https://github.com/mattermost/mattermost.git
synced 2026-11-29 08:09:58 +08:00
* Refuse non-system post fields in the access_control validation hook Post fields in access_control are system-scoped for now: channel and team scoped post fields would let any channel member use up the group-wide field limit. The hook refuses them on create and on both update paths. * Cap post fields at 50 in the access_control group Adds a per-object-type limit of 50 for post fields in the access_control group, next to the existing limit for user fields. Post fields also count towards the group's global field limit. * Return 501 for access_control post hydration without an Enterprise licence Post reads that ask to hydrate the access_control group are refused with 501 when the server has no Enterprise licence, instead of returning every post with its property values marked unavailable. The check follows model.MinimumEnterpriseLicense, the same one the licence hook uses. The API docs describe the propertyGroup parameter as access_control and document the 501. * Point post attributes at the access_control group and remove the post_attributes group Post fields and values now live in the access_control property group. The post_attributes group is no longer registered and its per-target field limit is gone; post fields are capped at PostAttributesMaxFields through the access_control group's per-object-type limit, and that cap is also the bound used when loading a post's applicable fields and values. Tests that wrote post fields straight to the store now go through the App: cases that need more fields than the cap, or a field outside the post's group, use a separate V2 group, and the masked post fixture is built as a system admin. * Add migration 000244 deleting the post_attributes property group Post fields now live in the access_control group and nothing registers post_attributes any more, so the migration hard-deletes the group's values, option edges, options, fields (grants cascade) and the group row. Other groups are untouched, and running it with no such group, or twice, changes nothing. The down migration is a no-op because the data cannot be restored. * Point the webapp at the access_control group for post attributes Post fields and values live in access_control and the post_attributes group no longer exists, so the group constant now names access_control. The server answers access_control post requests with 501 below an Enterprise licence, so isPostAttributesEnabled now also requires the Enterprise, Enterprise Advanced or Entry SKU, which is the rule of model.MinimumEnterpriseLicense. getPostPropertyGroups and the admin console resource types follow from it, so an unlicensed server sends no propertyGroup and offers no post attributes UI. Tests move their group fixtures to access_control and carry an Enterprise licence wherever the flag is on. New cases cover the licence matrix, post loads without a licence, and the chips selector ignoring user and channel fields in the same group. * Create linked post fields with value.write = creator from Global Attributes A post attribute created or extended to Posts in Global Attributes now sends permission_values: creator on its linked post field, so the post's author and the admins of its channel can set its values and other channel members can't. Without the explicit value the result depended on the server's inheritance path: the template's level or the post default (member). The constant lives in a new applies_to/posts module, next to the channels one. Users and Channels keep sending the values they sent before. * Move the post attributes Playwright suite to access_control Post attributes now live in the access_control group, so the suite creates its fields the way Global Attributes does: a template holding the type and options, then a system-scoped post field linked to it with value.write set to creator. Options are edited on the template, and cleanup deletes the linked post fields before their templates, unmasking a template first when it has a holder field. Every test skips without an Enterprise-level licence. Channel- and team-scoped post field cases are dropped, since post fields are system-scoped for now, and the date chip case is dropped because access_control stores a date as a string. Long text values fit the group's 64 character cap. New specs cover a template-linked field set from the edit modal, masking (a viewer sees a masked value only while holding its option), and an attribute created in the System Console, where the post author and a channel admin can set its value and other channel members can't. * Test refused post attribute writes against the real server refusal Post fields linked to a template can have their value permission tightened after creation, so the composer and modal refusal cases now run against the server's real 403 instead of a stub. The tests drop property_field_updated frames on the page's own websocket, so the page only learns of the tighter permission from the refused write; the server still enforces it. - Composer: a refused send leaves the composer empty and the post failed, Retry is refused again, succeeds once the field is loosened, and Cancel removes a second refused post. - Modal: a write refused while the modal is open shows the error on the row and keeps the chip and the row on the previous value. - Roles: a value stored before the field is sealed (no one may write it) still renders on the post and in the modal, behind a padlock. * Use slices.Sort in the migration 000244 test The vet rule forbids sort.Strings in favour of slices.Sort. * Remove duplicated helpers and dead code from the post attributes tests Share one propertyGroup query helper across the api4 post property tests, use require.ErrorIs in the post field hook test, drop an unused query in the migration 000244 test, and fold the e2e template cleanup into purgeFields and deleteTemplateSet so specs no longer sweep twice. * Adapt the post edit test to system-scoped post fields TestUpdatePostDropsPropertyValues came from master with a channel-scoped field and the removed PostAttributesMaxApplicableFields constant. * Remove the 501 documentation from the post read endpoints * Give the post attributes route test a valid access_control field name access_control field names must be CEL identifiers, and a bare id starts with a digit about one time in four, so the test failed intermittently. EOF This fix still has to be pushed to update PR #40288. Playwright is still running against the rebased server. Once it finishes I'll write the report with this as S1, and with the CodeRabbit triage: - CR1: valid, a nit. The sealed-field denial resends the value already stored. - CR2: outside this branch's scope. The hydration bound has always applied to whichever group is requested. - CR3: a false positive. Test cleanup is meant to be best-effort. * Refuse a real change in the sealed post attribute e2e test The sealed field held HIGH and the refused writes sent HIGH again, so the 403 was for an unchanged value. Seed LOW so each refused write would change it, and the next viewer still sees LOW. * Skip post attribute e2e specs unless the licence SKU enables the feature The specs skipped only when the server had no licence, so a Professional server ran them and timed out waiting for chips the webapp never renders. isPostAttributesEnabled needs Enterprise, Enterprise Advanced or Entry, so a shared helper now checks those SKUs and replaces every skipIfNoLicense call in the post_attributes specs. * Wait for attribute data before asserting a masked chip is absent The no-chip assertions in the masked value spec could pass on a page whose post fields and hydrated values had not arrived yet, so a leaked value would have gone unnoticed. The open helper now waits for the hydrated posts response and the field definitions before returning the chip row. * Patch only the changed attrs of a linked post field patchFieldAttrs patched the template first and then sent the caller's captured post field attrs, whose options were the old ones. The server refuses an options change on a linked field, so a call that changed both options and another attribute would have failed after the template was already updated. The server merges a patch's attrs and carries a template's options over to its linked fields, so the post field patch now sends only the attrs the call changes. The doc comment claimed a patch replaces attrs as a whole, which is not what the endpoint does. * Track each field of the direct and group message spec as it is created The spec pushed both fields into the cleanup list after creating the second one, so a failure creating it left the first field, which is system-scoped, on the server. Each field is now tracked as soon as it exists. * Format the post attributes spec imports with prettier The licence skip helper made the support imports of the card and reload specs longer than the line width, which the playwright prettier check rejects. * Skip post attribute specs on the legacy E20 licence too hasEnterpriseLicense accepts the E20 SKU, which isPostAttributesEnabled rejects, so the specs ran on an E20 server and failed waiting for chips. The skip helper now lists the three SKUs the webapp accepts. * Assert the hydrated values in the masked value spec The waits only matched requests by URL, so a failed fields or posts request would also have left the chip row empty and let the no-chip assertions pass. The open helper now checks both responses succeeded, the post field definition arrived and the hydrated response carries the post, and the spec asserts that Alpha's value is sent to the holder and not to the user who holds nothing. * Honour PSv3 tiers and grants when setting post values on create Post fields in access_control carry PSv3 permissions, but the create-post gate and the webapp's edit check read the legacy permission_values, which only holds the value.write tier. A user granted value.write could set a value with a PATCH and was refused when sending it on a new post, and the webapp showed the attribute locked for them and for any everyone-level field. CanSetPostPropertyValueOnCreate now reads the tier from permissions and admits a user or role grant for value.write the way the property API does. canEditPostAttributeValue does the same with the grants the server serves the caller, matching role grants against the user's system roles, and handles everyone. The permissions object is now typed in @mattermost/types, with a separate patch type that Client4's patchPropertyField takes, since the server applies a permissions patch key by key. An e2e test covers a user grant, a role grant and an everyone field in the attributes modal, on the server and in the composer, including sending a new post with a granted value. * Default post field values to creator and migrate existing ones A post field created without a value.write level stored the member default, which lets anyone who can read a channel set the values on anyone's post there. Post fields now default to creator, in the shared default and in the access_control hook, so their values belong to the post's author and whoever administers the channel. Migration 000244 also moves post fields already in access_control from member to creator, in both the permissions object and the PermissionValues column. Such fields are unlikely to exist, and fields at any other level are left as they are. * Check post text values before the post is saved Text post attribute values were only checked for length and value_type by the access_control hook, which runs after the post is saved, so an invalid value created the post and then deleted it again. Move the text checks into model.ValidatePropertyTextValue, call it from the hook and from PreparePostPropertyValuesForCreate, and correct the comment about uploaded files: they are attached after the values are written and survive a rollback unattached. * Add post field tests for restrictions changes, masking writes and the value read gate Cover what post fields were missing next to user and channel fields: a post created after its field's restrictions are patched through the API, the masking guard on writes (a member may set a value while nothing is stored, may not overwrite one they cannot see, and may set it again once cleared), and the value.read tier deciding which viewers get a post's value hydrated. * Use the post ID directly instead of shadowing targetID in the patch values test --------- Co-authored-by: Miguel de la Cruz <miguel@ctrlz.es>
1592 lines
52 KiB
YAML
1592 lines
52 KiB
YAML
/api/v4/posts:
|
|
post:
|
|
tags:
|
|
- posts
|
|
summary: Create a post
|
|
description: >
|
|
Create a new post in a channel. To create the post as a comment on
|
|
another post, provide `root_id`.
|
|
|
|
##### Permissions
|
|
|
|
Must have `create_post` permission for the channel the post is being created in.
|
|
operationId: CreatePost
|
|
parameters:
|
|
- name: set_online
|
|
in: query
|
|
description: Whether to set the user status as online or not.
|
|
required: false
|
|
schema:
|
|
type: boolean
|
|
- name: silent
|
|
in: query
|
|
description: >
|
|
When `true`, the post is delivered silently: visible in the channel
|
|
and broadcast over WebSocket, but produces no desktop/push/email
|
|
notifications, no unread or mention count increments, and no
|
|
"New Messages" line. Only bot accounts, OAuth apps, incoming
|
|
webhooks, and plugins may set this; non-integration senders
|
|
receive HTTP 403. `force_notification` overrides `silent`.
|
|
required: false
|
|
schema:
|
|
type: boolean
|
|
requestBody:
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
required:
|
|
- channel_id
|
|
- message
|
|
properties:
|
|
channel_id:
|
|
type: string
|
|
description: The channel ID to post in
|
|
message:
|
|
type: string
|
|
description: The message contents, can be formatted with Markdown
|
|
root_id:
|
|
type: string
|
|
description: The post ID to comment on
|
|
file_ids:
|
|
type: array
|
|
description: A list of file IDs to associate with the post. Note that
|
|
posts are limited to 5 files maximum. Please use additional
|
|
posts for more files.
|
|
items:
|
|
type: string
|
|
props:
|
|
description: A general JSON property bag to attach to the post
|
|
type: object
|
|
metadata:
|
|
description: A JSON object to add post metadata, e.g the post's priority
|
|
type: object
|
|
properties:
|
|
priority:
|
|
type: object
|
|
description: An object containing the post's priority properties
|
|
properties:
|
|
priority:
|
|
type: string
|
|
description: The priority label of the post, could empty, important, or urgent
|
|
requested_ack:
|
|
type: boolean
|
|
description: Set to true to request for acknowledgements
|
|
property_values:
|
|
type: array
|
|
description: >
|
|
Values for the post's attributes, defined as post attribute
|
|
fields in the `access_control` property group. Each entry is validated
|
|
against the applicable fields for the post's channel; an
|
|
error does not name which attribute failed validation.
|
|
items:
|
|
type: object
|
|
required:
|
|
- field_id
|
|
- value
|
|
properties:
|
|
field_id:
|
|
type: string
|
|
description: The ID of the attribute field this value is for
|
|
value:
|
|
description: The value to set for the attribute, whose shape depends on the field's type
|
|
description: Post object to create
|
|
required: true
|
|
responses:
|
|
"201":
|
|
description: Post creation successful
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: "#/components/schemas/Post"
|
|
"400":
|
|
$ref: "#/components/responses/BadRequest"
|
|
"401":
|
|
$ref: "#/components/responses/Unauthorized"
|
|
"403":
|
|
$ref: "#/components/responses/Forbidden"
|
|
/api/v4/posts/ephemeral:
|
|
post:
|
|
tags:
|
|
- posts
|
|
summary: Create a ephemeral post
|
|
description: >
|
|
Create a new ephemeral post in a channel.
|
|
|
|
##### Permissions
|
|
|
|
Must have `create_post_ephemeral` permission (currently only given to system admin)
|
|
operationId: CreatePostEphemeral
|
|
requestBody:
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
required:
|
|
- user_id
|
|
- post
|
|
properties:
|
|
user_id:
|
|
type: string
|
|
description: The target user id for the ephemeral post
|
|
post:
|
|
type: object
|
|
required:
|
|
- channel_id
|
|
- message
|
|
description: Post object to create
|
|
properties:
|
|
channel_id:
|
|
type: string
|
|
description: The channel ID to post in
|
|
message:
|
|
type: string
|
|
description: The message contents, can be formatted with Markdown
|
|
description: Ephemeral Post object to send
|
|
required: true
|
|
responses:
|
|
"201":
|
|
description: Post creation successful
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: "#/components/schemas/Post"
|
|
"400":
|
|
$ref: "#/components/responses/BadRequest"
|
|
"401":
|
|
$ref: "#/components/responses/Unauthorized"
|
|
"403":
|
|
$ref: "#/components/responses/Forbidden"
|
|
/api/v4/posts/search:
|
|
post:
|
|
tags:
|
|
- posts
|
|
summary: Search posts across all teams
|
|
description: |
|
|
Search posts visible to the current user across all teams.
|
|
##### Permissions
|
|
Must be authenticated.
|
|
operationId: SearchPostsInAllTeams
|
|
requestBody:
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
required:
|
|
- terms
|
|
properties:
|
|
terms:
|
|
type: string
|
|
is_or_search:
|
|
type: boolean
|
|
time_zone_offset:
|
|
type: integer
|
|
include_deleted_channels:
|
|
type: boolean
|
|
page:
|
|
type: integer
|
|
per_page:
|
|
type: integer
|
|
required: true
|
|
responses:
|
|
"200":
|
|
description: Post search successful
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: "#/components/schemas/PostListWithSearchMatches"
|
|
"400":
|
|
$ref: "#/components/responses/BadRequest"
|
|
"401":
|
|
$ref: "#/components/responses/Unauthorized"
|
|
"403":
|
|
$ref: "#/components/responses/Forbidden"
|
|
"/api/v4/posts/{post_id}":
|
|
get:
|
|
tags:
|
|
- posts
|
|
summary: Get a post
|
|
description: >
|
|
Get a single post.
|
|
|
|
##### Permissions
|
|
|
|
Must have `read_channel` permission for the channel the post is in or if the channel is public, have the `read_public_channels` permission for the team.
|
|
operationId: GetPost
|
|
parameters:
|
|
- name: post_id
|
|
in: path
|
|
description: ID of the post to get
|
|
required: true
|
|
schema:
|
|
type: string
|
|
- name: include_deleted
|
|
in: query
|
|
description: Defines if result should include deleted posts, must have 'manage_system' (admin) permission.
|
|
required: false
|
|
schema:
|
|
type: boolean
|
|
default: false
|
|
- name: propertyGroup
|
|
in: query
|
|
description: >
|
|
The name of a single property group whose values should be hydrated onto each post's
|
|
metadata. Post attributes live in the `access_control` group. Only **PSAv2** groups are
|
|
accepted; passing a legacy v1 group, or an unrecognized name, returns 404. There is no
|
|
support for requesting more than one group per request.
|
|
|
|
When this parameter is set, the response carries no `ETag` header and `If-None-Match`
|
|
is ignored, so the full response is always returned.
|
|
required: false
|
|
schema:
|
|
type: string
|
|
responses:
|
|
"200":
|
|
description: Post retrieval successful
|
|
headers:
|
|
Has-Inaccessible-Posts:
|
|
schema:
|
|
type: boolean
|
|
description: This header is included with the value "true" if the post is past the cloud's plan limit.
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: "#/components/schemas/Post"
|
|
"400":
|
|
$ref: "#/components/responses/BadRequest"
|
|
"401":
|
|
$ref: "#/components/responses/Unauthorized"
|
|
"403":
|
|
$ref: "#/components/responses/Forbidden"
|
|
"404":
|
|
$ref: "#/components/responses/NotFound"
|
|
delete:
|
|
tags:
|
|
- posts
|
|
summary: Delete a post
|
|
description: >
|
|
Soft deletes a post, by marking the post as deleted in the database.
|
|
Soft deleted posts will not be returned in post queries.
|
|
|
|
##### Permissions
|
|
|
|
Must be logged in as the user or have `delete_others_posts` permission.
|
|
operationId: DeletePost
|
|
parameters:
|
|
- name: post_id
|
|
in: path
|
|
description: ID of the post to delete
|
|
required: true
|
|
schema:
|
|
type: string
|
|
responses:
|
|
"200":
|
|
description: Post 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"
|
|
put:
|
|
tags:
|
|
- posts
|
|
summary: Update a post
|
|
description: >
|
|
Update a post. Only the fields listed below are updatable, omitted
|
|
fields will be treated as blank.
|
|
|
|
##### Permissions
|
|
|
|
Must have `edit_post` permission for the channel the post is in.
|
|
operationId: UpdatePost
|
|
parameters:
|
|
- name: post_id
|
|
in: path
|
|
description: ID of the post to update
|
|
required: true
|
|
schema:
|
|
type: string
|
|
requestBody:
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
required:
|
|
- id
|
|
properties:
|
|
id:
|
|
description: ID of the post to update
|
|
type: string
|
|
is_pinned:
|
|
description: Set to `true` to pin the post to the channel it is in
|
|
type: boolean
|
|
message:
|
|
description: The message text of the post
|
|
type: string
|
|
has_reactions:
|
|
description: Set to `true` if the post has reactions to it
|
|
type: boolean
|
|
props:
|
|
description: A general JSON property bag to attach to the post
|
|
type: string
|
|
description: Post object that is to be updated
|
|
required: true
|
|
responses:
|
|
"200":
|
|
description: Post update successful
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: "#/components/schemas/Post"
|
|
"400":
|
|
$ref: "#/components/responses/BadRequest"
|
|
"401":
|
|
$ref: "#/components/responses/Unauthorized"
|
|
"403":
|
|
$ref: "#/components/responses/Forbidden"
|
|
"404":
|
|
$ref: "#/components/responses/NotFound"
|
|
"/api/v4/users/{user_id}/posts/{post_id}/set_unread":
|
|
post:
|
|
tags:
|
|
- posts
|
|
summary: Mark as unread from a post.
|
|
description: >
|
|
Mark a channel as being unread from a given post.
|
|
|
|
##### Permissions
|
|
|
|
Must have `read_channel` permission for the channel the post is in or if the channel is public, have the `read_public_channels` permission for the team.
|
|
|
|
Must have `edit_other_users` permission if the user is not the one marking the post for himself.
|
|
|
|
|
|
__Minimum server version__: 5.18
|
|
operationId: SetPostUnread
|
|
parameters:
|
|
- name: user_id
|
|
in: path
|
|
description: User GUID
|
|
required: true
|
|
schema:
|
|
type: string
|
|
- name: post_id
|
|
in: path
|
|
description: Post GUID
|
|
required: true
|
|
schema:
|
|
type: string
|
|
responses:
|
|
"200":
|
|
description: Post marked as unread successfully
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: "#/components/schemas/ChannelUnreadAt"
|
|
"400":
|
|
$ref: "#/components/responses/BadRequest"
|
|
"401":
|
|
$ref: "#/components/responses/Unauthorized"
|
|
"403":
|
|
$ref: "#/components/responses/Forbidden"
|
|
"404":
|
|
$ref: "#/components/responses/NotFound"
|
|
"/api/v4/posts/{post_id}/patch":
|
|
put:
|
|
tags:
|
|
- posts
|
|
summary: Patch a post
|
|
description: >
|
|
Partially update a post 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
|
|
|
|
Must have the `edit_post` permission.
|
|
operationId: PatchPost
|
|
parameters:
|
|
- name: post_id
|
|
in: path
|
|
description: Post GUID
|
|
required: true
|
|
schema:
|
|
type: string
|
|
requestBody:
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
properties:
|
|
is_pinned:
|
|
description: Set to `true` to pin the post to the channel it is in
|
|
type: boolean
|
|
message:
|
|
description: The message text of the post
|
|
type: string
|
|
file_ids:
|
|
description: The list of files attached to this post
|
|
type: array
|
|
items:
|
|
type: string
|
|
has_reactions:
|
|
description: Set to `true` if the post has reactions to it
|
|
type: boolean
|
|
props:
|
|
description: A general JSON property bag to attach to the post
|
|
type: string
|
|
description: Post object that is to be updated
|
|
required: true
|
|
responses:
|
|
"200":
|
|
description: Post patch successful
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: "#/components/schemas/Post"
|
|
"400":
|
|
$ref: "#/components/responses/BadRequest"
|
|
"401":
|
|
$ref: "#/components/responses/Unauthorized"
|
|
"403":
|
|
$ref: "#/components/responses/Forbidden"
|
|
"404":
|
|
$ref: "#/components/responses/NotFound"
|
|
"/api/v4/posts/{post_id}/thread":
|
|
get:
|
|
tags:
|
|
- posts
|
|
summary: Get a thread
|
|
description: >
|
|
Get a post and the rest of the posts in the same thread.
|
|
|
|
##### Permissions
|
|
|
|
Must have `read_channel` permission for the channel the post is in or if the channel is public, have the `read_public_channels` permission for the team.
|
|
operationId: GetPostThread
|
|
parameters:
|
|
- name: post_id
|
|
in: path
|
|
description: ID of a post in the thread
|
|
required: true
|
|
schema:
|
|
type: string
|
|
- name: perPage
|
|
in: query
|
|
description: The number of posts per page
|
|
schema:
|
|
type: integer
|
|
default: 0
|
|
- name: fromPost
|
|
in: query
|
|
description: The post_id to return the next page of posts from
|
|
schema:
|
|
type: string
|
|
default: ""
|
|
- name: fromCreateAt
|
|
in: query
|
|
description: The create_at timestamp to return the next page of posts from
|
|
schema:
|
|
type: integer
|
|
default: 0
|
|
- name: fromUpdateAt
|
|
in: query
|
|
description: The update_at timestamp to return the next page of posts from. You cannot set this with fromCreateAt, and with updatesOnly you cannot use direction=up.
|
|
schema:
|
|
type: integer
|
|
default: 0
|
|
- name: direction
|
|
in: query
|
|
description: The direction to return the posts. Either up or down.
|
|
schema:
|
|
type: string
|
|
default: ""
|
|
- name: skipFetchThreads
|
|
in: query
|
|
description: Whether to skip fetching threads or not
|
|
schema:
|
|
type: boolean
|
|
default: false
|
|
- name: collapsedThreads
|
|
in: query
|
|
description: Whether the client uses CRT or not
|
|
schema:
|
|
type: boolean
|
|
default: false
|
|
- name: collapsedThreadsExtended
|
|
in: query
|
|
description: Whether to return the associated users as part of the response or not
|
|
schema:
|
|
type: boolean
|
|
default: false
|
|
- name: updatesOnly
|
|
in: query
|
|
description: >
|
|
This flag is used to make the API work with the updateAt value. If you set this flag, you must set a value for fromUpdateAt.
|
|
With direction=down, replies deleted since fromUpdateAt are included, with `delete_at` set, an empty message and an empty metadata object.
|
|
A deleted root post still returns 404. Minimum server version for deleted replies is 12.1.
|
|
schema:
|
|
type: boolean
|
|
default: false
|
|
- name: propertyGroup
|
|
in: query
|
|
description: >
|
|
The name of a single property group whose values should be hydrated onto each post's
|
|
metadata. Post attributes live in the `access_control` group. Only **PSAv2** groups are
|
|
accepted; passing a legacy v1 group, or an unrecognized name, returns 404. There is no
|
|
support for requesting more than one group per request.
|
|
|
|
When this parameter is set, the response carries no `ETag` header and `If-None-Match`
|
|
is ignored, so the full response is always returned.
|
|
required: false
|
|
schema:
|
|
type: string
|
|
responses:
|
|
"200":
|
|
description: Post list retrieval successful
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: "#/components/schemas/PostList"
|
|
"400":
|
|
$ref: "#/components/responses/BadRequest"
|
|
"401":
|
|
$ref: "#/components/responses/Unauthorized"
|
|
"403":
|
|
$ref: "#/components/responses/Forbidden"
|
|
"404":
|
|
$ref: "#/components/responses/NotFound"
|
|
"/api/v4/users/{user_id}/posts/flagged":
|
|
get:
|
|
tags:
|
|
- posts
|
|
summary: Get a list of flagged posts
|
|
description: >
|
|
Get a page of flagged posts of a user provided user id string. Selects
|
|
from a channel, team, or all flagged posts by a user. Will only return
|
|
posts from channels in which the user is member.
|
|
|
|
##### Permissions
|
|
|
|
Must be user or have `manage_system` permission.
|
|
operationId: GetFlaggedPostsForUser
|
|
parameters:
|
|
- name: user_id
|
|
in: path
|
|
description: ID of the user
|
|
required: true
|
|
schema:
|
|
type: string
|
|
- name: team_id
|
|
in: query
|
|
description: Team ID
|
|
schema:
|
|
type: string
|
|
- name: channel_id
|
|
in: query
|
|
description: Channel ID
|
|
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 posts per page
|
|
schema:
|
|
type: integer
|
|
default: 60
|
|
responses:
|
|
"200":
|
|
description: Post list retrieval successful
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: array
|
|
items:
|
|
$ref: "#/components/schemas/PostList"
|
|
"400":
|
|
$ref: "#/components/responses/BadRequest"
|
|
"401":
|
|
$ref: "#/components/responses/Unauthorized"
|
|
"403":
|
|
$ref: "#/components/responses/Forbidden"
|
|
"/api/v4/posts/{post_id}/files/info":
|
|
get:
|
|
tags:
|
|
- posts
|
|
summary: Get file info for post
|
|
description: >
|
|
Gets a list of file information objects for the files attached to a
|
|
post.
|
|
|
|
##### Permissions
|
|
|
|
Must have `read_channel` permission for the channel the post is in.
|
|
operationId: GetFileInfosForPost
|
|
parameters:
|
|
- name: post_id
|
|
in: path
|
|
description: ID of the post
|
|
required: true
|
|
schema:
|
|
type: string
|
|
- name: include_deleted
|
|
in: query
|
|
description: Defines if result should include deleted posts, must have 'manage_system' (admin) permission.
|
|
required: false
|
|
schema:
|
|
type: boolean
|
|
default: false
|
|
responses:
|
|
"200":
|
|
description: File info retrieval successful
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: array
|
|
items:
|
|
$ref: "#/components/schemas/FileInfo"
|
|
"400":
|
|
$ref: "#/components/responses/BadRequest"
|
|
"401":
|
|
$ref: "#/components/responses/Unauthorized"
|
|
"403":
|
|
$ref: "#/components/responses/Forbidden"
|
|
"/api/v4/posts/{post_id}/info":
|
|
get:
|
|
tags:
|
|
- posts
|
|
summary: Get post info
|
|
description: |
|
|
Get additional metadata and access information for a post.
|
|
##### Permissions
|
|
Must be able to access the post's team and channel context.
|
|
operationId: GetPostInfo
|
|
parameters:
|
|
- name: post_id
|
|
in: path
|
|
description: Post ID
|
|
required: true
|
|
schema:
|
|
type: string
|
|
responses:
|
|
"200":
|
|
description: Post info retrieval successful
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: "#/components/schemas/PostInfo"
|
|
"400":
|
|
$ref: "#/components/responses/BadRequest"
|
|
"401":
|
|
$ref: "#/components/responses/Unauthorized"
|
|
"403":
|
|
$ref: "#/components/responses/Forbidden"
|
|
"404":
|
|
$ref: "#/components/responses/NotFound"
|
|
"/api/v4/posts/{post_id}/edit_history":
|
|
get:
|
|
tags:
|
|
- posts
|
|
summary: Get post edit history
|
|
description: |
|
|
Get edit history entries for a post.
|
|
##### Permissions
|
|
Must have `edit_post` permission in the channel. For most posts, only the original author can access history.
|
|
operationId: GetEditHistoryForPost
|
|
parameters:
|
|
- name: post_id
|
|
in: path
|
|
description: Post ID
|
|
required: true
|
|
schema:
|
|
type: string
|
|
responses:
|
|
"200":
|
|
description: Edit history retrieval successful
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: array
|
|
items:
|
|
$ref: "#/components/schemas/Post"
|
|
"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}/posts":
|
|
get:
|
|
tags:
|
|
- posts
|
|
summary: Get posts for a channel
|
|
description: >
|
|
Get a page of posts in a channel. Use the query parameters to modify the
|
|
behaviour of this endpoint. The parameter `since` must not be used with any of
|
|
`before`, `after`, `page`, and `per_page` parameters.
|
|
|
|
If `since` is used, it will always return all posts modified since that time,
|
|
ordered by their create time limited till 1000. A caveat with this parameter is that
|
|
there is no guarantee that the returned posts will be consecutive. It is left to the clients
|
|
to maintain state and fill any missing holes in the post order.
|
|
|
|
##### Permissions
|
|
|
|
Must have `read_channel` permission for the channel.
|
|
operationId: GetPostsForChannel
|
|
parameters:
|
|
- name: channel_id
|
|
in: path
|
|
description: The channel ID to get the posts for
|
|
required: true
|
|
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 posts per page
|
|
schema:
|
|
type: integer
|
|
default: 60
|
|
- name: since
|
|
in: query
|
|
description: Provide a non-zero value in Unix time milliseconds to select posts
|
|
modified after that time
|
|
schema:
|
|
type: integer
|
|
- name: before
|
|
in: query
|
|
description: A post id to select the posts that came before this one
|
|
schema:
|
|
type: string
|
|
- name: after
|
|
in: query
|
|
description: A post id to select the posts that came after this one
|
|
schema:
|
|
type: string
|
|
- name: include_deleted
|
|
in: query
|
|
description: Whether to include deleted posts or not. Must have system admin permissions.
|
|
schema:
|
|
type: boolean
|
|
default: false
|
|
- name: type
|
|
in: query
|
|
description: Filter posts by type.
|
|
schema:
|
|
type: string
|
|
- name: skipFetchThreads
|
|
in: query
|
|
description: Whether to skip fetching threads or not.
|
|
schema:
|
|
type: boolean
|
|
default: false
|
|
- name: collapsedThreads
|
|
in: query
|
|
description: Whether the client uses CRT or not.
|
|
schema:
|
|
type: boolean
|
|
default: false
|
|
- name: collapsedThreadsExtended
|
|
in: query
|
|
description: Whether to return the associated users as part of the response or not.
|
|
schema:
|
|
type: boolean
|
|
default: false
|
|
- name: propertyGroup
|
|
in: query
|
|
description: >
|
|
The name of a single property group whose values should be hydrated onto each post's
|
|
metadata. Post attributes live in the `access_control` group. Only **PSAv2** groups are
|
|
accepted; passing a legacy v1 group, or an unrecognized name, returns 404. There is no
|
|
support for requesting more than one group per request.
|
|
|
|
When this parameter is set, the response carries no `ETag` header and `If-None-Match`
|
|
is ignored, so the full response is always returned.
|
|
required: false
|
|
schema:
|
|
type: string
|
|
responses:
|
|
"200":
|
|
description: Post list retrieval successful
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: "#/components/schemas/PostList"
|
|
"400":
|
|
$ref: "#/components/responses/BadRequest"
|
|
"401":
|
|
$ref: "#/components/responses/Unauthorized"
|
|
"403":
|
|
$ref: "#/components/responses/Forbidden"
|
|
"404":
|
|
$ref: "#/components/responses/NotFound"
|
|
"/api/v4/users/{user_id}/channels/{channel_id}/posts/unread":
|
|
get:
|
|
tags:
|
|
- posts
|
|
summary: Get posts around oldest unread
|
|
description: >
|
|
Get the oldest unread post in the channel for the given user as well as
|
|
the posts around it.
|
|
The returned list is sorted in descending order (most recent post first).
|
|
|
|
##### Permissions
|
|
|
|
Must be logged in as the user or have `edit_other_users` permission, and must have `read_channel` permission for the channel.
|
|
|
|
__Minimum server version__: 5.14
|
|
operationId: GetPostsAroundLastUnread
|
|
parameters:
|
|
- name: user_id
|
|
in: path
|
|
description: ID of the user
|
|
required: true
|
|
schema:
|
|
type: string
|
|
- name: channel_id
|
|
in: path
|
|
description: The channel ID to get the posts for
|
|
required: true
|
|
schema:
|
|
type: string
|
|
- name: limit_before
|
|
in: query
|
|
description: Number of posts before the oldest unread posts. Maximum is 200 posts
|
|
if limit is set greater than that.
|
|
schema:
|
|
type: integer
|
|
default: 60
|
|
maximum: 200
|
|
minimum: 0
|
|
- name: limit_after
|
|
in: query
|
|
description: Number of posts after and including the oldest unread post. Maximum is
|
|
200 posts if limit is set greater than that.
|
|
schema:
|
|
type: integer
|
|
default: 60
|
|
maximum: 200
|
|
minimum: 1
|
|
- name: skipFetchThreads
|
|
in: query
|
|
description: Whether to skip fetching threads or not
|
|
schema:
|
|
type: boolean
|
|
default: false
|
|
- name: collapsedThreads
|
|
in: query
|
|
description: Whether the client uses CRT or not
|
|
schema:
|
|
type: boolean
|
|
default: false
|
|
- name: collapsedThreadsExtended
|
|
in: query
|
|
description: Whether to return the associated users as part of the response or not
|
|
schema:
|
|
type: boolean
|
|
default: false
|
|
- name: propertyGroup
|
|
in: query
|
|
description: >
|
|
The name of a single property group whose values should be hydrated onto each post's
|
|
metadata. Post attributes live in the `access_control` group. Only **PSAv2** groups are
|
|
accepted; passing a legacy v1 group, or an unrecognized name, returns 404. There is no
|
|
support for requesting more than one group per request.
|
|
|
|
When this parameter is set, the response carries no `ETag` header and `If-None-Match`
|
|
is ignored, so the full response is always returned.
|
|
required: false
|
|
schema:
|
|
type: string
|
|
responses:
|
|
"200":
|
|
description: Post list retrieval successful
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: "#/components/schemas/PostList"
|
|
"400":
|
|
$ref: "#/components/responses/BadRequest"
|
|
"401":
|
|
$ref: "#/components/responses/Unauthorized"
|
|
"403":
|
|
$ref: "#/components/responses/Forbidden"
|
|
"404":
|
|
$ref: "#/components/responses/NotFound"
|
|
"/api/v4/teams/{team_id}/posts/search":
|
|
post:
|
|
tags:
|
|
- posts
|
|
summary: Search for team posts
|
|
description: |
|
|
Search posts in the team and from the provided terms string.
|
|
##### Permissions
|
|
Must be authenticated and have the `view_team` permission.
|
|
operationId: SearchPosts
|
|
parameters:
|
|
- name: team_id
|
|
in: path
|
|
description: Team GUID
|
|
required: true
|
|
schema:
|
|
type: string
|
|
requestBody:
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
required:
|
|
- terms
|
|
- is_or_search
|
|
properties:
|
|
terms:
|
|
type: string
|
|
description: The search terms as inputed by the user. To search for posts
|
|
from a user include `from:someusername`, using a user's
|
|
username. To search in a specific channel include
|
|
`in:somechannel`, using the channel name (not the display
|
|
name).
|
|
is_or_search:
|
|
type: boolean
|
|
description: Set to true if an Or search should be performed vs an And
|
|
search.
|
|
time_zone_offset:
|
|
type: integer
|
|
default: 0
|
|
description: Offset from UTC of user timezone for date searches.
|
|
include_deleted_channels:
|
|
type: boolean
|
|
description: Set to true if deleted channels should be included in the
|
|
search. (archived channels)
|
|
page:
|
|
type: integer
|
|
default: 0
|
|
description: The page to select. (Only works with Elasticsearch)
|
|
per_page:
|
|
type: integer
|
|
default: 60
|
|
description: The number of posts per page. (Only works with Elasticsearch)
|
|
description: The search terms and logic to use in the search.
|
|
required: true
|
|
responses:
|
|
"200":
|
|
description: Post list retrieval successful
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: "#/components/schemas/PostListWithSearchMatches"
|
|
"400":
|
|
$ref: "#/components/responses/BadRequest"
|
|
"401":
|
|
$ref: "#/components/responses/Unauthorized"
|
|
"403":
|
|
$ref: "#/components/responses/Forbidden"
|
|
"/api/v4/posts/{post_id}/pin":
|
|
post:
|
|
tags:
|
|
- posts
|
|
summary: Pin a post to the channel
|
|
description: >
|
|
Pin a post to a channel it is in based from the provided post id string.
|
|
|
|
##### Permissions
|
|
|
|
Must be authenticated and have the `read_channel` permission to the channel the post is in.
|
|
operationId: PinPost
|
|
parameters:
|
|
- name: post_id
|
|
in: path
|
|
description: Post GUID
|
|
required: true
|
|
schema:
|
|
type: string
|
|
responses:
|
|
"200":
|
|
description: Pinned post successful
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: "#/components/schemas/StatusOK"
|
|
"400":
|
|
$ref: "#/components/responses/BadRequest"
|
|
"401":
|
|
$ref: "#/components/responses/Unauthorized"
|
|
"403":
|
|
$ref: "#/components/responses/Forbidden"
|
|
"404":
|
|
$ref: "#/components/responses/NotFound"
|
|
"/api/v4/posts/{post_id}/unpin":
|
|
post:
|
|
tags:
|
|
- posts
|
|
summary: Unpin a post to the channel
|
|
description: >
|
|
Unpin a post to a channel it is in based from the provided post id
|
|
string.
|
|
|
|
##### Permissions
|
|
|
|
Must be authenticated and have the `read_channel` permission to the channel the post is in.
|
|
operationId: UnpinPost
|
|
parameters:
|
|
- name: post_id
|
|
in: path
|
|
description: Post GUID
|
|
required: true
|
|
schema:
|
|
type: string
|
|
responses:
|
|
"200":
|
|
description: Unpinned post successful
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: "#/components/schemas/StatusOK"
|
|
"400":
|
|
$ref: "#/components/responses/BadRequest"
|
|
"401":
|
|
$ref: "#/components/responses/Unauthorized"
|
|
"403":
|
|
$ref: "#/components/responses/Forbidden"
|
|
"404":
|
|
$ref: "#/components/responses/NotFound"
|
|
"/api/v4/posts/{post_id}/actions/{action_id}":
|
|
post:
|
|
tags:
|
|
- posts
|
|
summary: Perform a post action
|
|
description: >
|
|
Perform a post action, which allows users to interact with integrations
|
|
through posts.
|
|
|
|
##### Permissions
|
|
|
|
Must be authenticated and have the `read_channel` permission to the channel the post is in.
|
|
operationId: DoPostAction
|
|
parameters:
|
|
- name: post_id
|
|
in: path
|
|
description: Post GUID
|
|
required: true
|
|
schema:
|
|
type: string
|
|
- name: action_id
|
|
in: path
|
|
description: Action GUID
|
|
required: true
|
|
schema:
|
|
type: string
|
|
responses:
|
|
"200":
|
|
description: Post action successful
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: "#/components/schemas/StatusOK"
|
|
"400":
|
|
$ref: "#/components/responses/BadRequest"
|
|
"401":
|
|
$ref: "#/components/responses/Unauthorized"
|
|
"403":
|
|
$ref: "#/components/responses/Forbidden"
|
|
"429":
|
|
description: The upstream integration rate-limited the request. The
|
|
original status code is preserved so clients can honor retry
|
|
semantics.
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: "#/components/schemas/AppError"
|
|
"502":
|
|
description: The upstream integration returned a 5xx (other than 503).
|
|
Surfaced as Bad Gateway because the failure is upstream of Mattermost.
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: "#/components/schemas/AppError"
|
|
"503":
|
|
description: The upstream integration is unavailable. The original
|
|
status code is preserved so clients can honor retry semantics.
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: "#/components/schemas/AppError"
|
|
"/api/v4/posts/ids":
|
|
post:
|
|
tags:
|
|
- posts
|
|
summary: Get posts by a list of ids
|
|
description: >
|
|
Fetch a list of posts based on the provided postIDs
|
|
|
|
##### Permissions
|
|
|
|
Must have `read_channel` permission for the channel the post is in or if the channel is public, have the `read_public_channels` permission for the team.
|
|
operationId: getPostsByIds
|
|
requestBody:
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: array
|
|
items:
|
|
type: string
|
|
description: List of post ids
|
|
required: true
|
|
responses:
|
|
"200":
|
|
description: Post list retrieval successful
|
|
headers:
|
|
Has-Inaccessible-Posts:
|
|
schema:
|
|
type: boolean
|
|
description: Indicates whether the posts have been truncated as per the cloud's plan limit.
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: array
|
|
items:
|
|
$ref: "#/components/schemas/Post"
|
|
"400":
|
|
$ref: "#/components/responses/BadRequest"
|
|
"401":
|
|
$ref: "#/components/responses/Unauthorized"
|
|
"403":
|
|
$ref: "#/components/responses/Forbidden"
|
|
"/api/v4/users/{user_id}/posts/{post_id}/reminder":
|
|
post:
|
|
tags:
|
|
- posts
|
|
summary: Set a post reminder
|
|
description: >
|
|
Set a reminder for the user for the post.
|
|
|
|
##### Permissions
|
|
|
|
Must have `read_channel` permission for the channel the post is in.
|
|
|
|
|
|
__Minimum server version__: 7.2
|
|
operationId: SetPostReminder
|
|
parameters:
|
|
- name: user_id
|
|
in: path
|
|
description: User GUID
|
|
required: true
|
|
schema:
|
|
type: string
|
|
- name: post_id
|
|
in: path
|
|
description: Post GUID
|
|
required: true
|
|
schema:
|
|
type: string
|
|
requestBody:
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
required:
|
|
- target_time
|
|
properties:
|
|
target_time:
|
|
type: integer
|
|
description: Target time for the reminder
|
|
description: Target time for the reminder
|
|
required: true
|
|
responses:
|
|
"200":
|
|
description: Reminder set successfully
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: "#/components/schemas/StatusOK"
|
|
"400":
|
|
$ref: "#/components/responses/BadRequest"
|
|
"401":
|
|
$ref: "#/components/responses/Unauthorized"
|
|
"403":
|
|
$ref: "#/components/responses/Forbidden"
|
|
"404":
|
|
$ref: "#/components/responses/NotFound"
|
|
"/api/v4/users/{user_id}/posts/{post_id}/ack":
|
|
post:
|
|
tags:
|
|
- posts
|
|
summary: Acknowledge a post
|
|
description: >
|
|
Acknowledge a post that has a request for acknowledgements.
|
|
|
|
##### Permissions
|
|
|
|
Must have `read_channel` permission for the channel the post is in.<br/>
|
|
Must be logged in as the user or have `edit_other_users` permission.
|
|
|
|
|
|
__Minimum server version__: 7.7
|
|
operationId: SaveAcknowledgementForPost
|
|
parameters:
|
|
- name: user_id
|
|
in: path
|
|
description: User GUID
|
|
required: true
|
|
schema:
|
|
type: string
|
|
- name: post_id
|
|
in: path
|
|
description: Post GUID
|
|
required: true
|
|
schema:
|
|
type: string
|
|
responses:
|
|
"200":
|
|
description: Acknowledgement saved successfully
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: "#/components/schemas/PostAcknowledgement"
|
|
"400":
|
|
$ref: "#/components/responses/BadRequest"
|
|
"401":
|
|
$ref: "#/components/responses/Unauthorized"
|
|
"403":
|
|
$ref: "#/components/responses/Forbidden"
|
|
"404":
|
|
$ref: "#/components/responses/NotFound"
|
|
delete:
|
|
tags:
|
|
- posts
|
|
summary: Delete a post acknowledgement
|
|
description: >
|
|
Delete an acknowledgement form a post that you had previously acknowledged.
|
|
|
|
##### Permissions
|
|
|
|
Must have `read_channel` permission for the channel the post is in.<br/>
|
|
Must be logged in as the user or have `edit_other_users` permission.<br/>
|
|
The post must have been acknowledged in the previous 5 minutes.
|
|
|
|
|
|
__Minimum server version__: 7.7
|
|
operationId: DeleteAcknowledgementForPost
|
|
parameters:
|
|
- name: user_id
|
|
in: path
|
|
description: User GUID
|
|
required: true
|
|
schema:
|
|
type: string
|
|
- name: post_id
|
|
in: path
|
|
description: Post GUID
|
|
required: true
|
|
schema:
|
|
type: string
|
|
responses:
|
|
"200":
|
|
description: Acknowledgement deleted successfully
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: "#/components/schemas/StatusOK"
|
|
"400":
|
|
$ref: "#/components/responses/BadRequest"
|
|
"401":
|
|
$ref: "#/components/responses/Unauthorized"
|
|
"403":
|
|
$ref: "#/components/responses/Forbidden"
|
|
"404":
|
|
$ref: "#/components/responses/NotFound"
|
|
"/api/v4/posts/{post_id}/move":
|
|
post:
|
|
tags:
|
|
- posts
|
|
summary: Move a post (and any posts within that post's thread)
|
|
description: >
|
|
Move a post/thread to another channel.
|
|
|
|
THIS IS A BETA FEATURE. The API is subject to change without notice.
|
|
|
|
##### Permissions
|
|
|
|
Must have `read_channel` permission for the channel the post is in.
|
|
Must have `write_post` permission for the channel the post is being moved to.
|
|
|
|
|
|
__Minimum server version__: 9.3
|
|
operationId: MoveThread
|
|
parameters:
|
|
- name: post_id
|
|
in: path
|
|
description: The identifier of the post to move
|
|
required: true
|
|
schema:
|
|
type: string
|
|
requestBody:
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
required:
|
|
- channel_id
|
|
properties:
|
|
channel_id:
|
|
type: string
|
|
description: The channel identifier of where the post/thread is to be moved
|
|
description: The channel identifier of where the post/thread is to be moved
|
|
required: true
|
|
responses:
|
|
"200":
|
|
description: Post moved successfully
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: "#/components/schemas/StatusOK"
|
|
"400":
|
|
$ref: "#/components/responses/BadRequest"
|
|
"401":
|
|
$ref: "#/components/responses/Unauthorized"
|
|
"403":
|
|
$ref: "#/components/responses/Forbidden"
|
|
"404":
|
|
$ref: "#/components/responses/NotFound"
|
|
"501":
|
|
$ref: "#/components/responses/NotImplemented"
|
|
|
|
"/api/v4/posts/{post_id}/restore/{restore_version_id}":
|
|
post:
|
|
tags:
|
|
- posts
|
|
summary: Restores a past version of a post
|
|
description: >
|
|
Restores the post with `post_id` to its past version having the ID `restore_version_id`.
|
|
|
|
##### Permissions
|
|
|
|
Must have `read_channel` permission for the channel the post is in.
|
|
Must have `edit_post` permission for the channel the post is being moved to.
|
|
Must be the author of the post being restored.
|
|
|
|
|
|
__Minimum server version__: 10.5
|
|
operationId: RestorePostVersion
|
|
parameters:
|
|
- name: post_id
|
|
in: path
|
|
description: The identifier of the post to restore
|
|
required: true
|
|
schema:
|
|
type: string
|
|
- name: restore_version_id
|
|
in: path
|
|
description: The identifier of the past version of post to restore to
|
|
required: true
|
|
schema:
|
|
type: string
|
|
responses:
|
|
"200":
|
|
description: Post restored successful
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: "#/components/schemas/Post"
|
|
"400":
|
|
$ref: "#/components/responses/BadRequest"
|
|
"401":
|
|
$ref: "#/components/responses/Unauthorized"
|
|
"403":
|
|
$ref: "#/components/responses/Forbidden"
|
|
"404":
|
|
$ref: "#/components/responses/NotFound"
|
|
"501":
|
|
$ref: "#/components/responses/NotImplemented"
|
|
|
|
"/api/v4/posts/{post_id}/reveal":
|
|
get:
|
|
tags:
|
|
- posts
|
|
summary: Reveal a burn-on-read post
|
|
description: >
|
|
Reveal a burn-on-read post. This endpoint allows a user to reveal a post
|
|
that was created with burn-on-read functionality. Once revealed, the post
|
|
content becomes visible to the user. If the post is already revealed and
|
|
not expired, this is a no-op. If the post has expired, an error will be returned.
|
|
|
|
##### Permissions
|
|
|
|
Must have `read_channel` permission for the channel the post is in.<br/>
|
|
Must be a member of the channel the post is in.<br/>
|
|
Cannot reveal your own post.
|
|
|
|
##### Feature Flag
|
|
|
|
Requires `BurnOnRead` feature flag and Enterprise Advanced license.
|
|
|
|
__Minimum server version__: 11.2
|
|
operationId: RevealPost
|
|
parameters:
|
|
- name: post_id
|
|
in: path
|
|
description: The identifier of the post to reveal
|
|
required: true
|
|
schema:
|
|
type: string
|
|
responses:
|
|
"200":
|
|
description: Post revealed successfully
|
|
headers:
|
|
Has-Inaccessible-Posts:
|
|
schema:
|
|
type: boolean
|
|
description: This header is included with the value "true" if the post is past the cloud's plan limit.
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: "#/components/schemas/Post"
|
|
"400":
|
|
$ref: "#/components/responses/BadRequest"
|
|
"401":
|
|
$ref: "#/components/responses/Unauthorized"
|
|
"403":
|
|
$ref: "#/components/responses/Forbidden"
|
|
"501":
|
|
$ref: "#/components/responses/NotImplemented"
|
|
|
|
"/api/v4/posts/{post_id}/burn":
|
|
delete:
|
|
tags:
|
|
- posts
|
|
summary: Burn a burn-on-read post
|
|
description: >
|
|
Burn a burn-on-read post. This endpoint allows a user to burn a post that
|
|
was created with burn-on-read functionality. If the user is the author of
|
|
the post, the post will be permanently deleted. If the user is not the author,
|
|
the post will be expired for that user by updating their read receipt expiration
|
|
time. If the user has not revealed the post yet, an error will be returned.
|
|
If the post is already expired for the user, this is a no-op.
|
|
|
|
##### Permissions
|
|
|
|
Must have `read_channel` permission for the channel the post is in.<br/>
|
|
Must be a member of the channel the post is in.
|
|
|
|
##### Feature Flag
|
|
|
|
Requires `BurnOnRead` feature flag and Enterprise Advanced license.
|
|
|
|
__Minimum server version__: 11.2
|
|
operationId: BurnPost
|
|
parameters:
|
|
- name: post_id
|
|
in: path
|
|
description: The identifier of the post to burn
|
|
required: true
|
|
schema:
|
|
type: string
|
|
responses:
|
|
"200":
|
|
description: Post burned successfully
|
|
headers:
|
|
Has-Inaccessible-Posts:
|
|
schema:
|
|
type: boolean
|
|
description: This header is included with the value "true" if the post is past the cloud's plan limit.
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: "#/components/schemas/StatusOK"
|
|
"400":
|
|
$ref: "#/components/responses/BadRequest"
|
|
"401":
|
|
$ref: "#/components/responses/Unauthorized"
|
|
"403":
|
|
$ref: "#/components/responses/Forbidden"
|
|
"501":
|
|
$ref: "#/components/responses/NotImplemented"
|
|
|
|
"/api/v4/posts/rewrite":
|
|
post:
|
|
tags:
|
|
- posts
|
|
summary: Rewrite a message using AI
|
|
description: >
|
|
Rewrite a message using AI based on the specified action. The message will be
|
|
processed by an AI agent and returned in a rewritten form.
|
|
|
|
##### Permissions
|
|
|
|
Must be authenticated.
|
|
|
|
__Minimum server version__: 11.2
|
|
operationId: RewriteMessage
|
|
requestBody:
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
required:
|
|
- agent_id
|
|
- message
|
|
- action
|
|
properties:
|
|
agent_id:
|
|
type: string
|
|
description: The ID of the AI agent to use for rewriting
|
|
message:
|
|
type: string
|
|
description: The message text to rewrite
|
|
action:
|
|
type: string
|
|
description: The rewrite action to perform
|
|
enum:
|
|
- custom
|
|
- shorten
|
|
- elaborate
|
|
- improve_writing
|
|
- fix_spelling
|
|
- simplify
|
|
- summarize
|
|
custom_prompt:
|
|
type: string
|
|
description: Custom prompt for rewriting. Required when action is "custom", optional otherwise.
|
|
description: Rewrite request object
|
|
required: true
|
|
responses:
|
|
"200":
|
|
description: Message rewritten successfully
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
properties:
|
|
rewritten_text:
|
|
type: string
|
|
description: The rewritten message text
|
|
"400":
|
|
$ref: "#/components/responses/BadRequest"
|
|
"401":
|
|
$ref: "#/components/responses/Unauthorized"
|
|
"500":
|
|
description: Internal server error
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: "#/components/schemas/AppError"
|