# Request to change parameters, add/remove bases

## Request to change parameters, add/remove bases

<mark style="color:green;">`POST`</mark> `http://lk.mysmpp.ru/xml/bases.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                                                                                                                                                                                         |
| bases.base<mark style="color:red;">\*</mark>     | String | Congratulations text                                                                                                                                                                                             |
| 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                                                                                                                                                                                      |
| delete\_bases.base.id\_base                      | String | Unique base number in the system to be deleted                                                                                                                                                                   |
| bases.base.on\_birth                             | String | <p>Whether congratulations are enabled:</p><p>- yes - enabled </p><p>- no - off</p>                                                                                                                              |
| bases.base.originator\_birth                     | String | Sender of congratulations                                                                                                                                                                                        |
| bases.base.local\_time\_birth                    | String | Read the greeting time in relation to the local time of the subscriber (**`yes`**) or in relation to the system time (**`no`**)                                                                                  |
| bases.base.time\_birth                           | Int    | Greeting time                                                                                                                                                                                                    |
| bases.base.name\_base                            | String | Base name                                                                                                                                                                                                        |
| bases.base.number\_base                          | Int    | Base number in the XML request. It is specified only when creating a new base. It is used to match the IDs of added bases (if there were not as many of them in the request).                                    |
| bases.base.id\_base                              | Int    | <p>Unique base number in the system. </p><p><mark style="color:orange;">If not specified, the base will be added. It is necessary to specify the parameter <strong><code>number\_base</code></strong></mark></p> |

{% 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”>edit</base>
     <base number_base=”1” id_base=”1235”>insert</ base>
     <base number_base=”2” id_base=”1236”>edit</ base>
     <base id_base=”1235”>delete</ base>
     <base id_base=”1235”>not_found</ 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="185.33333333333331">Parameter</th><th width="153">Data type</th><th>Description</th></tr></thead><tbody><tr><td>base.id_base</td><td>Int</td><td>Unique base number in the system. </td></tr><tr><td>base.number_base</td><td>Int</td><td>The number of the base in the XML request. It is specified only when creating a new base. It is used to match the IDs of added bases (if there were not many of them in the request)</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>
     <bases>
          <base id_base="1234" name_base="Head Office Base" time_birth="12:48" local_time_birth="yes" day_before="1" originator_birth="fitnes" on_birth="yes">Congratulations!"</base>
          <base number_base="1" name_base="BaseMoscowoffice" time_birth="12:48" local_time_birth="yes" day_before="1" originator_birth="fitnes" on_birth="yes">Congratulations!"</base>
     </bases>
     <delete_bases>
          <base id_base="1235" />
          <base id_base="1236" />
          ...
     </delete_bases>
</request>
```
