This document provides comprehensive API documentation for Plus Artifacts Server.
http://localhost:8080
Currently, Plus does not require authentication. This will be added in future versions.
All API responses follow a consistent JSON format:
{
"status": {
"status": "success|error",
"message": "Human readable message",
"code": 200
},
"data": {
// Response data (varies by endpoint)
}
}200- Success400- Bad Request404- Not Found500- Internal Server Error503- Service Unavailable
{
"status": "error",
"message": "Repository not found",
"code": 404
}Check if the service is healthy.
Endpoint: GET /health
Response:
{
"status": "healthy",
"server": "plus"
}Example:
curl http://localhost:8080/healthCheck if the service is ready to handle requests.
Endpoint: GET /ready
Response:
{
"status": {
"status": "ready"
},
"checks": {
"storage": "ok"
}
}Example:
curl http://localhost:8080/readyGet detailed service metrics.
Endpoint: GET /metrics
Response:
{
"requests": {
"total": 1250,
"uploads": 45,
"downloads": 890,
"errors": 12,
"active": 3
},
"performance": {
"response_time_ms": 25,
"goroutines": 15
},
"memory": {
"alloc_mb": 45,
"total_alloc_mb": 120,
"sys_mb": 78,
"gc_cycles": 8
}
}Example:
curl http://localhost:8080/metricsGet a list of all repositories.
Endpoint: GET /repos
Response:
{
"status": {
"server": "Plus",
"status": "success",
"code": 200
},
"repositories": [
"centos/7",
"ubuntu/20.04",
"my-repo"
],
"tree": {
"centos": {
"type": "directory",
"children": {
"7": {
"type": "repo",
"path": "centos/7"
}
}
}
},
"count": 3
}Example:
curl http://localhost:8080/reposCreate a new repository.
Endpoint: POST /repos
Request Body:
{
"name": "my-repo",
"path": "optional/sub/path"
}Response:
{
"status": "success",
"message": "Repository created successfully",
"code": 200
}Example:
curl -X POST http://localhost:8080/repos \
-H "Content-Type: application/json" \
-d '{"name": "my-repo", "path": "centos/8"}'Get detailed information about a repository.
Endpoint: GET /repo/{repoName}
Response:
{
"status": {
"status": "success"
},
"name": "my-repo",
"package_count": 25,
"rpm_count": 20,
"deb_count": 5,
"total_size": 1048576000,
"packages": [
{
"name": "package1.rpm",
"size": 1024000
},
{
"name": "package2.deb",
"size": 2048000
}
]
}Example:
curl http://localhost:8080/repo/my-repoDelete a repository and all its packages.
Endpoint: DELETE /repo/{repoName}
Response:
{
"status": "success",
"message": "Repository deleted successfully",
"code": 200
}Example:
curl -X DELETE http://localhost:8080/repo/my-repoUpload a single package to a repository.
Endpoint: POST /repo/{repoName}/upload
Request: Multipart form with file field
Response:
{
"status": "success",
"message": "Package uploaded successfully",
"code": 200
}Example:
curl -X POST http://localhost:8080/repo/my-repo/upload \
-F "file=@package.rpm"Upload multiple packages at once.
Endpoint: POST /batch-upload
Request: Multipart form with:
repository: Repository namefiles: Multiple file fieldsauto_refresh: Optional, set to "true" to auto-refresh metadata
Response:
{
"status": "success",
"total": 3,
"success": 2,
"failed": 1,
"results": [
{
"filename": "package1.rpm",
"status": "success"
},
{
"filename": "package2.rpm",
"status": "success"
},
{
"filename": "invalid.txt",
"status": "failed",
"error": "Unsupported file type"
}
]
}Example:
curl -X POST http://localhost:8080/batch-upload \
-F "repository=my-repo" \
-F "files=@package1.rpm" \
-F "files=@package2.rpm" \
-F "auto_refresh=true"Download a package from a repository.
Endpoint:
GET /repo/{repoName}/rpm/{filename}(for RPM packages)GET /repo/{repoName}/deb/{filename}(for DEB packages)
Response: Binary file with appropriate headers
Example:
# Download RPM package
curl -O http://localhost:8080/repo/my-repo/rpm/package.rpm
# Download DEB package
curl -O http://localhost:8080/repo/my-repo/deb/package.debGet the SHA256 checksum of a package.
Endpoint: GET /repo/{repoName}/checksum/{filename}
Response:
{
"status": {
"status": "success",
"message": "Checksum retrieved successfully",
"code": 200
},
"filename": "package.rpm",
"sha256": "a1b2c3d4e5f6789...",
"repo": "my-repo"
}Example:
curl http://localhost:8080/repo/my-repo/checksum/package.rpmRefresh repository metadata (repodata).
Endpoint: POST /repo/{repoName}/refresh
Response:
{
"status": {
"status": "success",
"message": "Repository metadata refreshed successfully"
},
"repo": "my-repo"
}Example:
curl -X POST http://localhost:8080/repo/my-repo/refreshBrowse repository files and directories.
Endpoint: GET /repo/{repoName}/files/{path}
Response: HTML directory listing or file content
Example:
# Browse repository root
curl http://localhost:8080/repo/my-repo/files/
# Browse specific directory
curl http://localhost:8080/repo/my-repo/files/Packages/
# Get specific file
curl http://localhost:8080/repo/my-repo/files/repodata/repomd.xmlAccess repository metadata files directly.
Endpoint: GET /repo/{repoName}/repodata/{filename}
Common metadata files:
repomd.xml- Repository metadata index{hash}-primary.xml.gz- Package information{hash}-filelists.xml.gz- File lists{hash}-other.xml.gz- Additional metadata
Example:
# Get repository metadata index
curl http://localhost:8080/repo/my-repo/repodata/repomd.xml
# Get primary metadata
curl http://localhost:8080/repo/my-repo/repodata/abc123-primary.xml.gzPlus supports multi-level repository paths for better organization:
Examples:
# Create nested repository
curl -X POST http://localhost:8080/repos \
-H "Content-Type: application/json" \
-d '{"name": "centos", "path": "7/x86_64"}'
# Upload to nested repository
curl -X POST http://localhost:8080/repo/centos/7/x86_64/upload \
-F "file=@package.rpm"
# Download from nested repository
curl -O http://localhost:8080/repo/centos/7/x86_64/rpm/package.rpmTo use Plus repositories with YUM:
# Create repository configuration
cat > /etc/yum.repos.d/plus-repo.repo << EOF
[plus-repo]
name=Plus Repository
baseurl=http://your-server:8080/repo/my-repo/files/
enabled=1
gpgcheck=0
metadata_expire=300
EOF
# Update YUM cache
yum clean all
yum makecacheFor DEB packages (future support):
# Add repository
echo "deb http://your-server:8080/repo/my-repo/files/ ./" > /etc/apt/sources.list.d/plus-repo.list
# Update package cache
apt updateCurrently, Plus does not implement rate limiting. This will be added in future versions.
Plus supports CORS for web applications. CORS is enabled by default for all origins in development mode.
WebSocket support for real-time updates is planned for future versions.
For endpoints that return large datasets, pagination will be added in future versions:
{
"data": [...],
"pagination": {
"page": 1,
"per_page": 50,
"total": 1000,
"total_pages": 20
}
}Currently, Plus uses a single API version. Future versions will include API versioning:
/api/v1/repos
/api/v2/repos
import "github.com/elastic-io/plus/pkg/client"
c := client.NewClient(client.ClientConfig{
BaseURL: "http://localhost:8080",
Timeout: 30 * time.Second,
})
// Upload package
err := c.UploadPackage("my-repo", "./package.rpm")# Install CLI
go install github.com/elastic-io/plus/cmd/plus-cli@latest
# Use CLI
plus-cli --server http://localhost:8080 upload --repo my-repo --file package.rpm# 1. Check service health
curl http://localhost:8080/health
# 2. Create repository
curl -X POST http://localhost:8080/repos \
-H "Content-Type: application/json" \
-d '{"name": "my-repo"}'
# 3. Upload package
curl -X POST http://localhost:8080/repo/my-repo/upload \
-F "file=@package.rpm"
# 4. Refresh metadata
curl -X POST http://localhost:8080/repo/my-repo/refresh
# 5. Verify package
curl http://localhost:8080/repo/my-repo/checksum/package.rpm
# 6. Configure YUM
cat > /etc/yum.repos.d/my-repo.repo << EOF
[my-repo]
name=My Repository
baseurl=http://localhost:8080/repo/my-repo/files/
enabled=1
gpgcheck=0
EOF
# 7. Use with YUM
yum install package-name400- Invalid request format or missing parameters404- Repository or package not found500- Internal server error (check logs)503- Service not ready (storage issues)
Enable debug logging for detailed API request/response information:
./plus --config config.yaml --debugThis API reference covers all current endpoints. For the latest updates, check the GitHub repository.