Skip to main content

Update room

PUT 

http://localhost/api/v2/rooms/:id

Update room info

Request

Responses

Room updated

Authorization: http

name: Tokentype: httpscheme: bearerdescription: For this method, user should acquire  token with a call to `POST /api/v2/auth/login` using [Basic Authentication](#section/Authentication/Basic-Authentication)  

In case of success response will contain token (see [reference](#tag/Authorization)  for response format)

Every subsequent query should contain next header:

```
Authorization:  Bearer abcdefg1234567
```

where `abcdefg1234567` is previously received token.

:::note

Access  token has expiration time, when it is expired, **Refresh Token** should be user  to acquire new one.

:::
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Put, "http://localhost/api/v2/rooms/:id");
request.Headers.Add("Accept", "application/json");
request.Headers.Add("Authorization", "Bearer <token>");
var content = new StringContent("{\n \"name\": \"Hallway\",\n \"order\": 1,\n \"section_id\": 1,\n \"background_image\": \"123321.jpg\",\n \"icon\": \"ch-door\",\n \"main_devices\": {\n \"temperature_sensor\": 132,\n \"humidity_sensor\": 22,\n \"luminosity_sensor\": 23,\n \"power_sensor\": 0\n }\n}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
Request Collapse all
Base URL
http://localhost/api/v2
Auth
Parameters
— pathrequired
Body
{
  "name": "Hallway",
  "order": 1,
  "section_id": 1,
  "background_image": "123321.jpg",
  "icon": "ch-door",
  "main_devices": {
    "temperature_sensor": 132,
    "humidity_sensor": 22,
    "luminosity_sensor": 23,
    "power_sensor": 0
  }
}
ResponseClear

Click the Send API Request button above and see the response here!