Skip to main content

Logshare API Documentation

Logshare provides RESTful API endpoints for third-party applications to integrate log upload functionality.

Basic Information​

  • API Base URL: https://logshare.cn/api
  • Content-Type: application/json
  • Encoding: UTF-8

Endpoints​

1. Upload Log​

POST /api/upload

Upload Minecraft log file and return share link.

Request Parameters​

ParameterTypeRequiredDescription
contentstringYesLog content
namestringNoLog file name
formatstringNoResponse format: json or plain, default json

Request Example​

Upload Log File
curl -X POST https://logshare.cn/api/upload \
-H "Content-Type: application/json" \
--data-binary @server.log
Using JSON Data
curl -X POST https://logshare.cn/api/upload \
-H "Content-Type: application/json" \
-d '{"content": "Log content", "name": "server.log"}'

Success Response​

Success Response
{
"success": true,
"url": "https://logshare.cn/abc123",
"shortUrl": "https://logshare.cn/s/abc123",
"id": "abc123",
"createdAt": "2024-01-15T10:30:00Z"
}

Error Response​

Error Response
{
"success": false,
"error": "Content cannot be empty",
"code": 400
}

2. Get Log Content​

GET /api/log/{id}

Get log content by log ID.

Request Parameters​

ParameterTypeRequiredDescription
idstringYesLog ID

Request Example​

curl https://logshare.cn/api/log/abc123

Success Response​

{
"success": true,
"id": "abc123",
"content": "[19:30:45] [Server thread/INFO]: Starting minecraft server version 1.20.1",
"name": "server.log",
"views": 15,
"createdAt": "2024-01-15T10:30:00Z"
}

3. Get Statistics​

GET /api/stats/{id}

Get access statistics for a log.

Request Parameters​

ParameterTypeRequiredDescription
idstringYesLog ID

Success Response​

Success Response
{
"success": true,
"id": "abc123",
"views": 15,
"uniqueViews": 12,
"createdAt": "2024-01-15T10:30:00Z"
}

4. Health Check​

GET /api/health

Check service health status.

Success Response​

Health Check Response
{
"status": "healthy",
"timestamp": "2024-01-15T10:30:00Z"
}

Error Codes​

CodeDescription
400Bad request
404Log not found
413Request too large
500Internal server error

Limits​

  • Maximum log size: 10MB
  • Maximum uploads per IP per minute: 10
  • Log retention: Permanent
Rate Limiting

Please be aware of API rate limits. Exceeding limits will return 429 errors. It is recommended to implement retry mechanisms on the client side.

Security Notice

Do not include sensitive information in log content, such as passwords or API keys. Once uploaded, logs are stored permanently.