# Managing Channels

리모트몬스터는 채널 관리를 위한 서버용 API를 제공합니다. 이 API는 채널 검색, 채널 강제 종료 기능을 제공합니다. \
서버용 API는 앱용(클라이언트용) API와 달리 비디오/오디오를 전송할 수 없습니다.&#x20;

## ※ 주의 사항

{% hint style="info" %}
타인의 Service ID, Secret Key를 무단으로 이용하면 처벌을 받을 수 있습니다. \
(정보통신망 이용 촉진 및 정보보호에 관한 법률, 통신비밀보호법, 형법 등에 의거)
{% endhint %}

{% hint style="info" %}
타인의 Service ID, Secret Key를 무단으로 이용하면 업무 방해에 대한 피해를 보상해야합니다.\
(민법 등에 의거)
{% endhint %}

## Service ID, Secret Key 확인

[리모트몬스터 웹 콘솔](https://console.remotemonster.com/)의 Project Information 메뉴에서 Service ID, Secret Key를 확인할 수 있습니다.\
Secret Key는 \*\*\*\*\*\*\*\*\*\*\*\*\*\* 이 아닙니다. 우측 눈 아이콘을 누르면 표시됩니다.

![웹 콘솔의 프로젝트 기본정보 화면](/files/-LyTCM08fj9j729siE2z)

## 채널 검색

## <https://consoleapi.remotemonster.com/v1/search>

<mark style="color:green;">`POST`</mark> `https://signal.remotemonster.com/lambda/broadcast-channel-list`&#x20;

기간과 채널 이름 조건에 따라 채널을 검색합니다.\
\
새로 생성된 채널이 검색되려면 다소 시간이 걸릴 수 있습니다. 새로 생성된 채널을 확인하려면 앱으로부터 채널 정보를 받는 것이 좋습니다. 앱은 SDK의 onCreate, onComplete 콜백 함수를 이용하여 채널 ID를 확인할 수 있습니다.

#### Headers

| Name         | Type   | Description      |
| ------------ | ------ | ---------------- |
| Content-type | string | application/json |

#### Request Body

| Name      | Type    | Description            |
| --------- | ------- | ---------------------- |
| serviceId | string  | Service ID             |
| secret    | string  | Secret Key             |
| keyword   | string  | 채널 ID가 포함할 문자열         |
| starttime | integer | 조회할 기간, Unix time, 초단위 |
| endtime   | integer | 조회할 기간, Unix time, 초단위 |

{% tabs %}
{% tab title="200 peerCount 는 누적 세션수입니다. " %}

```
{
  "startTime": 1577862148,
  "currentTime": 1580454148,
  "totalCount": 1,
  "items": [
    {
      "chid": "20200110",
      "createTime": 1580281515,
      "endTime": 1580281577,
      "peerCount": 2
    }
  ]
}
```

{% endtab %}
{% endtabs %}

### 예시

{% tabs %}
{% tab title="curl" %}

```bash
curl -X POST https://consoleapi.remotemonster.com/v1/search \
-H 'Content-type: application/json' \
-d '
{
  "serviceId": "my-service-id",
  "secret":"my-secret",
  "keyword" : "",
  "starttime": 1581315000,
  "endtime": 1581315900
}
'
```

{% endtab %}
{% endtabs %}

## 방송 중인 채널 조회

## <https://signal.remotemonster.com/lambda/broadcast-channel-list>

<mark style="color:green;">`POST`</mark> `https://signal.remotemonster.com/lambda/broadcast-channel-list`&#x20;

방송 중인 채널을 조회합니다. 종료된 방송 채널은 조회되지 않습니다.

#### Headers

| Name         | Type   | Description      |
| ------------ | ------ | ---------------- |
| Content-type | string | application/json |

#### Request Body

| Name      | Type   | Description |
| --------- | ------ | ----------- |
| serviceId | string | Service ID  |
| secret    | string | Secret Key  |

{% tabs %}
{% tab title="200 id 는 채널 ID 입니다.
numOfWatchers 는 조회 시각의 시청세션수입니다, 누적 시청세션수가 아닙니다." %}

```
[
  {
    "id": "1581324488053_Dc5aQ",
    "serviceId": "my-service-id",
    "createTime": "2020-02-10T08:48:09.828Z",
    "numOfWatchers": 0
  },
  {
    "id": "1581324445005_s1c9g",
    "serviceId": "my-service-id",
    "createTime": "2020-02-10T08:47:27.011Z",
    "numOfWatchers": 0
  }
]

```

{% endtab %}
{% endtabs %}

### 예시

{% tabs %}
{% tab title="curl" %}

```bash
curl -X POST 'https://signal.remotemonster.com/lambda/broadcast-channel-list' \
-H 'Content-type: application/json' \
-d '{"serviceId":"my-service-id","secret":"my-secret-key"}'
```

{% endtab %}
{% endtabs %}

## 채널 강제 종료

## <https://signal.remotemonster.com/lambda/channel-force-termination>

<mark style="color:green;">`POST`</mark> `https://signal.remotemonster.com/lambda/channel-force-termination`&#x20;

채널을 강제로 종료합니다.&#x20;

#### Headers

| Name         | Type   | Description      |
| ------------ | ------ | ---------------- |
| Content-type | string | application/json |

#### Request Body

| Name      | Type   | Description |
| --------- | ------ | ----------- |
| serviceId | string | Service ID  |
| secret    | string | Secret Key  |
| channelId | string | 종료할 채널 ID   |

{% tabs %}
{% tab title="200 " %}

```
{
  "send": true
}
```

{% endtab %}
{% endtabs %}

### 예시

{% tabs %}
{% tab title="curl" %}

```bash
curl -X POST https://signal.remotemonster.com/lambda/channel-force-termination \
-H 'Content-type: application/json' \
-d '{"serviceId":"my-service-id", "secret":"my-secret-key", "channelId":"the-channel-id"}'
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.remotemonster.com/api/managing-channels.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
