# InfoboardPosts

`InfoboardPosts` are the main entity of the `Infoboard` and define RTE content that can be shared with any desired [Department](/api-reference/departments.md).

They can have multiple [InfoboardComments](/api-reference/infoboard/infoboard-comments.md) that may relate to the content of the `InfoboardPost`.

Additionally, `InfoboardPosts` can be assigned to a [InfoboardChannel](/api-reference/infoboard/infoboard-channels.md) to

## Model Definition

### Alias

`infoboardPost`

### Relations

| Key                | Relation                                                                        | Type            | Relation Field(s)                                                         |
| ------------------ | ------------------------------------------------------------------------------- | --------------- | ------------------------------------------------------------------------- |
| `user`             | [User](/api-reference/users.md)                                                 | Belongs to      | `user_id`                                                                 |
| `departments`      | [Departments](/api-reference/departments.md)                                    | Belongs to many | Intermediate table                                                        |
| `infoboardChannel` | [InfoboardChannel](/api-reference/infoboard/infoboard-channels.md)              | Belongs to      | `infoboard_channel_id`                                                    |
| `seenUsers`        | [InfoboardPostSeenUsers](/api-reference/infoboard/infoboard-post-seen-users.md) | Has many        | `infoboard_post_seen_users.post_id`                                       |
| `readUsers`        | [InfoboardPostReadUsers](/api-reference/infoboard/infoboard-post-read-users.md) | Has many        | `infoboard_post_read_users.post_id`                                       |
| `comments`         | [InfoboardComments](/api-reference/infoboard/infoboard-comments.md)             | Has many        | `infoboard_comments.post_id`                                              |
| `notifications`    | [Notifications](/api-reference/notifications.md)                                | Has many        | `notifications.event_id`, `notifications.event_source`                    |
| `reactions`        | [Reactions](/api-reference/reactions.md)                                        | Morph many      | `reactions.reactable_type`, `reactions.reactable_id`                      |
| `currentReaction`  | [CurrentReaction](/api-reference/reactions.md)                                  | Morph one       | `reactions.reactable_type`, `reactions.reactable_id`, `reactions.user_id` |

### Computed properties

* `hash` - The hashed `id` of the `InfoboardPost`.

### Traits

* `TriggersNotifications`

## List

Get a list of all `InfoboardPosts` the current authenticated [User](/api-reference/users.md) is allowed to view.

**Definition**

<mark style="color:green;">`GET`</mark> `/api/infoboard/posts`

**Example Request**

{% tabs %}
{% tab title="PHP" %}

```php
$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('GET', '/api/infoboard/posts', [
    'headers' => ['Authorization' => "Bearer {accessToken}"]
]);
```

{% endtab %}
{% endtabs %}

**Example Response Body**

```json
[
  {
    "id": 1,
    "user_id": 3,
    "infoboard_channel_id": null,
    "title": "Non curabitur gravida arcu ac",
    "text": "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Sollicitudin nibh sit amet commodo nulla facilisi nullam vehicula. Libero enim sed faucibus turpis in eu.</p>",
    "reading_confirmation": false,
    "reactions_forbidden": false,
    "comments_allowed": true,
    "pinned": false,
    "planned_publish_at": null,
    "published_at": "2018-11-20 14:24:19",
    "created_at": "2018-11-20 14:24:19",
    "updated_at": "2018-12-20 15:37:53",
    "hash": "zn7m24owk63qolxryge8pj05"
  },
  {
    "id": 2,
    "user_id": 3,
    "infoboard_channel_id": null,
    "title": "Placerat duis ultricies lacus sed",
    "text": "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua</p>",
    "reading_confirmation": true,
    "reactions_forbidden": false,
    "comments_allowed": true,
    "pinned": false,
    "planned_publish_at": null,
    "published_at": "2018-11-20 14:24:19",
    "created_at": "2018-12-12 02:18:44",
    "updated_at": "2018-12-20 15:38:36",
    "hash": "6o8m0kz5yw10x1pr9e4vxj27"
  }
]
```

## Show

Show a single `InfoboardPost` by `id` or `hash`.

**Definition**

<mark style="color:green;">`GET`</mark> `/api/infoboard/posts/{idOrHash}`

**Example Request**

{% tabs %}
{% tab title="PHP" %}

```php
$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('GET', '/api/infoboard/posts/1', [
    'headers' => ['Authorization' => "Bearer {accessToken}"]
]);
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "id": 1,
  "user_id": 3,
  "infoboard_channel_id": null,
  "title": "Non curabitur gravida arcu ac",
  "text": "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Sollicitudin nibh sit amet commodo nulla facilisi nullam vehicula. Libero enim sed faucibus turpis in eu.</p>",
  "reading_confirmation": false,
  "reactions_forbidden": false,
  "comments_allowed": true,
  "pinned": false,
  "planned_publish_at": null,
  "published_at": "2018-11-20 14:24:19",
  "created_at": "2018-11-20 14:24:19",
  "updated_at": "2018-12-20 15:37:53",
  "hash": "zn7m24owk63qolxryge8pj05"
}
```

## Create

Create a new `InfoboardPost`.

**Definition**

<mark style="color:yellow;">`POST`</mark> `/api/infoboard/posts`

**Request Keys**

