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 'package:servicestack/servicestack.dart';

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

class UserNoteDto implements IConvertible
{
    String id = "";
    String message = "";
    String configItemId = "";
    ObjectTypes configItemType;
    String configItemName = "";
    String tenantId = "";
    DateTime created = DateTime(0);
    String createUser = "";
    String createUserId = "";
    DateTime modified = DateTime(0);
    String modifyUser = "";
    String modifyUserId = "";
    String selfLink = "";
    ObjectTypes objectType;

    UserNoteDto({this.id,this.message,this.configItemId,this.configItemType,this.configItemName,this.tenantId,this.created,this.createUser,this.createUserId,this.modified,this.modifyUser,this.modifyUserId,this.selfLink,this.objectType});
    UserNoteDto.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        id = json['id'];
        message = json['message'];
        configItemId = json['configItemId'];
        configItemType = JsonConverters.fromJson(json['configItemType'],'ObjectTypes',context!);
        configItemName = json['configItemName'];
        tenantId = json['tenantId'];
        created = JsonConverters.fromJson(json['created'],'DateTime',context!);
        createUser = json['createUser'];
        createUserId = json['createUserId'];
        modified = JsonConverters.fromJson(json['modified'],'DateTime',context!);
        modifyUser = json['modifyUser'];
        modifyUserId = json['modifyUserId'];
        selfLink = json['selfLink'];
        objectType = JsonConverters.fromJson(json['objectType'],'ObjectTypes',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'id': id,
        'message': message,
        'configItemId': configItemId,
        'configItemType': JsonConverters.toJson(configItemType,'ObjectTypes',context!),
        'configItemName': configItemName,
        'tenantId': tenantId,
        'created': JsonConverters.toJson(created,'DateTime',context!),
        'createUser': createUser,
        'createUserId': createUserId,
        'modified': JsonConverters.toJson(modified,'DateTime',context!),
        'modifyUser': modifyUser,
        'modifyUserId': modifyUserId,
        'selfLink': selfLink,
        'objectType': JsonConverters.toJson(objectType,'ObjectTypes',context!)
    };

    getTypeName() => "UserNoteDto";
    TypeContext? context = _ctx;
}

/**
* Creates a user note on a deployment or resource
*/
// @Api(Description="Creates a user note on a deployment or resource")
// @ApiResponse(Description="Created", ResponseType=typeof(UserNoteDto), StatusCode=201)
class CreateUserNote implements IBaseRequest, IHasTenantName, IPost, IConvertible
{
    // @ApiMember(DataType="string", IsRequired=true, ParameterType="header")
    // @Validate(Validator="NotEmpty")
    String tenantName = "";

    /**
    * The id of the deployment or resource the note is attached to
    */
    // @ApiMember(DataType="string", Description="The id of the deployment or resource the note is attached to", Format="guid", IsRequired=true, ParameterType="body")
    String configItemId = "";

    /**
    * The type of the config item (Deployment or a Resource type)
    */
    // @ApiMember(Description="The type of the config item (Deployment or a Resource type)", IsRequired=true, ParameterType="body")
    // @Validate(Validator="NotNull")
    ObjectTypes configItemType;

    /**
    * The note text (max 1000 chars)
    */
    // @ApiMember(DataType="string", Description="The note text (max 1000 chars)", IsRequired=true, ParameterType="body")
    // @Validate(Validator="NotEmpty")
    // @Validate(Validator="MaximumLength(1000)")
    String message = "";

    CreateUserNote({this.tenantName,this.configItemId,this.configItemType,this.message});
    CreateUserNote.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        tenantName = json['tenantName'];
        configItemId = json['configItemId'];
        configItemType = JsonConverters.fromJson(json['configItemType'],'ObjectTypes',context!);
        message = json['message'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'tenantName': tenantName,
        'configItemId': configItemId,
        'configItemType': JsonConverters.toJson(configItemType,'ObjectTypes',context!),
        'message': message
    };

    getTypeName() => "CreateUserNote";
    TypeContext? context = _ctx;
}

TypeContext _ctx = TypeContext(library: 'duneframework.com', types: <String, TypeInfo> {
    'ObjectTypes': TypeInfo(TypeOf.Enum, enumValues:ObjectTypes.values),
    'UserNoteDto': TypeInfo(TypeOf.Class, create:() => UserNoteDto()),
    'CreateUserNote': TypeInfo(TypeOf.Class, create:() => CreateUserNote()),
});

Dart 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"}