Sha256: e2ee1fc39f4330799eceb2b9b1c0390cb5f3e0e6a56d533277b4cdc54ab7b98e

Contents?: true

Size: 1.7 KB

Versions: 6

Compression:

Stored size: 1.7 KB

Contents

# #delete\_item

The `delete_item` mutation will allow you to delete an item.

### Basic usage

This method accepts one required argument - `item_id`.

{% code lineNumbers="true" %}
```ruby
client = Monday::Client.new(token: <AUTH_TOKEN>)

item_id = "0123"

response = client.delete_item(item_id)

puts response.body
```
{% endcode %}

This will return the deleted item's ID by default.

The response body from the above query would be as follows:

{% code lineNumbers="true" %}
```json
{
  "data": {
    "delete_item": {
      "id": "0123"
    }
  },
  "account_id": 123
}
```
{% endcode %}

### Customizing fields to retrieve

You can customize the fields to retrieve by passing in the `select` option and listing all the fields you need to retrieve as an array.

{% code lineNumbers="true" %}
```ruby
client = Monday::Client.new(token: <AUTH_TOKEN>)

item_id = "0123"

select = %w[id state creator_id]
response = client.delete_item(item_id, select: select)

puts response.body
```
{% endcode %}

### Retrieving nested fields

Some fields have nested attributes, and you need to specify the attributes to retrieve that field; else, the API will respond with an error. For example, the field `creator` is of type `User` and expects you to pass the attributes from `User` that you want to retrieve for `creator`.

{% code lineNumbers="true" %}
```ruby
client = Monday::Client.new(token: <AUTH_TOKEN>)

item_id = "0123"

select = [
  "id",
  "state",
  "creator_id",
  {
    creator: %w[id name email is_admin]
  }
]

response = client.delete_item(item_id, select: select)

puts response.body
```
{% endcode %}

You can find the list of all the available fields for items [here](https://developer.monday.com/api-reference/docs/items#fields).

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
monday_ruby-0.6.2 docs/resources/item/delete_item.md
monday_ruby-0.6.1 docs/resources/item/delete_item.md
monday_ruby-0.6.0 docs/resources/item/delete_item.md
monday_ruby-0.4.0 docs/resources/item/delete_item.md
monday_ruby-0.3.0 docs/resources/item/delete_item.md
monday_ruby-0.2.0 docs/resources/item/delete_item.md