Skip to content

Implement Jenkins Servers CRUD Endpoints #8

@tomislavantebrncic

Description

@tomislavantebrncic

Endpoint Specifications:

  1. POST /jenkins-servers/ - Create new Jenkins server

    • Request Body:

      {
        "name": "string (1-100 chars)",
        "server": "string (URL)",
        "username": "string",
        "apiToken": "string",
        "instructions": "string (optional)",
        "responseFormat": "string (optional)"
      }
    • Response Body: 201 Created

      {
        "id": "uuid",
        "name": "string",
        "server": "string",
        "username": "string",
        "apiToken_enc": "string (encrypted)",
        "instructions": "string (optional)",
        "responseFormat": "string (optional)",
        "user_id": "uuid",
        "created_at": "datetime",
        "updated_at": "datetime (optional)"
      }
  2. GET /jenkins-servers/ - List all Jenkins servers for current user

    • Request Body: None

    • Response Body: 200 OK

      {
        "jenkins_servers": [
          {
            "id": "uuid",
            "name": "string",
            "server": "string",
            "username": "string",
            "apiToken_enc": "string",
            "instructions": "string (optional)",
            "responseFormat": "string (optional)",
            "user_id": "uuid",
            "created_at": "datetime",
            "updated_at": "datetime (optional)"
          }
        ]
      }
  3. GET /jenkins-servers/{server_id} - Get specific Jenkins server by ID

    • Request Body: None
    • Response Body: 200 OK (same as single server in list above)
    • Error Response: 404 Not Found {"detail": "Jenkins server not found"}
  4. PUT /jenkins-servers/{server_id} - Update existing Jenkins server

    • Request Body: (all fields optional)

      {
        "name": "string (optional)",
        "server": "string (optional)",
        "username": "string (optional)",
        "apiToken": "string (optional)",
        "instructions": "string (optional)",
        "responseFormat": "string (optional)"
      }
    • Response Body: 200 OK (same as create response)

    • Error Response: 404 Not Found {"detail": "Jenkins server not found"}

  5. DELETE /jenkins-servers/{server_id} - Delete Jenkins server

    • Request Body: None
    • Response Body: 204 No Content
    • Error Response: 404 Not Found {"detail": "Jenkins server not found"}

Authentication:

  • All endpoints require Authorization: Bearer <token> header
  • JWT-based authentication dependency

Validation:

  • Pydantic schemas for input validation
  • Server names: 1-100 characters
  • Server: valid URL format
  • Username: required, non-empty
  • API token: required for create, optional for update (leave empty to keep current)

Error Handling:

  • 400 Bad Request for validation errors
  • 401 Unauthorized for missing/invalid auth
  • 404 Not Found for non-existent servers
  • 500 Internal Server Error for database/other errors

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions