PUT /posts/{postId}

Updates a post (only author or admin can perform this action).

Path parameters

  • postId string Required

    The post ID

application/json

Body Required

  • content string | null

    Updated content of the post

  • attachments array[string(uri)] | null

    Array of attachment URLs

  • linkedResourceIds array[string] | null

    Array of linked resource IDs

  • linkedLessonId string | null

    If updating lesson link, provide lesson ID

  • isPinned boolean | null

    Whether to pin the post

  • allowComments boolean | null

    Whether comments are allowed

Responses

  • 200 application/json

    Post updated successfully

    Hide response attributes Show response attributes object
    • success boolean
    • code integer(int32)
    • message string
    • data object

      Post representing announcements, schedule events, or general messages in a class

      Hide data attributes Show data attributes object
      • id string Required

        Unique identifier for the post

      • classId string Required

        ID of the class

      • authorId string Required

        ID of the post author

      • author object | null

        Author information (populated on GET)

        Hide author attributes Show author attributes object | null
        • id string
        • firstName string
        • lastName string
        • avatarUrl string
      • content string Required

        Content of the post

      • type string Required

        Type of post

        Values are announcement, schedule_event, or general.

      • attachments array[string(uri)] | null

        Array of attachment URLs

      • linkedResources array[string] | null

        Array of linked resource IDs (lesson IDs or individual resource IDs)

      • linkedLesson object | null

        If a lesson is linked, includes lesson data with its resources combined with individual resources

        Hide linkedLesson attributes Show linkedLesson attributes object | null
        • id string
        • title string
        • resources array[object]

          Lesson resource representing teaching materials and resources

          Hide resources attributes Show resources attributes object
          • id string Required

            Unique identifier for the resource

          • lessonId string Required

            ID of the lesson

          • name string Required

            Name of the resource

            Maximum length is 200.

          • type string Required

            Type of resource

            Values are presentation, mindmap, document, video, audio, image, worksheet, equipment, or other.

          • url string(uri) | null

            URL of the resource

          • filePath string | null

            File path of the resource

          • description string | null

            Description of the resource

          • isRequired boolean

            Whether the resource is required for the lesson

          • isPrepared boolean

            Whether the resource has been prepared

          • createdAt string(date-time)

            Timestamp when the resource was created

      • isPinned boolean

        Whether post is pinned

      • allowComments boolean

        Whether comments are allowed on this post

      • createdAt string(date-time)

        Timestamp when post was created

      • updatedAt string(date-time)

        Timestamp when post was last updated

  • 400 application/json

    Bad Request - Invalid input data or malformed request

    Hide response attributes Show response attributes object
    • success boolean
    • code integer
    • errorCode string
    • message string
    • timestamp string(date-time)
  • 401 application/json

    Unauthorized - Invalid or missing authentication token

    Hide response attributes Show response attributes object
    • success boolean
    • code integer
    • errorCode string
    • message string
    • timestamp string(date-time)
  • 403 application/json

    Forbidden - Only post author or admin can update

    Hide response attributes Show response attributes object
    • success boolean
    • code integer
    • errorCode string
    • message string
    • timestamp string(date-time)
  • 404 application/json

    Post not found

    Hide response attributes Show response attributes object
    • success boolean
    • code integer
    • errorCode string
    • message string
    • timestamp string(date-time)
  • 500 application/json

    Internal Server Error

    Hide response attributes Show response attributes object
    • success boolean
    • code integer
    • errorCode string
    • message string
    • timestamp string(date-time)
PUT /posts/{postId}
curl \
 --request PUT 'http://localhost:8080/api/posts/{postId}' \
 --header "Authorization: Bearer $ACCESS_TOKEN" \
 --header "Content-Type: application/json" \
 --data '{"content":"Updated announcement: Class moved to next week","attachments":["https://example.com"],"linkedResourceIds":["string"],"linkedLessonId":"550e8400-e29b-41d4-a716-446655440005","isPinned":false,"allowComments":true}'
Request examples
{
  "content": "Updated announcement: Class moved to next week",
  "attachments": [
    "https://example.com"
  ],
  "linkedResourceIds": [
    "string"
  ],
  "linkedLessonId": "550e8400-e29b-41d4-a716-446655440005",
  "isPinned": false,
  "allowComments": true
}
Response examples (200)
{
  "success": true,
  "code": 200,
  "message": "string",
  "data": {
    "id": "550e8400-e29b-41d4-a716-446655440008",
    "classId": "550e8400-e29b-41d4-a716-446655440000",
    "authorId": "550e8400-e29b-41d4-a716-446655440001",
    "author": {
      "id": "string",
      "firstName": "string",
      "lastName": "string",
      "avatarUrl": "string"
    },
    "content": "Check out this lesson on quadratic equations",
    "type": "announcement",
    "attachments": [
      "https://example.com/file.pdf"
    ],
    "linkedResources": [
      "550e8400-e29b-41d4-a716-446655440005"
    ],
    "linkedLesson": {
      "id": "string",
      "title": "string",
      "resources": [
        {
          "id": "550e8400-e29b-41d4-a716-446655440006",
          "lessonId": "550e8400-e29b-41d4-a716-446655440005",
          "name": "Quadratic Formula Worksheet",
          "type": "document",
          "url": "https://example.com/worksheet.pdf",
          "filePath": "/uploads/worksheet.pdf",
          "description": "Practice worksheet for quadratic equations",
          "isRequired": true,
          "isPrepared": false,
          "createdAt": "2024-01-15T10:30:00Z"
        }
      ]
    },
    "isPinned": false,
    "allowComments": true,
    "createdAt": "2024-09-20T10:30:00Z",
    "updatedAt": "2024-09-20T14:45:00Z"
  }
}
Response examples (400)
{
  "success": false,
  "code": 42,
  "errorCode": "string",
  "message": "string",
  "timestamp": "2026-05-04T09:42:00Z"
}
Response examples (401)
{
  "success": false,
  "code": 42,
  "errorCode": "string",
  "message": "string",
  "timestamp": "2026-05-04T09:42:00Z"
}
Response examples (403)
{
  "success": false,
  "code": 42,
  "errorCode": "string",
  "message": "string",
  "timestamp": "2026-05-04T09:42:00Z"
}
Response examples (404)
{
  "success": false,
  "code": 42,
  "errorCode": "string",
  "message": "string",
  "timestamp": "2026-05-04T09:42:00Z"
}
Response examples (500)
{
  "success": false,
  "code": 42,
  "errorCode": "string",
  "message": "string",
  "timestamp": "2026-05-04T09:42:00Z"
}