| Key                    | Type     | Default | Description                                                                                                                                                          |
| ---------------------- | -------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `infoboard_channel_id` | integer  | -       | The ID of the [InfoboardChannel](/api-reference/infoboard/infoboard-channels.md) the `InfoboardPost` is assigned to.                                                 |
| `title`\*              | string   | -       | The title of the `InfoboardPost`.                                                                                                                                    |
| `text`\*               | string   | -       | The content of the `InfoboardPost`.                                                                                                                                  |
| `reading_confirmation` | boolean  | `false` | Whether a reading confirmation is required.                                                                                                                          |
| `reactions_forbidden`  | boolean  | `false` | Whether [Reactions](/api-reference/reactions.md) for the `InfoboardPost` and it's [InfoboardComments](/api-reference/infoboard/infoboard-comments.md) are forbidden. |
| `comments_allowed`     | boolean  | `true`  | Whether comments are allowed.                                                                                                                                        |
| `department_ids`       | string   | -       | The [Departments](/api-reference/departments.md) that are allowed to see the `InfoboardPost` (separated by commas).                                                  |
| `planned_publish_at`   | datetime | -       | The date when the post should be published.                                                                                                                          |
| `published_at`         | datetime | -       | The date when the post was published.                                                                                                                                |
| `pinned`               | boolean  | `false` | Whether the post should be pinned on top of the infoboard.                                                                                                           |

Keys with `*` are required.

#### Advanced Key-Specifications

* `published_at` - Will be set automatically to whether the `planned_publish_at` date or the time of the request if none given. This information is used to determine if posts should be shown to users already. The date must be equal to or after the current time.

**Example Request**

{% tabs %}
{% tab title="PHP" %}

```php
$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('POST', '/api/infoboard/posts', [
    'headers' => ['Authorization' => "Bearer {accessToken}"],
    'json' => [
        'user_id' => 3,
        'title' => 'Sagittis purus sit amet volutpat',
        'text' => '<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>',
        'reading_confirmation' => false,
        'reactions_forbidden' => false,
        'comments_allowed' => true,
        'department_ids' => '1,2,3'
    ]
]);
```

{% endtab %}
{% endtabs %}

**Example Response Body**

```json
{
  "status": "success",
  "data": {
    "id": 3,
    "user_id": 3,
    "infoboard_channel_id": null,
    "title": "Sagittis purus sit amet volutpat",
    "text": "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>",
    "reading_confirmation": false,
    "reactions_forbidden": false,
    "comments_allowed": true,
    "pinned": false,
    "planned_publish_at": null,
    "published_at": "2018-12-20 15:48:54",
    "updated_at": "2018-12-20 15:48:54",
    "created_at": "2018-12-20 15:48:54",
    "hash": "d54q7g6wnj1eylm8k9e0xpz2"
  }
}
```

## Update

Update an existing `InfoboardPost` by `id`.

**Definition**

<mark style="color:blue;">`PUT`</mark> `/api/infoboard/posts/{id}`

**Request Keys**

| Key                    | Type     | Description                                                                                                                                                          |
| ---------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `infoboard_channel_id` | integer  | The ID of the [InfoboardChannel](/api-reference/infoboard/infoboard-channels.md) the `InfoboardPost` is assigned to.                                                 |
| `title`                | string   | The title of the `InfoboardPost`.                                                                                                                                    |
| `text`                 | string   | The content of the `InfoboardPost`.                                                                                                                                  |
| `reading_confirmation` | boolean  | Whether a reading confirmation is required .                                                                                                                         |
| `reactions_forbidden`  | boolean  | Whether [Reactions](/api-reference/reactions.md) for the `InfoboardPost` and it's [InfoboardComments](/api-reference/infoboard/infoboard-comments.md) are forbidden. |
| `comments_allowed`     | boolean  | Whether comments are allowed.                                                                                                                                        |
| `department_ids`       | string   | The [Departments](/api-reference/departments.md) that are allowed to see the `InfoboardPost` (separated by commas).                                                  |
| `planned_publish_at`   | datetime | The date when the post should be published.                                                                                                                          |
| `published_at`         | datetime | The date when the post was published.                                                                                                                                |
| `pinned`               | boolean  | Whether the post should be pinned on top of the infoboard.                                                                                                           |

#### Advanced Key-Specifications

* `planned_publish_at` - This information is only nullable or changeable if the date is after or equal to the current date and the original planned\_publish\_at value is in the future.
* `published_at` - Must be after or equal to the current date. Can be updated to "push" a post to the top. If `planned_publish_at` is set and valid on request, the value of `published_at` will be set accordingely.

**Example Request**

{% tabs %}
{% tab title="PHP" %}

```php
$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('PUT', '/api/infoboard/posts/3', [
    'headers' => ['Authorization' => "Bearer {accessToken}"],
    'json' => [
        'title' => 'Amet massa vitae tortor condimentum',
        'text' => '<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Morbi blandit cursus risus at ultrices mi tempus imperdiet nulla.</p>',
        'reading_confirmation' => true,
        'reactions_forbidden' => true,
    ]
]);
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "status": "success",
  "data": {
    "id": 3,
    "user_id": 3,
    "infoboard_channel_id": null,
    "title": "Amet massa vitae tortor condimentum",
    "text": "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Morbi blandit cursus risus at ultrices mi tempus imperdiet nulla.</p>",
    "reading_confirmation": true,
    "reactions_forbidden": true,
    "comments_allowed": true,
    "pinned": false,
    "planned_publish_at": null,
    "published_at": "2018-12-20 15:48:54",
    "created_at": "2018-12-20 15:48:54",
    "updated_at": "2018-12-20 16:03:18",
    "hash": "d54q7g6wnj1eylm8k9e0xpz2"
  }
}
```

## Delete

Delete an existing `InfoboardPost` by `id`.

**Definition**

<mark style="color:red;">`DELETE`</mark> `/api/infoboard/posts/{id}`

**Example Request**

{% tabs %}
{% tab title="PHP" %}

```php
$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('DELETE', '/api/infoboard/posts/3', [
    'headers' => ['Authorization' => "Bearer {accessToken}"]
]);
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "status": "success",
  "data": null
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.api.intratool.de/api-reference/infoboard/infoboard-posts.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
