> ## Documentation Index
> Fetch the complete documentation index at: https://docs.opigno.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Get a single post

You can retrieve an information about any post the current user has access to by calling `getPost` query.
It will return the `Post` object that represents both - post and comment:

| Parameter           | Type                                                       | Description                                                                                                                                                               |
| :------------------ | :--------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `id`                | `ID`                                                       | **Required**. The post entity ID.                                                                                                                                         |
| `text`              | `String`                                                   | **Required**. The post text. Will be returned as a markup with all included available tags (`<a>`, `<p>`, `<br>`).                                                        |
| `authorUserContext` | `UserContext`                                              | Contains the post author user context data.                                                                                                                               |
| `created`           | `Int`                                                      | **Required**. Timestamp when the post was created.                                                                                                                        |
| `parentPost`        | `Post`                                                     | Contain the parent post **for a comment**. Will be empty if a post is returned.                                                                                           |
| `cta`               | `[Cta]`                                                    | Contains the list of [Call To Action](#post-cta) objects available for the given post.                                                                                    |
| `commentsNumber`    | `Int`                                                      | Contains the number of related comments for the post. Will return NULL for a comment.                                                                                     |
| `isLiked`           | `Boolean`                                                  | **Required**. Represents the like flag. If `true`, the post is liked by the current API user.                                                                             |
| `isPinned`          | `Boolean`                                                  | **Required**. Represents the pin flag. If `true`, the post is pinned by the current API user. Only posts can be pinned, not comments.                                     |
| `likesNumber`       | `Int`                                                      | **Required**. Contains the number of "like" reactions for the given post.                                                                                                 |
| `sharedContent`     | `PostSharedContent`                                        | Represents the data of the content that was shared in the post (learning path/certificate/badge). Available only for posts and empty for a comment.                       |
| `images`            | \[`MediaImage`]                                            | Images shared in the post. It is possible to share up to 10 images in one post, max image size is 20 Mb. Allowed extensions: png, jpg, jpeg, gif.                         |
| `files`             | \[`MediaFile`]                                             | Files shared in the post. It is possible to share up to 10 files in one post, max file size is 20 Mb. Allowed extensions: txt, pdf, doc, docx, xls, xlsx, ppt, pptx, svg. |
| `community`         | [`Community`](/OpignoEnterpriseAPI/Community/GetCommunity) | Represents the community the post relates to. Optional, will remain empty for the regular social posts.                                                                   |

## `PostSharedContent` object

| Parameter     | Type                    | Description                                                                                        |
| :------------ | :---------------------- | :------------------------------------------------------------------------------------------------- |
| `id`          | `ID`                    | **Required**. ID of the shared content (learning path/certificate/badge).                          |
| `type`        | `PostSharedContentType` | **Required**. Available options: `LEARNING_PATH`, `CERTIFICATE`, `BADGE`.                          |
| `title`       | `String`                | **Required**. The content title.                                                                   |
| `description` | `String`                | The content description (available only for a learning path).                                      |
| `image`       | `MediaImage`            | Represents an image associated with the shared content.                                            |
| `earnedOn`    | `Int`                   | A timestamp of the date when the award was earned (available only for the certificates or badges). |

## Post CTA

| Action ID                  | Description                                                                                                                                 | Corresponding mutation/query                                                                                 |
| :------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------ | :----------------------------------------------------------------------------------------------------------- |
| `COMMENT_POST`             | Allows to add a comment to the given post.                                                                                                  | [`createPostComment`](/OpignoEnterpriseAPI/Post/CreatePostComment)                                           |
| `PIN_POST`                 | Allows to mark the given post as pinned for the current API user.                                                                           | [`pinPost`](/OpignoEnterpriseAPI/Post/ExtraPostOperations#pin-the-post)                                      |
| `UNPIN_POST`               | Unpins the previously pinned post.                                                                                                          | [`unpinPost`](/OpignoEnterpriseAPI/Post/ExtraPostOperations#unpin-the-post)                                  |
| `PIN_POST_FOR_COMMUNITY`   | Available only for community posts and can be executed by the community owner. Marks the post as pinned for all community members.          | [`pinPostForCommunity`](/OpignoEnterpriseAPI/Community/PinUnpinCommunityPost#pin-post-for-the-community)     |
| `UNPIN_POST_FOR_COMMUNITY` | Available only for community posts and can be executed by the community owner. Unpins the previously pinned post for all community members. | [`unpinPostForCommunity`](/OpignoEnterpriseAPI/Community/PinUnpinCommunityPost#unpin-post-for-the-community) |
| `EDIT_POST`                | Allows to update the post/comment text and available only for the author.                                                                   | [`editPost`](/OpignoEnterpriseAPI/Post/EditPost)                                                             |
| `DELETE_POST`              | Allows to delete the post. Available for the author or the user associated with a context with `ADMINISTRATOR` scope.                       | [`deletePost`](/OpignoEnterpriseAPI/Post/ExtraPostOperations#delete-the-post%2Fcomment)                      |
| `HIDE_POST`                | Hides the post for the current API user.                                                                                                    | [`hidePost`](/OpignoEnterpriseAPI/Post/ExtraPostOperations#hide-the-post)                                    |
| `TOGGLE_LIKE`              | Allows to add/remove "like" reaction on the post.                                                                                           | [`toggleLike`](/OpignoEnterpriseAPI/Post/TogglePostLike)                                                     |
| `REMOVE_CONNECTION`        | Removes the post author from the current user network.                                                                                      | [`removeUserConnection`](/OpignoEnterpriseAPI/UserConnection/RemoveUserConnection)                           |
| `REPORT_ABUSE`             | Allows to report a post or a comment as an abusive.                                                                                         | [`reportAbuse`](/OpignoEnterpriseAPI/ReportAbuse)                                                            |

<CodeGroup>
  ```filename GraphQL theme={null}
    query getPost {
      getPost(postId: 175) {
        id
        text
        created
        commentsNumber
        isLiked
        likesNumber
        authorUserContext {
          id
          uuid
        }
        sharedContent {
        id
        type
        title
        description
        earnedOn
          image {
            alt
            title
            url
          }
        }
        cta {
          actionId
          title
          arguments {
            key
            value
          }
        }
      }
    }
  ```

  ```File Query result [expandable] theme={null}
    {
      "data": {
        "getPost": {
          "id": "175",
          "text": "<p>This is a dummy post text</p>\n",
          "created": 1751641926,
          "commentsNumber": 2,
          "isLiked": false,
          "likesNumber": 1,
          "authorUserContext": {
            "id": "915",
            "uuid": "5acfc440-88e0-4286-b089-c0f03575ed9a"
          },
          "sharedContent": {
            "id": "69",
            "type": "LEARNING_PATH",
            "title": "How far would you go for a Nespresso coffee?",
            "description": "<p>How far would you go for the Unforgettable Taste of a Nespresso coffee? Nespresso reunites George Clooney and Jean Dujardin on screen in new action-comedy commercial.</p>",
            "earnedOn": null,
            "image": {
              "alt": null,
              "title": "Nespresso - Quiz.jpg",
              "url": "http://opigno4-project.docksal.site:8080/sites/default/files/2025-02/Nespresso%20-%20Quiz.jpg"
            }
          },
          "cta": [
            {
              "actionId": "COMMENT_POST",
              "title": "Comment",
              "arguments": [
                {
                  "key": "postId",
                  "value": "175"
                }
              ]
            },
            {
              "actionId": "PIN_POST",
              "title": "Pin the post to the top",
              "arguments": [
                {
                  "key": "postId",
                  "value": "175"
                }
              ]
            },
            {
              "actionId": "EDIT_POST",
              "title": "Edit the post",
              "arguments": [
                {
                  "key": "postId",
                  "value": "175"
                }
              ]
            },
            {
              "actionId": "DELETE_POST",
              "title": "Delete the post",
              "arguments": [
                {
                  "key": "postId",
                  "value": "175"
                }
              ]
            },
            {
              "actionId": "TOGGLE_LIKE",
              "title": "Toggle like",
              "arguments": [
                {
                  "key": "postId",
                  "value": "175"
                }
              ]
            }
          ]
        }
      }
    }
  ```
</CodeGroup>
