Skip to content

#2 Fix file upload documentation#3

Merged
AjdinDev merged 3 commits intomainfrom
2-panel-file-upload-document-improvement
Aug 4, 2025
Merged

#2 Fix file upload documentation#3
AjdinDev merged 3 commits intomainfrom
2-panel-file-upload-document-improvement

Conversation

@AjdinDev
Copy link
Copy Markdown
Contributor

@AjdinDev AjdinDev commented Aug 4, 2025

📋 Pull Request Description

🎯 Type of Change

  • [x ] Bug fix (non-breaking change which fixes an issue)
  • [x ] Documentation improvement

📖 What does this PR do?

The previous documentation for the file upload API call for v1 was incorrect. This fixes that by introducing the actual two step process currently present in Pterodactyl v1.

🔍 Related Issue

Closes #2

📍 Changes Made

  • [ x] Updated documentation content
  • [x ] Added/updated code examples
  • Fixed typos or formatting
  • [x ] Added new API endpoint documentation
  • [x ] Updated existing API endpoint documentation
  • Other: ___________

🧪 Testing

  • I have tested all code examples
  • Documentation builds without errors (npm run build)
  • All links work correctly
  • Multi-language examples are consistent
  • Changes are responsive on different screen sizes

📋 Checklist

  • [x ] My code follows the style guidelines of this project
  • I have performed a self-review of my changes
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I have added examples that prove my fix is effective or that my feature works
  • New and existing tests pass locally with my changes

@AjdinDev AjdinDev requested a review from Copilot August 4, 2025 18:45
@AjdinDev AjdinDev self-assigned this Aug 4, 2025

This comment was marked as outdated.

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages bot commented Aug 4, 2025

Deploying pterodactyl-api-docs-public with  Cloudflare Pages  Cloudflare Pages

Latest commit: 00f0a53
Status: ✅  Deploy successful!
Preview URL: https://fa324c4a.pterodactyl-api-docs-public.pages.dev
Branch Preview URL: https://2-panel-file-upload-document.pterodactyl-api-docs-public.pages.dev

View logs

@AjdinDev AjdinDev requested a review from Copilot August 4, 2025 18:48

This comment was marked as outdated.

@AjdinDev AjdinDev requested a review from Copilot August 4, 2025 18:54
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes the file upload documentation for the Pterodactyl v1 API by documenting the correct two-step process instead of the incorrect single-step approach. The documentation now properly explains that file uploads require first obtaining a signed upload URL, then using that URL to upload files.

Key Changes:

  • Updated file upload process from single-step to correct two-step approach
  • Added comprehensive code examples in 9 programming languages
  • Included multiple file upload examples and important implementation notes

files = {'files': f}
data = {'directory': directory}
upload_response = requests.post(signed_url, files=files, data=data)

Copy link

Copilot AI Aug 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation should clarify what each status code means. Status code 200 typically indicates success with response body, while 204 indicates success with no content. Consider adding a comment explaining when each status code is returned.

Suggested change
# 200 = Success with response body, 204 = Success with no content

Copilot uses AI. Check for mistakes.

### Important Notes

- **Signed URL Validity**: The signed URL is valid for 15 minutes (verified from source code)
Copy link

Copilot AI Aug 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] While the 15-minute validity is useful information, referencing 'verified from source code' in user-facing documentation is unusual. Consider rephrasing to simply state the validity period without the verification note, or cite official documentation instead.

Suggested change
- **Signed URL Validity**: The signed URL is valid for 15 minutes (verified from source code)
- **Signed URL Validity**: The signed URL is valid for 15 minutes

Copilot uses AI. Check for mistakes.
break;
}
}

Copy link

Copilot AI Aug 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PHP example shows uploading files one by one in a loop, but this contradicts the earlier statement that 'Maximum files per request' is 10 files. This approach would result in multiple separate requests rather than one request with multiple files. Consider clarifying this discrepancy or providing a working multi-file upload example for PHP.

Suggested change
// Option 1: Upload multiple files in a single request (recommended)
$postFields = ['directory' => $directory];
foreach ($filePaths as $idx => $filePath) {
$postFields["files[$idx]"] = new CURLFile($filePath);
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $signedUrl);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$uploadResponse = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($httpCode !== 200 && $httpCode !== 204) {
echo "Failed to upload files.\\n";
}

Copilot uses AI. Check for mistakes.
file_handle.close()

if upload_response.status_code in [200, 204]:
print('Multiple files uploaded successfully')`,
Copy link

Copilot AI Aug 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Python example opens multiple files but only closes them after the upload request. If the upload request fails or throws an exception, the file handles may not be closed properly. Consider using a context manager or try/finally block to ensure proper cleanup.

Suggested change
print('Multiple files uploaded successfully')`,
import contextlib
with contextlib.ExitStack() as stack:
files = []
for file_path in file_paths:
file_handle = stack.enter_context(open(file_path, 'rb'))
files.append(('files', file_handle))
data = {'directory': directory}
upload_response = requests.post(signed_url, files=files, data=data)
if upload_response.status_code in [200, 204]:
print('Multiple files uploaded successfully')`,

Copilot uses AI. Check for mistakes.
@AjdinDev AjdinDev merged commit 55855a0 into main Aug 4, 2025
3 checks passed
@AjdinDev AjdinDev deleted the 2-panel-file-upload-document-improvement branch August 4, 2025 18:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Panel file upload document improvement

2 participants