CoreService

<back to all web services

GetUserNote

UserNote - CRUD

Returns a single user note

Requires Authentication
Required roles:TenantReader, TenantReader
The following routes are available for this service:
GET/api/usernotes/{Id}Returns a single user note
GET/usernotes/{Id}Returns a single user note
<?php namespace dtos;

use DateTime;
use Exception;
use DateInterval;
use JsonSerializable;
use ServiceStack\{IReturn,IReturnVoid,IGet,IPost,IPut,IDelete,IPatch,IMeta,IHasSessionId,IHasBearerToken,IHasVersion};
use ServiceStack\{ICrud,ICreateDb,IUpdateDb,IPatchDb,IDeleteDb,ISaveDb,AuditBase,QueryDb,QueryDb2,QueryData,QueryData2,QueryResponse};
use ServiceStack\{ResponseStatus,ResponseError,EmptyResponse,IdResponse,ArrayList,KeyValuePair2,StringResponse,StringsResponse,Tuple2,Tuple3,ByteArray};
use ServiceStack\{JsonConverters,Returns,TypeContext};


enum ObjectTypes : string
{
    case None = 'None';
    case ConfigItem = 'ConfigItem';
    case Tenant = 'Tenant';
    case Collection = 'Collection';
    case Resource = 'Resource';
    case ComputeNode = 'ComputeNode';
    case VirtualMachine = 'VirtualMachine';
    case PhysicalMachine = 'PhysicalMachine';
    case Disk = 'Disk';
    case Subnet = 'Subnet';
    case IPAddress = 'IPAddress';
    case Job = 'Job';
    case JobEvent = 'JobEvent';
    case FreezePeriod = 'FreezePeriod';
    case ResourceGroup = 'ResourceGroup';
    case Deployment = 'Deployment';
    case ResourceGroupTemplate = 'ResourceGroupTemplate';
    case DeploymentTemplate = 'DeploymentTemplate';
    case ResourceProvider = 'ResourceProvider';
    case GenericResource = 'GenericResource';
    case Role = 'Role';
    case Permission = 'Permission';
    case User = 'User';
    case PatchingWindow = 'PatchingWindow';
    case Update = 'Update';
    case ReportDefinition = 'ReportDefinition';
    case TimeSeries = 'TimeSeries';
    case DataPoint = 'DataPoint';
    case Action = 'Action';
    case ActionAssignment = 'ActionAssignment';
    case UserNote = 'UserNote';
}

class UserNoteDto implements JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $id='',
        /** @var string */
        public string $message='',
        /** @var string */
        public string $configItemId='',
        /** @var ObjectTypes|null */
        public ?ObjectTypes $configItemType=null,
        /** @var string */
        public string $configItemName='',
        /** @var string */
        public string $tenantId='',
        /** @var DateTime */
        public DateTime $created=new DateTime(),
        /** @var string */
        public string $createUser='',
        /** @var string */
        public string $createUserId='',
        /** @var DateTime */
        public DateTime $modified=new DateTime(),
        /** @var string */
        public string $modifyUser='',
        /** @var string */
        public string $modifyUserId='',
        /** @var string */
        public string $selfLink='',
        /** @var ObjectTypes|null */
        public ?ObjectTypes $objectType=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['id'])) $this->id = $o['id'];
        if (isset($o['message'])) $this->message = $o['message'];
        if (isset($o['configItemId'])) $this->configItemId = $o['configItemId'];
        if (isset($o['configItemType'])) $this->configItemType = JsonConverters::from('ObjectTypes', $o['configItemType']);
        if (isset($o['configItemName'])) $this->configItemName = $o['configItemName'];
        if (isset($o['tenantId'])) $this->tenantId = $o['tenantId'];
        if (isset($o['created'])) $this->created = JsonConverters::from('DateTime', $o['created']);
        if (isset($o['createUser'])) $this->createUser = $o['createUser'];
        if (isset($o['createUserId'])) $this->createUserId = $o['createUserId'];
        if (isset($o['modified'])) $this->modified = JsonConverters::from('DateTime', $o['modified']);
        if (isset($o['modifyUser'])) $this->modifyUser = $o['modifyUser'];
        if (isset($o['modifyUserId'])) $this->modifyUserId = $o['modifyUserId'];
        if (isset($o['selfLink'])) $this->selfLink = $o['selfLink'];
        if (isset($o['objectType'])) $this->objectType = JsonConverters::from('ObjectTypes', $o['objectType']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->id)) $o['id'] = $this->id;
        if (isset($this->message)) $o['message'] = $this->message;
        if (isset($this->configItemId)) $o['configItemId'] = $this->configItemId;
        if (isset($this->configItemType)) $o['configItemType'] = JsonConverters::to('ObjectTypes', $this->configItemType);
        if (isset($this->configItemName)) $o['configItemName'] = $this->configItemName;
        if (isset($this->tenantId)) $o['tenantId'] = $this->tenantId;
        if (isset($this->created)) $o['created'] = JsonConverters::to('DateTime', $this->created);
        if (isset($this->createUser)) $o['createUser'] = $this->createUser;
        if (isset($this->createUserId)) $o['createUserId'] = $this->createUserId;
        if (isset($this->modified)) $o['modified'] = JsonConverters::to('DateTime', $this->modified);
        if (isset($this->modifyUser)) $o['modifyUser'] = $this->modifyUser;
        if (isset($this->modifyUserId)) $o['modifyUserId'] = $this->modifyUserId;
        if (isset($this->selfLink)) $o['selfLink'] = $this->selfLink;
        if (isset($this->objectType)) $o['objectType'] = JsonConverters::to('ObjectTypes', $this->objectType);
        return empty($o) ? new class(){} : $o;
    }
}

/** @description Returns a single user note */
// @Api(Description="Returns a single user note")
// @ApiResponse(Description="Ok", ResponseType="typeof(CoreService.ServiceModel.Dtos.Notes.Responses.UserNoteDto)", StatusCode=200)
class GetUserNote implements IBaseRequest, IHasTenantName, IGet, JsonSerializable
{
    public function __construct(
        /** @description The id of the user note */
        // @ApiMember(DataType="string", Description="The id of the user note", Format="guid", IsRequired=true, ParameterType="path")
        /** @var string */
        public string $id='',

        // @ApiMember(DataType="string", IsRequired=true, ParameterType="header")
        // @Validate(Validator="NotEmpty")
        /** @var string */
        public string $tenantName=''
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['id'])) $this->id = $o['id'];
        if (isset($o['tenantName'])) $this->tenantName = $o['tenantName'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->id)) $o['id'] = $this->id;
        if (isset($this->tenantName)) $o['tenantName'] = $this->tenantName;
        return empty($o) ? new class(){} : $o;
    }
}

PHP GetUserNote 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.

GET /api/usernotes/{Id} HTTP/1.1 
Host: core.starburst.svc 
Accept: application/json
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"}