CoreService

<back to all web services

CreateUserNote

UserNote - CRUD

Creates a user note on a deployment or resource

Requires Authentication
Required role:TenantReader
The following routes are available for this service:
POST/api/usernotesCreates a user note on a deployment or resource
POST/usernotesCreates a user note on a deployment or resource
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
Object = TypeVar('Object')


class ObjectTypes(str, Enum):
    NONE = 'None'
    CONFIG_ITEM = 'ConfigItem'
    TENANT = 'Tenant'
    COLLECTION = 'Collection'
    RESOURCE = 'Resource'
    COMPUTE_NODE = 'ComputeNode'
    VIRTUAL_MACHINE = 'VirtualMachine'
    PHYSICAL_MACHINE = 'PhysicalMachine'
    DISK = 'Disk'
    SUBNET = 'Subnet'
    IP_ADDRESS = 'IPAddress'
    JOB = 'Job'
    JOB_EVENT = 'JobEvent'
    FREEZE_PERIOD = 'FreezePeriod'
    RESOURCE_GROUP = 'ResourceGroup'
    DEPLOYMENT = 'Deployment'
    RESOURCE_GROUP_TEMPLATE = 'ResourceGroupTemplate'
    DEPLOYMENT_TEMPLATE = 'DeploymentTemplate'
    RESOURCE_PROVIDER = 'ResourceProvider'
    GENERIC_RESOURCE = 'GenericResource'
    ROLE = 'Role'
    PERMISSION = 'Permission'
    USER = 'User'
    PATCHING_WINDOW = 'PatchingWindow'
    UPDATE = 'Update'
    REPORT_DEFINITION = 'ReportDefinition'
    TIME_SERIES = 'TimeSeries'
    DATA_POINT = 'DataPoint'
    ACTION = 'Action'
    ACTION_ASSIGNMENT = 'ActionAssignment'
    USER_NOTE = 'UserNote'


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class UserNoteDto:
    id: Optional[str] = None
    message: Optional[str] = None
    config_item_id: Optional[str] = None
    config_item_type: Optional[ObjectTypes] = None
    config_item_name: Optional[str] = None
    tenant_id: Optional[str] = None
    created: datetime.datetime = datetime.datetime(1, 1, 1)
    create_user: Optional[str] = None
    create_user_id: Optional[str] = None
    modified: datetime.datetime = datetime.datetime(1, 1, 1)
    modify_user: Optional[str] = None
    modify_user_id: Optional[str] = None
    self_link: Optional[str] = None
    object_type: Optional[ObjectTypes] = None


# @Api(Description="Creates a user note on a deployment or resource")
# @ApiResponse(Description="Created", ResponseType=typeof(UserNoteDto), StatusCode=201)
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CreateUserNote(IBaseRequest, IHasTenantName, IPost):
    """
    Creates a user note on a deployment or resource
    """

    # @ApiMember(DataType="string", IsRequired=true, ParameterType="header")
    # @Validate(Validator="NotEmpty")
    tenant_name: Optional[str] = None

    # @ApiMember(DataType="string", Description="The id of the deployment or resource the note is attached to", Format="guid", IsRequired=true, ParameterType="body")
    config_item_id: Optional[str] = None
    """
    The id of the deployment or resource the note is attached to
    """


    # @ApiMember(Description="The type of the config item (Deployment or a Resource type)", IsRequired=true, ParameterType="body")
    # @Validate(Validator="NotNull")
    config_item_type: Optional[ObjectTypes] = None
    """
    The type of the config item (Deployment or a Resource type)
    """


    # @ApiMember(DataType="string", Description="The note text (max 1000 chars)", IsRequired=true, ParameterType="body")
    # @Validate(Validator="NotEmpty")
    # @Validate(Validator="MaximumLength(1000)")
    message: Optional[str] = None
    """
    The note text (max 1000 chars)
    """

Python CreateUserNote DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .json suffix or ?format=json

To embed the response in a jsonp callback, append ?callback=myCallback

HTTP + JSON

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /api/usernotes HTTP/1.1 
Host: core.starburst.svc 
Accept: application/json
Content-Type: application/json
Content-Length: length

{"tenantName":"String","configItemId":"00000000-0000-0000-0000-000000000000","configItemType":"None","message":"String","txId":"00000000-0000-0000-0000-000000000000"}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"id":"00000000-0000-0000-0000-000000000000","message":"String","configItemId":"00000000-0000-0000-0000-000000000000","configItemType":"None","configItemName":"String","tenantId":"00000000-0000-0000-0000-000000000000","created":"0001-01-01T00:00:00.0000000Z","createUser":"String","createUserId":"String","modified":"0001-01-01T00:00:00.0000000Z","modifyUser":"String","modifyUserId":"String","selfLink":"/usernotes/00000000-0000-0000-0000-000000000000","objectType":"UserNote"}