# POST request

## POST request to get message status

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

#### Headers

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

#### Request Body

| Name                                       | Type   | Description                                                                                        |
| ------------------------------------------ | ------ | -------------------------------------------------------------------------------------------------- |
| login<mark style="color:red;">\*</mark>    | String | Your login in the system                                                                           |
| password<mark style="color:red;">\*</mark> | String | Your password in the system                                                                        |
| token<mark style="color:red;">\*</mark>    | String | You can use a secret key instead of login and password. To obtain it, please contact your manager. |
| id\_sms<mark style="color:red;">\*</mark>  | Int    | SMS message number received in the response JSON-document in the process of sending SMS message    |
| detail<mark style="color:red;">\*</mark>   | Int    | 0 or 1 in case it is necessary to receive the number of parts and the price for one part by SMS    |

{% tabs %}
{% tab title="200: OK In case the correct JSON document is received" %}

```json
[
    {
        "id_sms": 82216,
        "time_change_state": "2021-04-26 15:15:03",
        "state": "deliver",
        "num_parts": 1,
        "price": 10.6000000
    }
]
```

{% endtab %}

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

```json
{
   "error": "Error message"
}
```

{% endtab %}
{% endtabs %}

### Deciphering parameters in query responses

<table><thead><tr><th width="178.33333333333331">Parameter</th><th width="133">Data type</th><th>Description</th></tr></thead><tbody><tr><td>id_sms</td><td>Int</td><td>SMS message number received in the response JSON-document in the process of sending SMS message</td></tr><tr><td>time_change_state</td><td>String</td><td>Time of message status change</td></tr><tr><td>state</td><td>String</td><td><p>Last message status: </p><ul><li>"send" - message status not received. In this case, an empty time (time="") is transmitted </li><li>"not_deliver" - the message was not delivered. Final status (does not change with time) </li><li>"expired" - the subscriber was not in the network at the moments when the delivery attempt was made. Final status (does not change with time) </li><li>"deliver" - the message has been delivered. </li><li>"read" - the message has been read. Final status (does not change over time) </li><li>"partly_deliver" - the message was sent, but the status was not received.</li></ul></td></tr><tr><td>num_parts</td><td>Int</td><td>Number of SMS parts</td></tr><tr><td>price</td><td>Int</td><td>Price per SMS part</td></tr><tr><td>error</td><td>String</td><td><p>The error text can take the following values:</p><ul><li>Incorrect JSON document format </li><li>Your account is locked </li><li>Incorrect login or password </li><li>POST data is missing</li></ul></td></tr></tbody></table>

### Example of SMS status request

```json
[
    {
        "login": "login",
        "password": "password",
        "token":"token",
        "id_sms": "SMS ID in the system to check the status",
        "detail" : 1
    }
]
```
