# Service Requests

Service request management operations

## Create a service request

> Creates a new internal service request

```json
{"openapi":"3.0.3","info":{"title":"Kaana Service Requests API","version":"1.0.0"},"tags":[{"name":"Service Requests","description":"Service request management operations"}],"servers":[{"url":"/api","description":"API base path"}],"security":[{"sessionAuth":[]}],"components":{"securitySchemes":{"sessionAuth":{"type":"apiKey","in":"cookie","name":"connect.sid","description":"Session-based authentication via HTTP-only cookie"}},"schemas":{"ServiceRequestCreate":{"type":"object","required":["title"],"properties":{"title":{"type":"string","description":"Service request title"},"description":{"type":"string","nullable":true,"description":"Detailed description"},"priority":{"type":"string","enum":["low","medium","high","urgent"],"default":"medium"},"category":{"type":"string","nullable":true},"referenceType":{"type":"string","nullable":true,"enum":["project","organization"]},"referenceId":{"type":"integer","nullable":true}}},"ServiceRequest":{"type":"object","required":["id","title","status","priority","creatorId","createdAt","updatedAt"],"properties":{"id":{"type":"integer","description":"Unique service request identifier"},"title":{"type":"string","description":"Service request title"},"description":{"type":"string","nullable":true,"description":"Detailed description of the request"},"status":{"type":"string","enum":["open","in_progress","pending","resolved","closed"],"description":"Current status"},"priority":{"type":"string","enum":["low","medium","high","urgent"],"description":"Priority level"},"category":{"type":"string","nullable":true,"description":"Request category"},"creatorId":{"type":"integer","description":"User ID who created the request"},"assigneeId":{"type":"integer","nullable":true,"description":"User ID assigned to the request"},"referenceType":{"type":"string","nullable":true,"description":"Type of linked reference (project, organization)"},"referenceId":{"type":"integer","nullable":true,"description":"ID of the linked reference"},"metadata":{"type":"object","nullable":true,"description":"Additional request metadata"},"createdAt":{"type":"string","format":"date-time","description":"Creation timestamp"},"updatedAt":{"type":"string","format":"date-time","description":"Last update timestamp"}}}}},"paths":{"/managed-services/request":{"post":{"tags":["Service Requests"],"summary":"Create a service request","description":"Creates a new internal service request","operationId":"createServiceRequest","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ServiceRequestCreate"}}}},"responses":{"200":{"description":"Service request created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ServiceRequest"}}}},"400":{"description":"Validation error"},"401":{"description":"Not authenticated"},"403":{"description":"Permission denied"},"500":{"description":"Server error"}}}}}}
```

## Delete a service request

> Deletes an internal service request

```json
{"openapi":"3.0.3","info":{"title":"Kaana Service Requests API","version":"1.0.0"},"tags":[{"name":"Service Requests","description":"Service request management operations"}],"servers":[{"url":"/api","description":"API base path"}],"security":[{"sessionAuth":[]}],"components":{"securitySchemes":{"sessionAuth":{"type":"apiKey","in":"cookie","name":"connect.sid","description":"Session-based authentication via HTTP-only cookie"}}},"paths":{"/service-requests/{id}":{"delete":{"tags":["Service Requests"],"summary":"Delete a service request","description":"Deletes an internal service request","operationId":"deleteServiceRequest","parameters":[{"name":"id","in":"path","required":true,"description":"Service request ID","schema":{"type":"integer"}}],"responses":{"204":{"description":"Service request deleted successfully"},"401":{"description":"Not authenticated"},"403":{"description":"Permission denied"},"404":{"description":"Service request not found"},"500":{"description":"Server error"}}}}}}
```

## List comments on a service request

> Returns all comments for a specific service request

```json
{"openapi":"3.0.3","info":{"title":"Kaana Service Requests API","version":"1.0.0"},"tags":[{"name":"Service Requests","description":"Service request management operations"}],"servers":[{"url":"/api","description":"API base path"}],"security":[{"sessionAuth":[]}],"components":{"securitySchemes":{"sessionAuth":{"type":"apiKey","in":"cookie","name":"connect.sid","description":"Session-based authentication via HTTP-only cookie"}},"schemas":{"Comment":{"type":"object","required":["id","content","userId","createdAt","updatedAt"],"properties":{"id":{"type":"integer"},"content":{"type":"string"},"serviceRequestId":{"type":"integer","nullable":true},"userId":{"type":"integer"},"parentId":{"type":"integer","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"user":{"type":"object","properties":{"id":{"type":"integer"},"username":{"type":"string"},"fullName":{"type":"string"}}}}}}},"paths":{"/service-requests/{serviceRequestId}/comments":{"get":{"tags":["Service Requests"],"summary":"List comments on a service request","description":"Returns all comments for a specific service request","operationId":"listServiceRequestComments","parameters":[{"name":"serviceRequestId","in":"path","required":true,"description":"Service request ID","schema":{"type":"integer"}}],"responses":{"200":{"description":"List of comments","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Comment"}}}}},"401":{"description":"Not authenticated"},"500":{"description":"Server error"}}}}}}
```

## Add a comment to a service request

> Creates a new comment on a service request

```json
{"openapi":"3.0.3","info":{"title":"Kaana Service Requests API","version":"1.0.0"},"tags":[{"name":"Service Requests","description":"Service request management operations"}],"servers":[{"url":"/api","description":"API base path"}],"security":[{"sessionAuth":[]}],"components":{"securitySchemes":{"sessionAuth":{"type":"apiKey","in":"cookie","name":"connect.sid","description":"Session-based authentication via HTTP-only cookie"}},"schemas":{"Comment":{"type":"object","required":["id","content","userId","createdAt","updatedAt"],"properties":{"id":{"type":"integer"},"content":{"type":"string"},"serviceRequestId":{"type":"integer","nullable":true},"userId":{"type":"integer"},"parentId":{"type":"integer","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"user":{"type":"object","properties":{"id":{"type":"integer"},"username":{"type":"string"},"fullName":{"type":"string"}}}}}}},"paths":{"/service-requests/{serviceRequestId}/comments":{"post":{"tags":["Service Requests"],"summary":"Add a comment to a service request","description":"Creates a new comment on a service request","operationId":"createServiceRequestComment","parameters":[{"name":"serviceRequestId","in":"path","required":true,"description":"Service request ID","schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["content"],"properties":{"content":{"type":"string","description":"Comment content"},"parentId":{"type":"integer","nullable":true,"description":"Parent comment ID for replies"}}}}}},"responses":{"200":{"description":"Comment created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Comment"}}}},"401":{"description":"Not authenticated"},"403":{"description":"Permission denied"},"500":{"description":"Server error"}}}}}}
```
