Report Uploading
The Upload API utilizes presigned URLs to securely upload test reports and attachments to Flakiness.io. Clients request presigned URLs from the service, upload data directly to storage, and then notify Flakiness.io when the upload is complete.
The upload process consists of three sequential steps:
- Start Upload - Initialize an upload session and receive an
uploadTokento control the report upload. - Upload Report & Attachments - Upload the compressed report and any test artifacts using presigned URLs
- Finish Upload - Complete the upload process and mark the report for processing
Working with Presigned URLs
Section titled “Working with Presigned URLs”Here are the essential rules for working with Flakiness.io presigned URLs:
- HTTP Method: Always use
PUTmethod for uploads - No Authentication: Presigned URLs contain embedded authentication - do not add additional authorization headers
Report Upload Requirements
Section titled “Report Upload Requirements”When uploading the main report file:
- Compression: Reports must be compressed with Brotli compression
- Content-Type: Set to
application/json - Content-Encoding: Set to
br(Brotli) - Quality: Use
--quality=9for optimal compression
# Compress the reportbrotli --quality=9 --output=report.json.br report.json
# Upload with required headerscurl -X PUT "$PRESIGNED_REPORT_URL" \ -H "Content-Type: application/json" \ -H "Content-Encoding: br" \ --data-binary @report.json.brAttachment Upload Guidelines
Section titled “Attachment Upload Guidelines”For test attachments (screenshots, logs, videos):
- Compression: Optional but recommended for text-based files
- Supported Formats:
deflate,br(Brotli), orgzip - Binary Files: Images and videos typically don’t benefit from compression
- Content Headers: Only add compression headers if the file is actually compressed
# Upload uncompressed attachmentcurl -X PUT "$PRESIGNED_ATTACHMENT_URL" \ --data-binary @attachments/5d41402
# Upload compressed attachmentgzip -c ./attachments/5d41402 > ./attachments/5d41402.gzcurl -X PUT "$PRESIGNED_ATTACHMENT_URL" \ -H "Content-Encoding: gzip" \ --data-binary @attachments/5d41402.gzQuick Start Example
Section titled “Quick Start Example”Consider uploading a test report with a single attachment to Flakiness.io:
flakiness-report/├── report.json└── attachments/ └── 5d41402-
Start Upload Session
Initialize the upload process to receive your upload token and presigned URLs:
Terminal window curl -X POST "https://flakiness.io/api/upload/start" \-H "Authorization: Bearer $FLAKINESS_ACCESS_TOKEN" \-H "Content-Type: application/json"Response:
{"uploadToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...","webUrl": "/f/ff/run/9","presignedReportUrl": "https://s3.flakiness.test/flakiness-data/reports/..."}The
webUrlprovides a path to track upload and processing status on the Flakiness.io platform. -
Compress and Upload Report
Reports must be compressed with Brotli for optimal efficiency:
Terminal window brotli --quality=9 --output=report.json.br report.jsonUpload the compressed report using the presigned URL:
Terminal window curl -X PUT "$REPORT_PRESIGNED_URL" \-H "Content-Type: application/json" \-H "Content-Encoding: br" \--data-binary @report.json.br -
Request Attachment URLs
If your report includes attachments, request presigned URLs for each attachment:
Terminal window curl -X POST "https://flakiness.io/api/upload/attachments" \-H "Authorization: Bearer $UPLOAD_TOKEN" \-H "Content-Type: application/json" \-d '{"attachmentIds":["5d41402"]}'Response:
[{"attachmentId": "5d41402","presignedUrl": "https://s3.flakiness.test/flakiness-data/reports/..."}] -
Upload Attachments
Upload each attachment using its corresponding presigned URL:
Terminal window curl -X PUT "$ATTACHMENT_PRESIGNED_URL" \--data-binary @attachments/5d41402 -
Finalize Upload
Complete the upload process to mark the report for processing:
Terminal window curl -X POST "https://flakiness.io/api/upload/finish" \-H "Authorization: Bearer $UPLOAD_TOKEN"
API Methods
Section titled “API Methods”Start Upload
Section titled “Start Upload”| Method | Endpoint | Authorization | Content-Type |
|---|---|---|---|
POST | /api/upload/start | Bearer {ACCESS_TOKEN} | application/json |
curl -X POST "https://flakiness.io/api/upload/start" \ -H "Authorization: Bearer $FLAKINESS_ACCESS_TOKEN" \ -H "Content-Type: application/json"{ "uploadToken": "eyJhbGciOiJIUz...", "webUrl": "/org/project/run/9", "presignedReportUrl": "https://s3.flakiness.test/flakiness-data/repor..."}Initializes a new upload session and returns an upload token along with a presigned URL for the report upload. The upload token is used to authenticate subsequent API calls within this upload session.
Response Fields:
uploadToken- JWT token for authenticating subsequent upload operations. The token will auto-expire in 24 hours.webUrl- Relative path to track upload progress on the platformpresignedReportUrl- Pre-signed S3 URL for uploading the compressed report
Request Attachment URLs
Section titled “Request Attachment URLs”| Method | Endpoint | Authorization | Content-Type |
|---|---|---|---|
POST | /api/upload/attachments | Bearer {UPLOAD_TOKEN} | application/json |
curl -X POST "https://flakiness.io/api/upload/attachments" \ -H "Authorization: Bearer $UPLOAD_TOKEN" \ -H "Content-Type: application/json" \ -d '{"attachmentIds":["5d41402","abc123"]}'[{ "attachmentId": "5d41402", "presignedUrl": "https://s3.flakiness.test/flakiness-data/re..."}, { "attachmentId": "abc123", "presignedUrl": "https://s3.flakiness.test/flakiness-data/re..."}]Generates presigned URLs for uploading test attachments. Each attachment ID from your report will receive a corresponding presigned URL for direct upload to storage.
Request Body:
attachmentIds- Array of attachment identifiers referenced in your test report.- Maximum of 1000 attachment ids is supported.
- Each attachment Id must not exceed 256 characters length.
Response:
- Array of objects containing
attachmentIdand correspondingpresignedUrl
Finish Upload
Section titled “Finish Upload”| Method | Endpoint | Authorization | Content-Type |
|---|---|---|---|
POST | /api/upload/finish | Bearer {UPLOAD_TOKEN} | N/A |
curl -X POST "https://flakiness.io/api/upload/finish" \ -H "Authorization: Bearer $UPLOAD_TOKEN"Completes the upload session and marks the report for processing. This endpoint should be called after successfully uploading the report and all attachments to their respective presigned URLs.