# {{ interface_name | pascal_case }} REST API Client Interface

{{ interface_description }}

Generated by MADSci template: `comm/rest` v{{ template_version }}

## Overview

REST API client interface for HTTP-based communication with instruments and
services. Provides standard HTTP methods (GET, POST, PUT, DELETE) with session
management and configurable timeouts.

## Usage

```python
from {{ interface_name }}_interface import {{ interface_name | pascal_case }}Interface

interface = {{ interface_name | pascal_case }}Interface(base_url="http://192.168.1.100:8080")
interface.connect()

# Read data
status = interface.get("/api/status")

# Send commands
result = interface.post("/api/command", data={"action": "run", "params": {"speed": 100}})

# Update configuration
interface.put("/api/config", data={"mode": "auto"})

# Remove resources
interface.delete("/api/resource/123")

interface.disconnect()
```

## Testing

Use the fake interface for development and testing without a live server:

```python
from {{ interface_name }}_fake_interface import {{ interface_name | pascal_case }}FakeInterface

interface = {{ interface_name | pascal_case }}FakeInterface(simulated_latency=0.0)
interface.set_response("GET", "/api/status", {"status": "ok"})
interface.connect()
result = interface.get("/api/status")
assert result == {"status": "ok"}
```

Run the test suite:

```bash
pytest test_{{ interface_name }}.py
```

## Dependencies

- `httpx>=0.24` or `requests>=2.28` for the real interface

## Common Pitfalls

- Ensure the base URL does not include a trailing slash (it is stripped automatically)
- Set an appropriate timeout for slow endpoints; the default is 10 seconds
- Handle HTTP error status codes in your application logic
- Consider retry logic for transient network failures
- Be aware of JSON serialization for request/response bodies
