# /comments

## Create a comment

<mark style="color:green;">`POST`</mark> `https://pm415.com/api/comments/new/:ownertable/:orgid/:owmerid`

Creates the new comment.&#x20;

#### Path Parameters

| Name        | Type   | Description                             |
| ----------- | ------ | --------------------------------------- |
| :ownertable | string | "Bugs" or "Initiatives" or "Items"      |
| :ownerid    | number | The ID of the bug or initiative or item |
| :orgid      | number | The ID of the org                       |

#### Headers

| Name           | Type   | Description                                 |
| -------------- | ------ | ------------------------------------------- |
| Authentication | string | Authorization: Bearer 50ca9ba0f7b1444fa55d5 |

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

```
{
    "success": true,
    "comment": {
        "comment": "comment2-2",
        "organization_id": 17,
        "created_by": 13,
        "ownerId": 49,
        "ownerTable": "items",
        "mailers": "",
        "updated_at": "2019-04-26T08:34:57.752Z",
        "created_at": "2019-04-26T08:34:57.752Z",
        "id": 54
    }
}
```

{% endtab %}
{% endtabs %}

## Get list of comments

<mark style="color:blue;">`GET`</mark> `https://pm415.com/api/comments/get/:ownertable/:orgid/:ownerid`

Gets the list of comments.

#### Path Parameters

| Name        | Type   | Description                             |
| ----------- | ------ | --------------------------------------- |
| :ownerid    | number | The ID of the bug or initiative or item |
| :orgid      | number | The ID of the org                       |
| :ownertable | string | "Bugs" or "Initiatives" or "Items"      |

#### Headers

| Name           | Type   | Description                                 |
| -------------- | ------ | ------------------------------------------- |
| Authentication | string | Authorization: Bearer 50ca9ba0f7b1444fa55d5 |

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

```
{
    "success": true,
    "comments": [
        {
            "id": 48,
            "ownerId": 49,
            "ownerTable": "items",
            "mailers": "",
            "comment": "comment1",
            "createdAt": "2019-04-26T07:13:39.000Z",
            "createdBy": 13,
            "updatedAt": "2019-04-26T08:31:59.000Z",
            "organizationId": 17
        },
        {
            "id": 51,
            "ownerId": 49,
            "ownerTable": "items",
            "mailers": "",
            "comment": "comment2-1",
            "createdAt": "2019-04-26T07:48:19.000Z",
            "createdBy": 13,
            "updatedAt": "2019-04-26T08:32:27.000Z",
            "organizationId": 17
        }
    ]
}
```

{% endtab %}
{% endtabs %}

## Update current comment

<mark style="color:orange;">`PUT`</mark> `https://pm415.com/api/comments/edit/:commentid`

Updates the current comment.

#### Path Parameters

| Name       | Type   | Description                              |
| ---------- | ------ | ---------------------------------------- |
| :commentid | number | The ID of the comment you want to update |

#### Headers

| Name           | Type   | Description                                 |
| -------------- | ------ | ------------------------------------------- |
| Authentication | string | Authorization: Bearer 50ca9ba0f7b1444fa55d5 |

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

```
{
    "success": true,
    "comment": {
        "id": 52,
        "ownerId": 49,
        "ownerTable": "items",
        "mailers": "",
        "comment": "commentUpdated",
        "createdAt": "2019-04-26T08:33:39.000Z",
        "createdBy": 13,
        "updatedAt": "2019-04-26T08:33:39.000Z",
        "organizationId": 17,
        "updated_at": "2019-04-26T08:37:59.009Z"
    }
}
```

{% endtab %}
{% endtabs %}

## Delete a comment

<mark style="color:red;">`DELETE`</mark> `https://pm415.com/api/comments/delete/:orgid/:commentid`

Delets the chosen comment.

#### Path Parameters

| Name       | Type   | Description                              |
| ---------- | ------ | ---------------------------------------- |
| :commentid | number | The ID of the comment you want to delete |
| :orgid     | number | The ID of the org                        |

#### Headers

| Name           | Type   | Description                                 |
| -------------- | ------ | ------------------------------------------- |
| Authentication | string | Authorization: Bearer 50ca9ba0f7b1444fa55d5 |

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

```
{
    "success": true,
    "comment": 49,
    "message": "Comment deleted"
}
```

{% endtab %}
{% endtabs %}
