Skip to content

Commit 1591308

Browse files
committed
Improve docs
1 parent 2219606 commit 1591308

3 files changed

Lines changed: 619 additions & 2 deletions

File tree

README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ REST API for DDI (Data Documentation Initiative), an international standard for
66

77
This API provides access to DDI metadata resources.
88

9+
For detailed API usage, endpoints, and examples, see the [Mock API Endpoints Documentation](docs/MOCK_API_ENDPOINTS.md).
10+
911
## OpenAPI Specification
1012

1113
The API specification is available in the `ddi-rest.yaml` file in OpenAPI 3.1.1 format.
@@ -22,3 +24,39 @@ To view and test the API specification locally:
2224

2325
- **Swagger Editor**: Open [https://editor.swagger.io/](https://editor.swagger.io/) and paste the contents of `ddi-rest.yaml` or load it directly from the repository
2426
- **Local Swagger UI**: Run `yarn build:swagger` and `yarn preview:swagger` to start a local Swagger UI server
27+
- **Local Mock Server**: Run `yarn mock` to start a mock API server for testing
28+
29+
### Accept Header
30+
31+
The API supports multiple response formats. Use the `Accept` header to specify your preferred format:
32+
33+
**JSON (default):**
34+
```bash
35+
# Explicit JSON request
36+
curl -H "Accept: application/json" https://api.example.com/ddi/v1/variables
37+
38+
# DDI-specific JSON format
39+
curl -H "Accept: application/vnd.ddi.structure+json;version=3.3" https://api.example.com/ddi/v1/variables
40+
41+
# Default (JSON if no Accept header)
42+
curl https://api.example.com/ddi/v1/variables
43+
```
44+
45+
**XML:**
46+
```bash
47+
# DDI-specific XML format (recommended)
48+
curl -H "Accept: application/vnd.ddi.structure+xml;version=3.3" https://api.example.com/ddi/v1/variables
49+
50+
# Generic XML formats
51+
curl -H "Accept: application/xml" https://api.example.com/ddi/v1/variables
52+
curl -H "Accept: text/xml" https://api.example.com/ddi/v1/variables
53+
```
54+
55+
**Supported Content Types:**
56+
- `application/json` - JSON format (default)
57+
- `application/vnd.ddi.structure+json;version=3.3` - DDI JSON format
58+
- `application/vnd.ddi.structure+xml;version=3.3` - DDI XML format (recommended for XML)
59+
- `application/xml` - Generic XML format
60+
- `text/xml` - Generic XML format
61+
62+
**Note:** If no `Accept` header is provided, the API returns JSON by default.

0 commit comments

Comments
 (0)