# Data management service API

The data management service API allows you to sync data stored on the machine it is deployed on to the cloud.

The [data management service](https://docs.viam.com/data/capture-sync/capture-and-sync-data/) supports the following methods:

| Method Name | Description | `viam-micro-server` Support |
| --- | --- | --- |
| [`Sync`](https://docs.viam.com/reference/apis/services/data/#sync) | Sync data stored on the machine to the cloud. |  |
| [`UploadBinaryDataToDatasets`](https://docs.viam.com/reference/apis/services/data/#uploadbinarydatatodatasets) | Upload Binary data to the specified datasets. |  |
| [`Reconfigure`](https://docs.viam.com/reference/apis/services/data/#reconfigure) | Reconfigure this resource. |  |
| [`DoCommand`](https://docs.viam.com/reference/apis/services/data/#docommand) | Execute model-specific commands that are not otherwise defined by the service API. |  |
| [`GetResourceName`](https://docs.viam.com/reference/apis/services/data/#getresourcename) | Get the `ResourceName` for this instance of the service. |  |
| [`Close`](https://docs.viam.com/reference/apis/services/data/#close) | Safely shut down the resource and prevent further use. |  |

The data client API supports a separate set of methods that allow you to upload and export data to and from Viam.
For information about that API, see [Data Client API](https://docs.viam.com/reference/apis/data-client/).

## API

### Sync

#### Important

This method is not yet available in the Viam Python SDK.

Sync data stored on the machine to the cloud.

- [Go](https://docs.viam.com/reference/apis/services/data/#tabset-referenceapisservicesdata-1-0)
- [TypeScript](https://docs.viam.com/reference/apis/services/data/#tabset-referenceapisservicesdata-1-1)

**Parameters:**

- `ctx` [(Context)](https://pkg.go.dev/context#Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.
- `extra` [(map[string]interface{})](https://go.dev/blog/maps): Extra options to pass to the underlying RPC call.

**Returns:**

- [(error)](https://pkg.go.dev/builtin#error): An error, if one occurred.

**Example:**

```go

```

For more information, see the [Go SDK Docs](https://pkg.go.dev/go.viam.com/rdk/services/datamanager#Service).

**Parameters:**

- `extra` (None) (optional): Extra arguments to pass to the sync request.
- `callOptions` (CallOptions) (optional): Call options for the sync request.

**Returns:**

- (Promise)

**Example:**

```ts

```

For more information, see the [TypeScript SDK Docs](https://ts.viam.dev/classes/DataManagerClient.html#sync).

### UploadBinaryDataToDatasets

Upload Binary data to the specified datasets.

- [Go](https://docs.viam.com/reference/apis/services/data/#tabset-referenceapisservicesdata-2-0)
- [TypeScript](https://docs.viam.com/reference/apis/services/data/#tabset-referenceapisservicesdata-2-1)

**Parameters:**

- `ctx` [(Context)](https://pkg.go.dev/context#Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.
- `binaryData` [([]byte)](https://pkg.go.dev/builtin#byte)
- `datasetIDs`
- `tags` [([]string)](https://pkg.go.dev/builtin#string)
- `mimeType` [(datasyncpb.MimeType)](https://pkg.go.dev/go.viam.com/api/app/datasync/v1#MimeType)
- `extra` [(map[string]interface{})](https://go.dev/blog/maps): Extra options to pass to the underlying RPC call.

**Returns:**

- [(error)](https://pkg.go.dev/builtin#error): An error, if one occurred.

For more information, see the [Go SDK Docs](https://pkg.go.dev/go.viam.com/rdk/services/datamanager#Service).

**Parameters:**

- `binaryData` (Uint8Array) (required): The binary data to upload.
- `tags` (string) (required): Tags to associate with the binary data.
- `datasetIds` (string) (required): IDs of the datasets to associate the binary data with.
- `mimeType` (MimeType) (required): The MIME type of the binary data.
- `extra` (None) (optional): Extra arguments to pass to the upload request.
- `callOptions` (CallOptions) (optional): Call options for the upload request.

**Returns:**

- (Promise)

**Example:**

```ts

```

For more information, see the [TypeScript SDK Docs](https://ts.viam.dev/classes/DataManagerClient.html#uploadbinarydatatodatasets).

### Reconfigure

Reconfigure this resource.
Reconfigure must reconfigure the resource atomically and in place.

- [Go](https://docs.viam.com/reference/apis/services/data/#tabset-referenceapisservicesdata-3-0)

**Parameters:**

- `ctx` [(Context)](https://pkg.go.dev/context#Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.
- `deps` [(Dependencies)](https://pkg.go.dev/go.viam.com/rdk/resource#Dependencies): The resource dependencies.
- `conf` [(Config)](https://pkg.go.dev/go.viam.com/rdk/resource#Config): The resource configuration.

**Returns:**

- [(error)](https://pkg.go.dev/builtin#error): An error, if one occurred.

For more information, see the [Go SDK Docs](https://pkg.go.dev/go.viam.com/rdk/resource#Resource).

### DoCommand

Execute model-specific commands that are not otherwise defined by the service API.
Most models do not implement `DoCommand`.
Any available model-specific commands should be covered in the model’s documentation.
If you are implementing your own data manager service and want to add features that have no corresponding built-in API method, you can implement them with [`DoCommand`](https://docs.viam.com/reference/sdks/docommand/).

- [Go](https://docs.viam.com/reference/apis/services/data/#tabset-referenceapisservicesdata-4-0)
- [TypeScript](https://docs.viam.com/reference/apis/services/data/#tabset-referenceapisservicesdata-4-1)

**Parameters:**

- `ctx` [(Context)](https://pkg.go.dev/context#Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.
- `cmd` [(map[string]interface{})](https://go.dev/blog/maps): The command to execute.

**Returns:**

- [(map[string]interface{})](https://pkg.go.dev/builtin#string): The command response.
- [(error)](https://pkg.go.dev/builtin#error): An error, if one occurred.

**Example:**

```go

```

For more information, see the [Go SDK Docs](https://pkg.go.dev/go.viam.com/rdk/resource#Resource).

**Parameters:**

- `command` ( [Struct](https://ts.viam.dev/classes/Struct.html)) (required): The command to execute. Accepts either a [Struct](https://ts.viam.dev/classes/Struct.html) or
a plain object, which will be converted automatically.
- `callOptions` (CallOptions) (optional)

**Returns:**

- (Promise< [JsonValue](https://ts.viam.dev/types/JsonValue.html) >)

**Example:**

```ts

```

For more information, see the [TypeScript SDK Docs](https://ts.viam.dev/classes/DataManagerClient.html#docommand).

### GetResourceName

Get the `ResourceName` for this instance of the service.

- [Go](https://docs.viam.com/reference/apis/services/data/#tabset-referenceapisservicesdata-5-0)
- [TypeScript](https://docs.viam.com/reference/apis/services/data/#tabset-referenceapisservicesdata-5-1)

**Parameters:**

- None.

**Returns:**

- [(Name)](https://pkg.go.dev/go.viam.com/rdk@v0.89.0/resource#Name)

**Example:**

```go

```

For more information, see the [Go SDK Docs](https://pkg.go.dev/go.viam.com/rdk/resource#Resource).

**Parameters:**

- None.

**Returns:**

- (string): The name of the resource.

**Example:**

```ts

```

For more information, see the [TypeScript SDK Docs](https://ts.viam.dev/classes/DataManagerClient.html#name).

### Close

Safely shut down the resource and prevent further use.

- [Go](https://docs.viam.com/reference/apis/services/data/#tabset-referenceapisservicesdata-6-0)

**Parameters:**

- `ctx` [(Context)](https://pkg.go.dev/context#Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.

**Returns:**

- [(error)](https://pkg.go.dev/builtin#error): An error, if one occurred.

**Example:**

```go

```

For more information, see the [Go SDK Docs](https://pkg.go.dev/go.viam.com/rdk/resource#Resource).
