Skip to content

Improve API response handling for token based upload#239

Merged
Xpirix merged 2 commits intoqgis:masterfrom
Xpirix:improve_api_response
Feb 10, 2026
Merged

Improve API response handling for token based upload#239
Xpirix merged 2 commits intoqgis:masterfrom
Xpirix:improve_api_response

Conversation

@Xpirix
Copy link
Copy Markdown
Collaborator

@Xpirix Xpirix commented Feb 6, 2026

This will improve the API for uploading a new plugin version with a Token.
For API/Token Requests:

  • Returns JSON responses instead of HTML
  • Uses proper HTTP status codes:
    • 201 - Version created successfully
    • 200 - Version updated successfully
    • 400 - Validation errors or exceptions
    • 405 - Method not allowed (non-POST requests)

Response Structure for Success:

{
  "success": true,
  "message": "The Plugin Version has been successfully created.",
  "version": "1.0.0",
  "plugin_id": 123,
  "version_id": 456,
  "approved": true,
  "security_scan": {
    "status": "passed",
    "critical_count": 0,
    "warning_count": 2,
    "info_count": 5,
    "scan_url": "http://..."
  },
  "warnings": ["..."]
}

Response Structure for Errors:

{
  "success": false,
  "error": "Validation failed",
  "errors": {
    "field_name": ["error message"]
  }
}

Cc @3nids , Will this be handled automatically by the qgis-plugin-ci? I see that it uses response.raise_for_status() so any status codes other than 200-299 should raise an exception.

@3nids
Copy link
Copy Markdown
Member

3nids commented Feb 6, 2026

cool, thanks again!

@Guts
Copy link
Copy Markdown
Contributor

Guts commented Feb 6, 2026

Yipeee you're my heroe @Xpirix!

@Xpirix Xpirix merged commit 61250f4 into qgis:master Feb 10, 2026
2 checks passed
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.

3 participants