# /items

## Get list of items

<mark style="color:blue;">`GET`</mark> `http://pm415.com/api/items/:showarchived/:tablename/:orgid/:ownerid`

Gets the list of items for the org.

#### Path Parameters

| Name          | Type    | Description                    |
| ------------- | ------- | ------------------------------ |
| :ownerid      | number  | The ID of the backlog          |
| :orgid        | number  | The ID of the org              |
| :tablename    | string  | Owner table of item (backlogs) |
| :showarchived | boolean | True or false                  |

#### Headers

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

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

```
{
    "success": true,
    "items": [
        {
            "email": "hwyxlisjb@emlpro.com",
            "firstName": "alena",
            "lastName": "prilipko",
            "id": 50,
            "title": "hhhh",
            "statusId": 1,
            "archived": 0,
            "createdBy": 13,
            "ownerId": 19,
            "order_index": 0
        },
        {
            "email": "hwyxlisjb@emlpro.com",
            "firstName": "alena",
            "lastName": "prilipko",
            "id": 51,
            "title": "abc",
            "statusId": 1,
            "archived": 0,
            "createdBy": 13,
            "ownerId": 19,
            "order_index": 0
        },
        {
            "email": "hwyxlisjb@emlpro.com",
            "firstName": "alena",
            "lastName": "prilipko",
            "id": 52,
            "title": "abc",
            "statusId": 3,
            "archived": 0,
            "createdBy": 13,
            "ownerId": 19,
            "order_index": 2
        }
    ],
    "admin": true
}
```

{% endtab %}
{% endtabs %}

## Create new item

<mark style="color:green;">`POST`</mark> `http://pm415.com/api/items/new/:orgid`

Creates the item.

#### Path Parameters

| Name   | Type   | Description       |
| ------ | ------ | ----------------- |
| :orgid | number | The ID of the org |

#### Headers

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

#### Request Body

| Name | Type   | Description                                                                               |
| ---- | ------ | ----------------------------------------------------------------------------------------- |
|      | object | {"ownerTable": "backlogs", "ownerId": "19", "title": "abc", "description": "Description"} |

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

```
{
    "success": true,
    "item": {
        "ownerTable": "backlogs",
        "ownerId": "19",
        "title": "abc",
        "description": "Description",
        "organization_id": 17,
        "created_by": 13,
        "mailers": "!hwyxlisjb@emlpro.com!",
        "updated_at": "2019-04-26T12:31:28.581Z",
        "created_at": "2019-04-26T12:31:28.581Z",
        "id": 51
    }
}
```

{% endtab %}
{% endtabs %}

## Get current item

<mark style="color:blue;">`GET`</mark> `http://pm415.com/api/items/:orgid/:itemid`

Gets the information about the current item.

#### Path Parameters

| Name    | Type   | Description                              |
| ------- | ------ | ---------------------------------------- |
| :itemid | number | The ID of the item you want to work with |
| :orgid  | number | The ID of the org                        |

#### Headers

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

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

```
{
    "success": true,
    "item": {
        "createdAt": "2019-04-26T12:31:28.000Z",
        "archived": 0,
        "ownerId": 19,
        "points": 0,
        "assignee": {
            "firstName": "",
            "lastName": "",
            "email": "",
            "id": 0
        },
        "id": 51,
        "title": "abc",
        "description": "Description",
        "statusId": 1,
        "order_index": 0,
        "createdBy": 13,
        "forecastedRelease": null,
        "actualRelease": null,
        "plannedOn": null,
        "author": {
            "firstName": "alena",
            "lastName": "prilipko",
            "id": 13,
            "email": "hwyxlisjb@emlpro.com"
        }
    },
    "admin": true
}
```

{% endtab %}
{% endtabs %}

## Updates current item

<mark style="color:orange;">`PUT`</mark> `http://pm415.com/api/items/edit/:orgid/:itemid`

Updates the current item.

#### Path Parameters

| Name    | Type   | Description                           |
| ------- | ------ | ------------------------------------- |
| :itemid | number | The ID of the item you want to update |
| :orgid  | number | The ID of the org                     |

#### Headers

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

#### Request Body

| Name | Type   | Description                                                 |
| ---- | ------ | ----------------------------------------------------------- |
|      | object | {"statusId": "3", "order\_index": "2"} or any field of item |

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

```
{
    "success": true,
    "item": {
        "assignee": null,
        "organizationId": 17,
        "id": 52,
        "title": "abc",
        "description": "Description",
        "statusId": "3",
        "points": 0,
        "createdAt": "2019-04-26T13:11:13.000Z",
        "createdBy": 13,
        "updatedAt": "2019-04-26T13:11:13.000Z",
        "forecastedRelease": null,
        "actualRelease": null,
        "plannedOn": null,
        "ownerId": 19,
        "ownerTable": "backlogs",
        "mailers": "!hwyxlisjb@emlpro.com!",
        "orderIndex": 0,
        "archived": 0,
        "order_index": "2",
        "updated_at": "2019-04-26T13:34:25.182Z"
    }
}
```

{% endtab %}
{% endtabs %}

## Delete item

<mark style="color:red;">`DELETE`</mark> `http://pm415.com/api/items/:orgid/:itemid`

Deletes the current item.

#### Path Parameters

| Name    | Type   | Description                           |
| ------- | ------ | ------------------------------------- |
| :itemid | number | The ID of the item you want to delete |
| :orgid  | number | The ID of the of the org.             |

#### Headers

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

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

```
{
    "success": true,
    "backlog": 49,
    "message": "Item deleted"   
```

{% endtab %}
{% endtabs %}

## Get info on selected items

<mark style="color:green;">`POST`</mark> `http://pm415.com/api/items/:orgid`

Gets the information on the selected items.

#### Path Parameters

| Name   | Type   | Description       |
| ------ | ------ | ----------------- |
| :orgid | number | The ID of the org |

#### Headers

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

#### Request Body

| Name | Type   | Description                                   |
| ---- | ------ | --------------------------------------------- |
|      | object | {"itemsId": \["52","53"], "fullSelect": true} |

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

```
{
    "success": true,
    "items": [
        {
            "createdAt": "2019-04-26T13:11:13.000Z",
            "archived": 0,
            "ownerId": 19,
            "points": 0,
            "assignee": null,
            "id": 52,
            "title": "abc",
            "description": "Description",
            "statusId": 3,
            "orderIndex": 2,
            "createdBy": 13,
            "forecastedRelease": null,
            "actualRelease": null,
            "plannedOn": null
        },
        {
            "createdAt": "2019-04-27T06:28:47.000Z",
            "archived": 0,
            "ownerId": 19,
            "points": 0,
            "assignee": null,
            "id": 53,
            "title": "abc",
            "description": "Description",
            "statusId": 1,
            "orderIndex": 0,
            "createdBy": 13,
            "forecastedRelease": null,
            "actualRelease": null,
            "plannedOn": null
        }
    ]
}
```

{% endtab %}
{% endtabs %}
