Files
smom-dbis-138/docs/templates/API_REFERENCE_TEMPLATE.md

128 lines
1.9 KiB
Markdown
Raw Permalink Normal View History

# API Reference: [API Name]
**Last Updated**: YYYY-MM-DD
**Status**: Active
**Version**: X.Y.Z
## Table of Contents
- [Overview](#overview)
- [Authentication](#authentication)
- [Base URL](#base-url)
- [Endpoints](#endpoints)
- [Request/Response Examples](#requestresponse-examples)
- [Error Handling](#error-handling)
- [Rate Limits](#rate-limits)
## Overview
Brief description of the API.
## Authentication
Describe authentication method:
```bash
# Example authentication
curl -H "Authorization: Bearer TOKEN" https://api.example.com/endpoint
```
## Base URL
```
https://api.example.com/v1
```
## Endpoints
### GET /endpoint
**Description**: Brief description
**Parameters**:
- `param1` (required): Description
- `param2` (optional): Description
**Response**:
```json
{
"field1": "value1",
"field2": "value2"
}
```
### POST /endpoint
**Description**: Brief description
**Request Body**:
```json
{
"field1": "value1",
"field2": "value2"
}
```
**Response**:
```json
{
"status": "success",
"data": {}
}
```
## Request/Response Examples
### Example 1: Basic Request
```bash
curl -X GET https://api.example.com/v1/endpoint \
-H "Authorization: Bearer TOKEN"
```
**Response**:
```json
{
"data": []
}
```
## Error Handling
### Error Codes
| Code | Message | Description |
|------|---------|-------------|
| 400 | Bad Request | Invalid parameters |
| 401 | Unauthorized | Missing or invalid token |
| 404 | Not Found | Resource not found |
| 500 | Internal Server Error | Server error |
### Error Response Format
```json
{
"error": {
"code": 400,
"message": "Error message",
"details": {}
}
}
```
## Rate Limits
- **Limit**: X requests per minute
- **Headers**: `X-RateLimit-Limit`, `X-RateLimit-Remaining`
## Related Documentation
- [API Overview](../api/API.md)
- [Integration Guide](../guides/INTEGRATION_GUIDE.md)
---
**Last Updated**: YYYY-MM-DD
**API Version**: X.Y.Z