# import odata

> Import a data contract from OData 4.x CSDL XML or JSON metadata, using a URL or local file.

# `datacontract import odata`

```bash
datacontract import odata [OPTIONS]
```

| Option | Default | Description |
|---|---|---|
| `--service-root-url` | required | HTTP(S) root URL of the OData service. |
| `--service-document-file` | — | Local JSON service document. Ignored when --entity-set is supplied. |
| `--entity-set` | — | EntitySet to import (repeat for multiple sets). If omitted, will import all sets from the service document. |
| `--metadata-url` | — | CSDL XML or JSON URL. Defaults to SERVICE_ROOT_URL/$metadata. |
| `--metadata-file` | — | Path to a local OData CSDL XML or JSON file. Use either --metadata-file or --metadata-url. |
| `--output` | — | File path where the Data Contract will be saved. If not provided, it will be printed to stdout. |
| `--owner` | — | The owner or team responsible for managing the data contract. |
| `--id` | — | The identifier for the data contract. |
| `--debug` / `--no-debug` | — | Enable debug logging |

```bash
datacontract import odata --service-root-url https://example.com/odata/ --entity-set Products --output datacontract.yaml
```

Guide: **[Import: OData](../../imports/odata.md)**.
