Skip to content

InfoboardPosts

Model & Relations

Namespace

Modules\Infoboard\Entities\InfoboardPost

Relations

RelationKeyTypeRelation Field(s)
UseruserBelongs touser_id
DepartmentsdepartmentsBelongs to manyIntermediate table
InfoboardPostSeenUsersseenUsersHas manyinfoboard_post_seen_users.post_id
InfoboardPostReadUsersreadUsersHas manyinfoboard_post_read_users.post_id
InfoboardCommentscommentsHas manyinfoboard_comments.post_id
NotificationsnotificationsHas manynotifications.event_id, notifications.event_source

Computed Properties

  • hash - The hash representation of the comment

Traits

  • TriggersNotifications

List

Get a list of all InfoboardPosts the current authenticated User is allowed to view.

Definition

GET /api/infoboard/posts

Example Request

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

Example Response Body

json
[
  {
    "id": 1,
    "user_id": 3,
    "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,
    "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,
    "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,
    "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"
  }
]

Get

Get a single InfoboardPost by id or hash.

Definition

GET /api/infoboard/posts/{idOrHash}

Example Request

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

Example Response

json
{
  "id": 1,
  "user_id": 3,
  "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,
  "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

POST /api/infoboard/posts

Request Keys

KeyTypeDefaultDescription
user_id*integer-The related User
title*string-The title of the InfoboardPost
text*string-The content of the InfoboardPost
reading_confirmationbooleanfalseWhether a reading confirmation is required
comments_allowedbooleantrueWhether comments are allowed
department_ids*string-The Departments that are allowed to see the InfoboardPost (seperated by comma)
planned_publish_atdatetime-The date when the post should be published
published_atdatetime-The date when the post was published
pinnedbooleanfalseWether the post should be pinned on top of the infoboard

Keys with * are required.

Advanced Key-Specifications

  • published_at - Will be set automatically to wether 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

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,
        'comments_allowed' => true,
        'department_ids' => '1,2,3'
    ]
]);

Example Response Body

json
{
  "status": "success",
  "data": {
    "id": 3,
    "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,
    "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

PUT /api/infoboard/posts/{id}

Request Keys

KeyTypeDescription
user_idintegerThe related User
titlestringThe title of the InfoboardPost
textstringThe content of the InfoboardPost
reading_confirmationbooleanWhether a reading confirmation is required
comments_allowedbooleanWhether comments are allowed
department_idsstringThe Departments that are allowed to see the InfoboardPost (seperated by comma)
planned_publish_atdatetimeThe date when the post should be published
published_atdatetimeThe date when the post was published
pinnedbooleanWether 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

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,
    ]
]);

Example Response

json
{
  "status": "success",
  "data": {
    "id": 3,
    "user_id": 3,
    "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,
    "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

DELETE /api/infoboard/posts/{id}

Example Request

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

Example Response

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