Resource Download
Interfaces for getting downloadable resource lists.
Get Resource List
Get all public resources.
Interface Information
- Endpoint:
GET /api/resources - Authentication: Not required (public interface)
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| page | number | No | Page number, default 1 |
| limit | number | No | Items per page, default 10 |
Download Resource
Download a specific resource and increment download count.
Interface Information
- Endpoint:
GET /api/resources/:id/download - Authentication: Not required (public interface)
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| id | number | Yes | Resource ID |
Request Examples
bash
# Get resource list
curl http://localhost:3000/api/resources
# Download resource (redirects to actual file)
curl -L http://localhost:3000/api/resources/1/downloadResponse Example (Resource List)
json
{
"success": true,
"data": [
{
"id": 1,
"title": "Project Template",
"description": "Quick start template",
"fileSize": "5.2MB",
"downloadCount": 128,
"createdAt": "2024-01-15T10:00:00.000Z"
}
],
"total": 10,
"page": 1,
"limit": 10
}Error Responses
| HTTP Status Code | Description |
|---|---|
| 404 | Resource does not exist |
| 500 | Server error |