InfoboardComments

Model & Relations

Namespace

Modules\Infoboard\Entities\InfoboardComment

Relations

Relation Key Type Relation Field(s)
User user Belongs to user_id
InfoboardPost post Belongs to post_id
Notifications notifications Has many notifications.event_id, notifications.event_source

Computed Properties

  • hash - The hashed id of the InfoboardComment

Traits

  • TriggersNotifications

List

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

Definition

GET /api/infoboard/posts/comments

Example Request

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

Example Response Body

[
  {
    "id": 1,
    "user_id": 3,
    "post_id": 1,
    "text": "<p>At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</p>",
    "created_at": "2018-12-21 11:44:50",
    "updated_at": "2018-12-21 11:54:40",
    "hash": "zn7m24owk63qolxryge8pj05"
  },
  {
    "id": 2,
    "user_id": 3,
    "post_id": 1,
    "text": "<p>Sollicitudin nibh sit amet commodo nulla facilisi nullam vehicula. Libero enim sed faucibus turpis in eu.</p>",
    "created_at": "2018-12-21 12:09:08",
    "updated_at": "2018-12-21 12:09:08",
    "hash": "6o8m0kz5yw10x1pr9e4vxj27"
  }
]

List by Post

Get a list of all InfoboardComments the current authenticated User is allowed to view by InfoboardPost.

Definition

GET /api/infoboard/posts/{postId}/comments

Example Request

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

Example Response Body

[
  {
    "id": 1,
    "user_id": 3,
    "post_id": 1,
    "text": "<p>At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</p>",
    "created_at": "2018-12-21 11:44:50",
    "updated_at": "2018-12-21 11:54:40",
    "hash": "zn7m24owk63qolxryge8pj05"
  },
  {
    "id": 2,
    "user_id": 3,
    "post_id": 1,
    "text": "<p>Sollicitudin nibh sit amet commodo nulla facilisi nullam vehicula. Libero enim sed faucibus turpis in eu.</p>",
    "created_at": "2018-12-21 12:09:08",
    "updated_at": "2018-12-21 12:09:08",
    "hash": "6o8m0kz5yw10x1pr9e4vxj27"
  }
]

Get

Get a single InfoboardComment by id or hash.

Definition

GET /api/infoboard/comments/{idOrHash}

Example Request

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

Example Response

{
  "id": 1,
  "user_id": 3,
  "post_id": 1,
  "text": "<p>At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</p>",
  "created_at": "2018-12-21 11:44:50",
  "updated_at": "2018-12-21 11:54:40",
  "hash": "zn7m24owk63qolxryge8pj05"
}

Create

Create a new InfoboardComment by InfoboardPost.

Definition

POST /api/infoboard/posts/{postId}/comments

Request Keys

Key Type Default Description
user_id * integer - The related User
post_id ** integer - The related InfoboardPost
text * string - The content of the InfoboardComment

Keys with * are required.
Keys with ** are normalized to the information given by the route.

Example Request

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

Example Response Body

{
  "status": "success",
  "data": {
    "id": 3,
    "user_id": 3,
    "post_id": 1,
    "text": "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>",
    "updated_at": "2018-12-21 11:44:50",
    "created_at": "2018-12-21 11:44:50",
    "hash": "d54q7g6wnj1eylm8k9e0xpz2"
  }
}

Update

Update an existing InfoboardComment by id.

Definition

PUT /api/infoboard/posts/comments/{id}

Request Keys

Key Type Default Description
user_id * integer - The related User
text * string - The content of the InfoboardComment

Example Request

$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('PUT', '/api/infoboard/posts/comments/3', [
     'headers' => ['Authorization' => "Bearer {accessToken}"],
     'json' => [
         'user_id' => 3,
         '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>'
     ]
 ]);

Example Response

{
  "status": "success",
  "data": {
    "id": 3,
    "user_id": 3,
    "post_id": 1,
    "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>",
    "created_at": "2018-12-21 11:44:50",
    "updated_at": "2018-12-21 12:04:10",
    "hash": "d54q7g6wnj1eylm8k9e0xpz2"
  }
}

Delete

Delete an existing InfoboardComment by id.

Definition

DELETE /api/infoboard/posts/comments/{id}

Example Request

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

Example Response

{
  "status": "success",
  "data": null
}
Last Updated: 05/13/2019