# Generic service

The _generic_ service API enables you to add support for unique types of services that do not already have an [appropriate API](https://docs.viam.com/reference/apis/#service-apis) defined for them.

For example, when writing code to manage simultaneous localization and mapping (SLAM) for your machine, it makes sense to use the existing SLAM API, which provides specific functionality required for generating accurate maps of an environment. However, if you want to create a new service to monitor your machine’s CPU and RAM usage for example, you need very different functionality that isn’t currently exposed in any API. Instead, you can use the generic service API to add support for your unique type of service, like local system monitoring, to your machine.

Use generic for a modular resource model that represents a unique type of service. If you are adding support for unique or proprietary hardware, rather than adding new high-level software functionality, use the [generic component](https://docs.viam.com/reference/components/generic/) instead.

There are no built-in generic service models (other than `fake`).

#### Important

The generic service API only supports the `DoCommand` method. If you use the generic API, your module needs to define any and all service functionality and pass it through `DoCommand`.

Whenever possible, it is best to use an [existing service API](https://docs.viam.com/reference/apis/services/) instead of generic so that you do not have to replicate code. If you want to use most of an existing API but need just a few other functions, try using the `DoCommand` endpoint and extra parameters to add custom functionality to an existing API, instead of using the generic service.

## Configuration

For configuration information, click on the model name:

135 results:

| Model | Description |
| --- | --- |
| [`fake`](https://docs.viam.com/reference/services/generic/fake/) | Built-in service: A model used for testing a generic service. |
| [`viam-soleng:data:mirror`](https://app.viam.com/module/viam-soleng/data-mirror/) | Mirror binary data from Viam data management to any machines running viam-server |
| [`devrel:so101:teleop`](https://app.viam.com/module/devrel/so101-arm/) | Mirror a leader arm's joint positions and gripper onto a follower arm for hand-guided teleoperation |
| [`devrel:watering-controller:plant-watering`](https://app.viam.com/module/devrel/watering-controller/) | Automate a water pump for plant care using a digital sensor value. |
| [`coderscafe:google-calendar:calendar`](https://app.viam.com/module/coderscafe/google-calendar/) | Modular generic service: calendar |

#### Add support for other models

If none of the existing models fit your use case, you can [create a modular resource](https://docs.viam.com/build-modules/write-a-driver-module/) to add support for it.

## API

The [generic service API](https://docs.viam.com/reference/apis/services/generic/) supports the following method:

| Method Name | Description |
| --- | --- |
| [`DoCommand`](https://docs.viam.com/reference/apis/services/generic/#docommand) | Execute model-specific commands. |
| [`GetResourceName`](https://docs.viam.com/reference/apis/services/generic/#getresourcename) | Get the `ResourceName` for this instance of the generic service. |
| [`Close`](https://docs.viam.com/reference/apis/services/generic/#close) | Safely shut down the resource and prevent further use. |

## Troubleshooting

You can find additional assistance in the [Troubleshooting section](https://docs.viam.com/monitor/troubleshoot/).

You can also ask questions in the [Community Discord](https://discord.gg/viam) and we will be happy to help.
