Requires the role: | superadmin |
POST | /superadmin/support/cases | Add a new support case | Add a new support case to the company of the currently logged in user, only administrators are allowed to add support cases. |
---|
import datetime
import decimal
from marshmallow.fields import *
from servicestack import *
from typing import *
from dataclasses import dataclass, field
from dataclasses_json import dataclass_json, LetterCase, Undefined, config
from enum import Enum, IntEnum
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class SupportCaseStatusResponse:
# @ApiMember(Description="The status id")
id: int = 0
"""
The status id
"""
# @ApiMember(Description="The status name")
name: Optional[str] = None
"""
The status name
"""
# @ApiMember(Description="The status description")
description: Optional[str] = None
"""
The status description
"""
# @ApiMember(Description="The status icon")
icon: Optional[str] = None
"""
The status icon
"""
# @ApiMember(Description="The status color")
color: Optional[str] = None
"""
The status color
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class SupportCaseTypeResponse:
# @ApiMember(Description="The type id")
id: int = 0
"""
The type id
"""
# @ApiMember(Description="The type name")
name: Optional[str] = None
"""
The type name
"""
# @ApiMember(Description="The type description")
description: Optional[str] = None
"""
The type description
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class SupportCaseAreaResponse:
# @ApiMember(Description="The area id")
id: int = 0
"""
The area id
"""
# @ApiMember(Description="The area name")
name: Optional[str] = None
"""
The area name
"""
# @ApiMember(Description="The area description")
description: Optional[str] = None
"""
The area description
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class SupportCaseCommentsResponse:
# @ApiMember(Description="The case id")
support_case_id: int = 0
"""
The case id
"""
# @ApiMember(Description="The comments id")
id: int = 0
"""
The comments id
"""
# @ApiMember(Description="The case comment")
comment: Optional[str] = None
"""
The case comment
"""
# @ApiMember(Description="The case comment created by")
created_by: Optional[str] = None
"""
The case comment created by
"""
# @ApiMember(Description="The case comment created date")
created: datetime.datetime = datetime.datetime(1, 1, 1)
"""
The case comment created date
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class SupportCaseAttachmentResponse:
# @ApiMember(Description="The attachment id")
id: int = 0
"""
The attachment id
"""
# @ApiMember(Description="The attachment file url")
file_url: Optional[str] = None
"""
The attachment file url
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class SupportCaseQueryResponse:
# @ApiMember(Description="The support case id")
id: int = 0
"""
The support case id
"""
# @ApiMember(Description="The company user id")
company_user_id: Optional[str] = None
"""
The company user id
"""
# @ApiMember(Description="The case title.")
title: Optional[str] = None
"""
The case title.
"""
# @ApiMember(Description="The case description.")
description: Optional[str] = None
"""
The case description.
"""
# @ApiMember(Description="The case status id.")
case_status_id: int = 0
"""
The case status id.
"""
# @ApiMember(Description="If the case type id.")
case_type_id: int = 0
"""
If the case type id.
"""
# @ApiMember(Description="If the case area id.")
case_area_id: int = 0
"""
If the case area id.
"""
# @ApiMember(Description="The case created by.")
created_by: Optional[str] = None
"""
The case created by.
"""
# @ApiMember(Description="The case updated by.")
updated_by: Optional[str] = None
"""
The case updated by.
"""
# @ApiMember(Description="The case solved by.")
solved_by: Optional[str] = None
"""
The case solved by.
"""
# @ApiMember(Description="If case updated date.")
updated: datetime.datetime = datetime.datetime(1, 1, 1)
"""
If case updated date.
"""
# @ApiMember(Description="If case created date.")
created: datetime.datetime = datetime.datetime(1, 1, 1)
"""
If case created date.
"""
# @ApiMember(Description="Who owns the support case.")
case_owner: Optional[str] = None
"""
Who owns the support case.
"""
# @ApiMember(Description="The case status information.")
case_status: Optional[SupportCaseStatusResponse] = None
"""
The case status information.
"""
# @ApiMember(Description="The case type information.")
case_type: Optional[SupportCaseTypeResponse] = None
"""
The case type information.
"""
# @ApiMember(Description="The case area information.")
case_area: Optional[SupportCaseAreaResponse] = None
"""
The case area information.
"""
# @ApiMember(Description="The case comments.")
comments: Optional[List[SupportCaseCommentsResponse]] = None
"""
The case comments.
"""
# @ApiMember(Description="The case attachments.")
attachments: Optional[List[SupportCaseAttachmentResponse]] = None
"""
The case attachments.
"""
# @ApiMember(Description="The case status options to select from.")
case_status_options: Optional[List[SupportCaseStatusResponse]] = None
"""
The case status options to select from.
"""
# @ApiMember(Description="The case type options to select from.")
case_type_options: Optional[List[SupportCaseTypeResponse]] = None
"""
The case type options to select from.
"""
# @ApiMember(Description="The case area options to select from.")
case_area_options: Optional[List[SupportCaseAreaResponse]] = None
"""
The case area options to select from.
"""
# @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
# @ApiResponse(Description="You have too low privilegies to call this service", StatusCode=403)
# @ValidateRequest(Validator="IsAuthenticated")
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class SuperAdminCreateSupportCase(ICompany):
# @ApiMember(Description="Enter the company id, if blank company id and you are an admin, your company id will be used.", IsRequired=true)
company_id: Optional[str] = None
"""
Enter the company id, if blank company id and you are an admin, your company id will be used.
"""
# @ApiMember(Description="The case title.")
title: Optional[str] = None
"""
The case title.
"""
# @ApiMember(Description="The case description.")
description: Optional[str] = None
"""
The case description.
"""
# @ApiMember(Description="If the case type id.")
case_type_id: int = 0
"""
If the case type id.
"""
# @ApiMember(Description="If the case area id.")
case_area_id: int = 0
"""
If the case area id.
"""
Python SuperAdminCreateSupportCase DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /superadmin/support/cases HTTP/1.1
Host: api.bokamera.se
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<SuperAdminCreateSupportCase xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos">
<CaseAreaId>0</CaseAreaId>
<CaseTypeId>0</CaseTypeId>
<CompanyId>00000000-0000-0000-0000-000000000000</CompanyId>
<Description>String</Description>
<Title>String</Title>
</SuperAdminCreateSupportCase>
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <SupportCaseQueryResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos"> <Attachments> <SupportCaseAttachmentResponse> <FileUrl>String</FileUrl> <Id>0</Id> </SupportCaseAttachmentResponse> </Attachments> <CaseArea> <Description>String</Description> <Id>0</Id> <Name>String</Name> </CaseArea> <CaseAreaId>0</CaseAreaId> <CaseAreaOptions> <SupportCaseAreaResponse> <Description>String</Description> <Id>0</Id> <Name>String</Name> </SupportCaseAreaResponse> </CaseAreaOptions> <CaseOwner>String</CaseOwner> <CaseStatus> <Color>String</Color> <Description>String</Description> <Icon>String</Icon> <Id>0</Id> <Name>String</Name> </CaseStatus> <CaseStatusId>0</CaseStatusId> <CaseStatusOptions> <SupportCaseStatusResponse> <Color>String</Color> <Description>String</Description> <Icon>String</Icon> <Id>0</Id> <Name>String</Name> </SupportCaseStatusResponse> </CaseStatusOptions> <CaseType> <Description>String</Description> <Id>0</Id> <Name>String</Name> </CaseType> <CaseTypeId>0</CaseTypeId> <CaseTypeOptions> <SupportCaseTypeResponse> <Description>String</Description> <Id>0</Id> <Name>String</Name> </SupportCaseTypeResponse> </CaseTypeOptions> <Comments> <SupportCaseCommentsResponse> <Comment>String</Comment> <Created>0001-01-01T00:00:00</Created> <CreatedBy>String</CreatedBy> <Id>0</Id> <SupportCaseId>0</SupportCaseId> </SupportCaseCommentsResponse> </Comments> <CompanyUserId>00000000-0000-0000-0000-000000000000</CompanyUserId> <Created>0001-01-01T00:00:00</Created> <CreatedBy>String</CreatedBy> <Description>String</Description> <Id>0</Id> <SolvedBy>String</SolvedBy> <Title>String</Title> <Updated>0001-01-01T00:00:00</Updated> <UpdatedBy>String</UpdatedBy> </SupportCaseQueryResponse>