# Request to add/edit/delete subscribers of the base

## Request to add/edit/delete subscribers of the base

<mark style="color:green;">`POST`</mark> `http://lk.mysmpp.ru/xml/phones.php`

#### Headers

| Name                                           | Type   | Description                    |
| ---------------------------------------------- | ------ | ------------------------------ |
| Content-type<mark style="color:red;">\*</mark> | String | **`text/xml; charset=utf-8;`** |

#### Request Body

| Name                                               | Type   | Description                                                                                            |
| -------------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------ |
| login.value<mark style="color:red;">\*</mark>      | String | Your login in the system                                                                               |
| base.id\_base<mark style="color:red;">\*</mark>    | Int    | Base number in the system                                                                              |
| token.value<mark style="color:red;">\*</mark>      | String | You can use a secret key instead of login and password. To obtain it, please contact your manager      |
| password.value<mark style="color:red;">\*</mark>   | String | Your password in the system                                                                            |
| base.phone.surname                                 | String | Subscriber's last name                                                                                 |
| base.phone.name                                    | String | Subscriber Name                                                                                        |
| base.phone.operator                                | String | Operator. If not set, it is automatically determined.                                                  |
| base.phone.region                                  | String | Region. If not set, it is determined automatically                                                     |
| base.phone.phone<mark style="color:red;">\*</mark> | Int    | The phone number of the subscriber. If a subscriber with this number already exists, it will be edited |
| base.phone.addition\_1                             | String | Second additional field                                                                                |
| base.phone.addition\_1                             | String | First additional field                                                                                 |
| base.phone.male                                    | String | <p>Gender:</p><p>"f"-female</p><p>"m" - male </p>                                                      |
| base.phone.date\_birth                             | Int    | Date of birth                                                                                          |
| base.phone.patronymic                              | String | Subscriber's patronymic                                                                                |
| base.phone.action                                  | String | In case it is necessary to delete "delete"                                                             |
| base.phone.number\_phone                           | Int    | Phone number in the system                                                                             |

{% tabs %}
{% tab title="200: OK If a valid XML document is received" %}

```xml
<?xml version="1.0" encoding="utf-8" ?>
<response>
     <base id_base="1234">
          <phone phone="79612242243" number_phone="1"/>insert</phone>
          <phone phone="79612242244" number_phone="2" />edit</phone>
          <phone phone="79612242243" number_phone="5"/>delete</phone>
          <phone phone="79612242244" number_phone="6" />not_found</phone>
     </base>
…
</response>
```

{% endtab %}

{% tab title="400: Bad Request If an error occurs in the sent XML document" %}

```xml
<?xml version="1.0" encoding="utf-8"?>
<response>
     <error>Error message</error>
</response>
```

{% endtab %}
{% endtabs %}

### Deciphering parameters in query responses

<table><thead><tr><th width="167.33333333333331">Parameter</th><th width="155">Data type</th><th>Description</th></tr></thead><tbody><tr><td>base.id_base</td><td>Int</td><td>Base number in the system</td></tr><tr><td>base.phone.phone</td><td>Int</td><td>Subscriber's phone number</td></tr><tr><td>base.phone.number_phone</td><td>Int</td><td>Phone number in the system</td></tr><tr><td>error</td><td>String</td><td><p>The error text can take the following values:</p><ul><li>Incorrect XML document format </li><li>Incorrect login or password </li><li>POST data is missing</li></ul></td></tr></tbody></table>

### Example XML request

```xml
<?xml version="1.0" encoding="utf-8" ?>
<request>
     <security>
          <login value="login" />
          <password value="password" />
     </security>
     <base id_base="1234">
          <phone phone="79612242243" region="Novosibirsk " operator="Vimpelcom" name="Konstantin" surname="Ermolaev" patronymic="Aleksandrovich" date_birth="1984-08-21" male="male" addition_1="Firstadditionalfield" addition_2="second" number_phone="1"/>
          <phone phone="79612242244" region="Novosibirsk " operator="Vimpelcom" name="Konstantin" surname="Ermolaev" patronymic="Aleksandrovich" date_birth="1984-08-21" male="male" male="male" addition_1="First additional field" addition_2="second" number_phone="2" />
          ...
          <phone phone="79612242243" action="delete" number_phone="5"/>
          <phone phone="7961224242244" action="delete" number_phone="6"/>
     </base>
</request>
```
