# Available metadata operations

**ADD**

_Type_: ADD

_Description_: add a metadata value to the descriptor indicated in the _iecode_ field.

_Example_:

```
<operation>
    <type>ADD</type>
    <iecode><![CDATA[author]]></iecode>
    <value><![CDATA[Miguel de Cervantes]]></value>
</operation>
```

**DELETE**

_Type_: DELETE

_Description_: it deletes the value associated to a descriptor by its _iecode_. In case it is a multi-value descriptor, we will also have to specify the _idValueMetadata_.

_Example for a single value descriptor_:

```
<operation>
    <type>DELETE</type>
    <iecode><![CDATA[author]]></iecode>
</operation>
```

_Example for a multi-value descriptor_:

```
<operation>
    <type>DELETE</type>
    <iecode><![CDATA[author]]></iecode>
    <idValueMetadata>456</idValueMetadata>
</operation>
```

**UPDATE**

_Type_: UPDATE

_Description_: it updates the descriptor referenced by its _iecode_ (in case it is a multi-value descriptor, we must also add _idValueMetadata_) with the field _value_.

_Example for a single value descriptor_:

```
<operation>
    <type>UPDATE</type>
    <iecode><![CDATA[author]]></iecode>
    <value><![CDATA[M. Cervantes]]></value>
</operation>
```

_Example for a multi-value descriptor_:

```
<operation>
    <type>UPDATE</type>
    <iecode><![CDATA[author]]></iecode>
    <idValueMetadata>456</idValueMetadata>
    <value><![CDATA[M. Cervantes]]></value>
</operation>
```

**ADD IF IT DOES NOT EXIST**

_Type_: ADDIFNOTEXISTS

_Description_: it adds the indicated value to the descriptor in the field _value_, if and only if said descriptor has no value associated to it.

_Example_:

```
<operation>
    <type>ADDIFNOTEXISTS</type>
    <iecode><![CDATA[author]]></iecode>
    <value><![CDATA[Miguel de Cervantes]]></value>
</operation>
```

**DELETE IF IT EXISTS**

_Type_: DELETEIFEXISTS

_Description_: it deletes the value associated to a descriptor by its _iecode_, if and only if said descriptor has a value associated to it. In case of a multi-value descriptor, we will also have to specify the _idValueMetadata_.

_Example_:

```
<operation>
    <type>DELETEIFEXISTS</type>
    <iecode><![CDATA[author]]></iecode>
</operation>
```

_Example for the multi-value descriptor_:

```
<operation>
    <type>DELETEIFEXISTS</type>
    <iecode><![CDATA[author]]></iecode>
    <idValueMetadata>456</idValueMetadata>
</operation>
```

**UPDATE OR ADD**

_Type_: UPDATEORADD

_Description_: it updates the value of the field value on the descriptor indicated in the field _iecode_. In case the referenced descriptor has no value, the operation will become an ADD operation. If it is a multi-value descriptor, we will have to specify a value in the _idValueMetadata_ field, in order to update the descriptor value.

_Example_:

```
<operation>
    <type>UPDATEORADD</type>
    <iecode><![CDATA[author]]></iecode>
    <value><![CDATA[Miguel de Cervantes]]></value>
</operation>
```

_Example for a multi-value descriptor_:

```
<operation>
    <type>UPDATEORADD</type>
    <iecode><![CDATA[author]]></iecode>
    <idValueMetadata>456</idValueMetadata>
    <value><![CDATA[Miguel de Cervantes]]></value>
</operation>
```

**DELETE ALL**

_Type_: DELETEALL

_Description_: delete all the values associated to a descriptor by the _iecode_.

_Example_:

```
<operation>
    <type>DELETEALL</type>
    <iecode><![CDATA[author]]></iecode>
</operation>
```
