# Channel metadata service

Endpoints for retrieving and updating channel metadata.

OpenAPI file: [`ChannelMetadataService.json`](https://dev.nominal.io/api/_downloads/8f6f8bb27285c63659feff16fc6e8295/ChannelMetadataService.json)

## Endpoints

### Get channel metadata

POST `/timeseries/channel-metadata/v1/channel-metadata/get`

Get the metadata for a channel.

Body

`channelIdentifier` [`ChannelIdentifier`](https://dev.nominal.io/api/rest/channel-metadata-service.md#channelidentifier) required
:   ​

    Fields of `ChannelIdentifier`

    `channelName` string required
    :   ​

    `dataSourceRid` string (RID) required
    :   ​

Response

`channelIdentifier` [`ChannelIdentifier`](https://dev.nominal.io/api/rest/channel-metadata-service.md#channelidentifier)
:   ​

    Fields of `ChannelIdentifier`

    `channelName` string
    :   ​

    `dataSourceRid` string (RID)
    :   ​

`description` string
:   ​

`unit` string
:   ​

`dataType` [`SeriesDataType`](https://dev.nominal.io/api/rest/channel-metadata-service.md#seriesdatatype)
:   ​

    Values of `SeriesDataType`

    `DOUBLE`
    :   ​

    `STRING`
    :   ​

    `LOG`
    :   ​

    `INT`
    :   ​

    `UINT`
    :   ​

    `DOUBLE_ARRAY`
    :   ​

    `STRING_ARRAY`
    :   ​

    `STRUCT`
    :   ​

    `VIDEO`
    :   ​

    `SPATIAL`
    :   ​

`channelKind` [`ChannelKind`](https://dev.nominal.io/api/rest/channel-metadata-service.md#channelkind)
:   Classifies how the channel is used. Omitted values should be treated as STANDARD.

    Values of `ChannelKind`

    `STANDARD`
    :   ​

    `COMMAND`
    :   ​

Request

**curl**

```shell
curl -X POST "https://api.gov.nominal.io/api/timeseries/channel-metadata/v1/channel-metadata/get" \
  -H "Authorization: Bearer <api key>" \
  -H "Content-Type: application/json" \
  --data '{
  "channelIdentifier": {
    "channelName": "<channel>",
    "dataSourceRid": "<data source rid>"
  }
}'
```

**requests**

```python
import requests

response = requests.post(
    "https://api.gov.nominal.io/api/timeseries/channel-metadata/v1/channel-metadata/get",
    headers={"Authorization": "Bearer <api key>"},
    json={
        "channelIdentifier": {
            "channelName": "<channel>",
            "dataSourceRid": "<data source rid>",
        },
    },
)
response.raise_for_status()
print(response.json())
```

**httpx**

```python
import httpx

response = httpx.post(
    "https://api.gov.nominal.io/api/timeseries/channel-metadata/v1/channel-metadata/get",
    headers={"Authorization": "Bearer <api key>"},
    json={
        "channelIdentifier": {
            "channelName": "<channel>",
            "dataSourceRid": "<data source rid>",
        },
    },
)
response.raise_for_status()
print(response.json())
```

**aiohttp**

```python
import asyncio

import aiohttp

async def main() -> None:
    async with aiohttp.ClientSession() as session:
        async with session.post(
            "https://api.gov.nominal.io/api/timeseries/channel-metadata/v1/channel-metadata/get",
            headers={"Authorization": "Bearer <api key>"},
            json={
                "channelIdentifier": {
                    "channelName": "<channel>",
                    "dataSourceRid": "<data source rid>",
                },
            },
        ) as response:
            response.raise_for_status()
            print(await response.json())

asyncio.run(main())
```

Response: `200`

```json
{
  "channelIdentifier": {
    "channelName": "<channel>",
    "dataSourceRid": "<data source rid>"
  },
  "description": "<description>",
  "unit": "<unit>",
  "dataType": "DOUBLE",
  "channelKind": "STANDARD"
}
```

### Batch get channel metadata

POST `/timeseries/channel-metadata/v1/channel-metadata/batch-get`

Batch get the metadata for multiple channels. If some channels cannot be found or authorized, they will be omitted from the response.

Body

`requests` array of [`GetChannelMetadataRequest`](https://dev.nominal.io/api/rest/channel-metadata-service.md#getchannelmetadatarequest)
:   ​

    Fields of `GetChannelMetadataRequest`

    `channelIdentifier` [`ChannelIdentifier`](https://dev.nominal.io/api/rest/channel-metadata-service.md#channelidentifier) required
    :   ​

        Fields of `ChannelIdentifier`

        `channelName` string required
        :   ​

        `dataSourceRid` string (RID) required
        :   ​

Response

`responses` array of [`ChannelMetadata`](https://dev.nominal.io/api/rest/channel-metadata-service.md#channelmetadata)
:   ​

    Fields of `ChannelMetadata`

    `channelIdentifier` [`ChannelIdentifier`](https://dev.nominal.io/api/rest/channel-metadata-service.md#channelidentifier)
    :   ​

        Fields of `ChannelIdentifier`

        `channelName` string
        :   ​

        `dataSourceRid` string (RID)
        :   ​

    `description` string
    :   ​

    `unit` string
    :   ​

    `dataType` [`SeriesDataType`](https://dev.nominal.io/api/rest/channel-metadata-service.md#seriesdatatype)
    :   ​

        Values of `SeriesDataType`

        `DOUBLE`
        :   ​

        `STRING`
        :   ​

        `LOG`
        :   ​

        `INT`
        :   ​

        `UINT`
        :   ​

        `DOUBLE_ARRAY`
        :   ​

        `STRING_ARRAY`
        :   ​

        `STRUCT`
        :   ​

        `VIDEO`
        :   ​

        `SPATIAL`
        :   ​

    `channelKind` [`ChannelKind`](https://dev.nominal.io/api/rest/channel-metadata-service.md#channelkind)
    :   Classifies how the channel is used. Omitted values should be treated as STANDARD.

        Values of `ChannelKind`

        `STANDARD`
        :   ​

        `COMMAND`
        :   ​

Request

**curl**

```shell
curl -X POST "https://api.gov.nominal.io/api/timeseries/channel-metadata/v1/channel-metadata/batch-get" \
  -H "Authorization: Bearer <api key>" \
  -H "Content-Type: application/json" \
  --data '{
  "requests": [
    {
      "channelIdentifier": {
        "channelName": "<channel>",
        "dataSourceRid": "<data source rid>"
      }
    }
  ]
}'
```

**requests**

```python
import requests

response = requests.post(
    "https://api.gov.nominal.io/api/timeseries/channel-metadata/v1/channel-metadata/batch-get",
    headers={"Authorization": "Bearer <api key>"},
    json={
        "requests": [
            {
                "channelIdentifier": {
                    "channelName": "<channel>",
                    "dataSourceRid": "<data source rid>",
                },
            },
        ],
    },
)
response.raise_for_status()
print(response.json())
```

**httpx**

```python
import httpx

response = httpx.post(
    "https://api.gov.nominal.io/api/timeseries/channel-metadata/v1/channel-metadata/batch-get",
    headers={"Authorization": "Bearer <api key>"},
    json={
        "requests": [
            {
                "channelIdentifier": {
                    "channelName": "<channel>",
                    "dataSourceRid": "<data source rid>",
                },
            },
        ],
    },
)
response.raise_for_status()
print(response.json())
```

**aiohttp**

```python
import asyncio

import aiohttp

async def main() -> None:
    async with aiohttp.ClientSession() as session:
        async with session.post(
            "https://api.gov.nominal.io/api/timeseries/channel-metadata/v1/channel-metadata/batch-get",
            headers={"Authorization": "Bearer <api key>"},
            json={
                "requests": [
                    {
                        "channelIdentifier": {
                            "channelName": "<channel>",
                            "dataSourceRid": "<data source rid>",
                        },
                    },
                ],
            },
        ) as response:
            response.raise_for_status()
            print(await response.json())

asyncio.run(main())
```

Response: `200`

```json
{
  "responses": [
    {
      "channelIdentifier": {
        "channelName": "<channel>",
        "dataSourceRid": "<data source rid>"
      },
      "description": "<description>",
      "unit": "<unit>",
      "dataType": "DOUBLE",
      "channelKind": "STANDARD"
    }
  ]
}
```

### Update channel metadata

POST `/timeseries/channel-metadata/v1/channel-metadata/update`

Update the metadata for a channel.

Body

`channelIdentifier` [`ChannelIdentifier`](https://dev.nominal.io/api/rest/channel-metadata-service.md#channelidentifier) required
:   ​

    Fields of `ChannelIdentifier`

    `channelName` string required
    :   ​

    `dataSourceRid` string (RID) required
    :   ​

`description` string
:   ​

`unitUpdate` [`UnitUpdate`](https://dev.nominal.io/api/rest/channel-metadata-service.md#unitupdate)
:   ​

    **unit**

    Set `type` to `"unit"`.

    `unit` string
    :   ​

    **clearUnit**

    Set `type` to `"clearUnit"`.

    `clearUnit` [`Empty`](https://dev.nominal.io/api/rest/channel-metadata-service.md#empty)
    :   ​

Response

`channelIdentifier` [`ChannelIdentifier`](https://dev.nominal.io/api/rest/channel-metadata-service.md#channelidentifier)
:   ​

    Fields of `ChannelIdentifier`

    `channelName` string
    :   ​

    `dataSourceRid` string (RID)
    :   ​

`description` string
:   ​

`unit` string
:   ​

`dataType` [`SeriesDataType`](https://dev.nominal.io/api/rest/channel-metadata-service.md#seriesdatatype)
:   ​

    Values of `SeriesDataType`

    `DOUBLE`
    :   ​

    `STRING`
    :   ​

    `LOG`
    :   ​

    `INT`
    :   ​

    `UINT`
    :   ​

    `DOUBLE_ARRAY`
    :   ​

    `STRING_ARRAY`
    :   ​

    `STRUCT`
    :   ​

    `VIDEO`
    :   ​

    `SPATIAL`
    :   ​

`channelKind` [`ChannelKind`](https://dev.nominal.io/api/rest/channel-metadata-service.md#channelkind)
:   Classifies how the channel is used. Omitted values should be treated as STANDARD.

    Values of `ChannelKind`

    `STANDARD`
    :   ​

    `COMMAND`
    :   ​

Request

**curl**

```shell
curl -X POST "https://api.gov.nominal.io/api/timeseries/channel-metadata/v1/channel-metadata/update" \
  -H "Authorization: Bearer <api key>" \
  -H "Content-Type: application/json" \
  --data '{
  "channelIdentifier": {
    "channelName": "<channel>",
    "dataSourceRid": "<data source rid>"
  }
}'
```

**requests**

```python
import requests

response = requests.post(
    "https://api.gov.nominal.io/api/timeseries/channel-metadata/v1/channel-metadata/update",
    headers={"Authorization": "Bearer <api key>"},
    json={
        "channelIdentifier": {
            "channelName": "<channel>",
            "dataSourceRid": "<data source rid>",
        },
    },
)
response.raise_for_status()
print(response.json())
```

**httpx**

```python
import httpx

response = httpx.post(
    "https://api.gov.nominal.io/api/timeseries/channel-metadata/v1/channel-metadata/update",
    headers={"Authorization": "Bearer <api key>"},
    json={
        "channelIdentifier": {
            "channelName": "<channel>",
            "dataSourceRid": "<data source rid>",
        },
    },
)
response.raise_for_status()
print(response.json())
```

**aiohttp**

```python
import asyncio

import aiohttp

async def main() -> None:
    async with aiohttp.ClientSession() as session:
        async with session.post(
            "https://api.gov.nominal.io/api/timeseries/channel-metadata/v1/channel-metadata/update",
            headers={"Authorization": "Bearer <api key>"},
            json={
                "channelIdentifier": {
                    "channelName": "<channel>",
                    "dataSourceRid": "<data source rid>",
                },
            },
        ) as response:
            response.raise_for_status()
            print(await response.json())

asyncio.run(main())
```

Response: `200`

```json
{
  "channelIdentifier": {
    "channelName": "<channel>",
    "dataSourceRid": "<data source rid>"
  },
  "description": "<description>",
  "unit": "<unit>",
  "dataType": "DOUBLE",
  "channelKind": "STANDARD"
}
```

### Batch update channel metadata

POST `/timeseries/channel-metadata/v1/channel-metadata/batch-update`

Batch update the metadata for multiple channels. If some channels cannot be found or authorized, no metadata will be updated for any of the channels in the request.

Body

`requests` array of [`UpdateChannelMetadataRequest`](https://dev.nominal.io/api/rest/channel-metadata-service.md#updatechannelmetadatarequest)
:   ​

    Fields of `UpdateChannelMetadataRequest`

    `channelIdentifier` [`ChannelIdentifier`](https://dev.nominal.io/api/rest/channel-metadata-service.md#channelidentifier) required
    :   ​

        Fields of `ChannelIdentifier`

        `channelName` string required
        :   ​

        `dataSourceRid` string (RID) required
        :   ​

    `description` string
    :   ​

    `unitUpdate` [`UnitUpdate`](https://dev.nominal.io/api/rest/channel-metadata-service.md#unitupdate)
    :   ​

        **unit**

        Set `type` to `"unit"`.

        `unit` string
        :   ​

        **clearUnit**

        Set `type` to `"clearUnit"`.

        `clearUnit` [`Empty`](https://dev.nominal.io/api/rest/channel-metadata-service.md#empty)
        :   ​

Response

`responses` array of [`ChannelMetadata`](https://dev.nominal.io/api/rest/channel-metadata-service.md#channelmetadata)
:   ​

    Fields of `ChannelMetadata`

    `channelIdentifier` [`ChannelIdentifier`](https://dev.nominal.io/api/rest/channel-metadata-service.md#channelidentifier)
    :   ​

        Fields of `ChannelIdentifier`

        `channelName` string
        :   ​

        `dataSourceRid` string (RID)
        :   ​

    `description` string
    :   ​

    `unit` string
    :   ​

    `dataType` [`SeriesDataType`](https://dev.nominal.io/api/rest/channel-metadata-service.md#seriesdatatype)
    :   ​

        Values of `SeriesDataType`

        `DOUBLE`
        :   ​

        `STRING`
        :   ​

        `LOG`
        :   ​

        `INT`
        :   ​

        `UINT`
        :   ​

        `DOUBLE_ARRAY`
        :   ​

        `STRING_ARRAY`
        :   ​

        `STRUCT`
        :   ​

        `VIDEO`
        :   ​

        `SPATIAL`
        :   ​

    `channelKind` [`ChannelKind`](https://dev.nominal.io/api/rest/channel-metadata-service.md#channelkind)
    :   Classifies how the channel is used. Omitted values should be treated as STANDARD.

        Values of `ChannelKind`

        `STANDARD`
        :   ​

        `COMMAND`
        :   ​

Request

**curl**

```shell
curl -X POST "https://api.gov.nominal.io/api/timeseries/channel-metadata/v1/channel-metadata/batch-update" \
  -H "Authorization: Bearer <api key>" \
  -H "Content-Type: application/json" \
  --data '{
  "requests": [
    {
      "channelIdentifier": {
        "channelName": "<channel>",
        "dataSourceRid": "<data source rid>"
      }
    }
  ]
}'
```

**requests**

```python
import requests

response = requests.post(
    "https://api.gov.nominal.io/api/timeseries/channel-metadata/v1/channel-metadata/batch-update",
    headers={"Authorization": "Bearer <api key>"},
    json={
        "requests": [
            {
                "channelIdentifier": {
                    "channelName": "<channel>",
                    "dataSourceRid": "<data source rid>",
                },
            },
        ],
    },
)
response.raise_for_status()
print(response.json())
```

**httpx**

```python
import httpx

response = httpx.post(
    "https://api.gov.nominal.io/api/timeseries/channel-metadata/v1/channel-metadata/batch-update",
    headers={"Authorization": "Bearer <api key>"},
    json={
        "requests": [
            {
                "channelIdentifier": {
                    "channelName": "<channel>",
                    "dataSourceRid": "<data source rid>",
                },
            },
        ],
    },
)
response.raise_for_status()
print(response.json())
```

**aiohttp**

```python
import asyncio

import aiohttp

async def main() -> None:
    async with aiohttp.ClientSession() as session:
        async with session.post(
            "https://api.gov.nominal.io/api/timeseries/channel-metadata/v1/channel-metadata/batch-update",
            headers={"Authorization": "Bearer <api key>"},
            json={
                "requests": [
                    {
                        "channelIdentifier": {
                            "channelName": "<channel>",
                            "dataSourceRid": "<data source rid>",
                        },
                    },
                ],
            },
        ) as response:
            response.raise_for_status()
            print(await response.json())

asyncio.run(main())
```

Response: `200`

```json
{
  "responses": [
    {
      "channelIdentifier": {
        "channelName": "<channel>",
        "dataSourceRid": "<data source rid>"
      },
      "description": "<description>",
      "unit": "<unit>",
      "dataType": "DOUBLE",
      "channelKind": "STANDARD"
    }
  ]
}
```

## Errors

[Errors](https://dev.nominal.io/api/legacy.md#errors) shows how these errors are sent.

Each error’s `errorName` is `ChannelMetadata:` followed by its name below.

| Status | Name | Notes |
| --- | --- | --- |
| 404 | `ChannelsNotFound` |  |

## Types

### ChannelIdentifier

`channelName` string required
:   ​

`dataSourceRid` string (RID) required
:   ​

### ChannelKind

Classifies how a channel is used. COMMAND channels accept commands through the Command Service.

`STANDARD`
:   ​

`COMMAND`
:   ​

### ChannelMetadata

`channelIdentifier` [`ChannelIdentifier`](https://dev.nominal.io/api/rest/channel-metadata-service.md#channelidentifier) required
:   ​

`description` string
:   ​

`unit` string
:   ​

`dataType` [`SeriesDataType`](https://dev.nominal.io/api/rest/channel-metadata-service.md#seriesdatatype)
:   ​

`channelKind` [`ChannelKind`](https://dev.nominal.io/api/rest/channel-metadata-service.md#channelkind)
:   Classifies how the channel is used. Omitted values should be treated as STANDARD.

### Empty

An empty JSON object, `{}`.

### GetChannelMetadataRequest

`channelIdentifier` [`ChannelIdentifier`](https://dev.nominal.io/api/rest/channel-metadata-service.md#channelidentifier) required
:   ​

### SeriesDataType

The data types that are available for querying.

`DOUBLE`
:   ​

`STRING`
:   ​

`LOG`
:   ​

`INT`
:   ​

`UINT`
:   ​

`DOUBLE_ARRAY`
:   ​

`STRING_ARRAY`
:   ​

`STRUCT`
:   ​

`VIDEO`
:   ​

`SPATIAL`
:   ​

### UnitUpdate

UnitUpdate is used to either set a unit, or to clear an existing unit.

Set `type` to the name of one of the other fields, and set only that field.

`unit` string
:   ​

`clearUnit` [`Empty`](https://dev.nominal.io/api/rest/channel-metadata-service.md#empty)
:   ​

### UpdateChannelMetadataRequest

`channelIdentifier` [`ChannelIdentifier`](https://dev.nominal.io/api/rest/channel-metadata-service.md#channelidentifier) required
:   ​

`description` string
:   ​

`unitUpdate` [`UnitUpdate`](https://dev.nominal.io/api/rest/channel-metadata-service.md#unitupdate)
:   ​

Page design based on [Scalar](https://scalar.com), MIT License.
