Trendsic Platform Service

<back to all web services

MaterialRequest

Requires Authentication
The following routes are available for this service:
GET,POST,PUT,DELETE,OPTIONS/v1/Material/{MaterialID}
GET,POST,PUT,DELETE,OPTIONS/v1/Material
import 'package:servicestack/servicestack.dart';
import 'dart:typed_data';

class Project implements IConvertible
{
    int? ProjectID;
    String? ProjectUID;
    String? ProjectName;
    String? ImageURL;
    String? ImageKey;
    String? ClientName;
    String? ClientPhone;
    String? ClientEmail;
    int? ProjectManagerID;
    String? ProjectManagerName;
    DateTime? StartDate;
    DateTime? EndDate;
    DateTime? ActualStartDate;
    DateTime? ActualEndDate;
    int? JobCount;
    int? CrewMemberCount;
    int? EquipmentCount;
    int? MaterialCount;
    int? ProjectStatusID;
    String? ProjectStatusDescription;
    double? Budget;
    double? CostToDate;
    String? ProjectLocation;
    String? ProjectType;
    String? ProjectSponsor;
    String? CreatedBy;
    DateTime? CreatedAt;
    DateTime? UpdatedAt;
    String? ProjectDescription;
    String? Scope;
    int? StatusId;

    Project({this.ProjectID,this.ProjectUID,this.ProjectName,this.ImageURL,this.ImageKey,this.ClientName,this.ClientPhone,this.ClientEmail,this.ProjectManagerID,this.ProjectManagerName,this.StartDate,this.EndDate,this.ActualStartDate,this.ActualEndDate,this.JobCount,this.CrewMemberCount,this.EquipmentCount,this.MaterialCount,this.ProjectStatusID,this.ProjectStatusDescription,this.Budget,this.CostToDate,this.ProjectLocation,this.ProjectType,this.ProjectSponsor,this.CreatedBy,this.CreatedAt,this.UpdatedAt,this.ProjectDescription,this.Scope,this.StatusId});
    Project.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        ProjectID = json['ProjectID'];
        ProjectUID = json['ProjectUID'];
        ProjectName = json['ProjectName'];
        ImageURL = json['ImageURL'];
        ImageKey = json['ImageKey'];
        ClientName = json['ClientName'];
        ClientPhone = json['ClientPhone'];
        ClientEmail = json['ClientEmail'];
        ProjectManagerID = json['ProjectManagerID'];
        ProjectManagerName = json['ProjectManagerName'];
        StartDate = JsonConverters.fromJson(json['StartDate'],'DateTime',context!);
        EndDate = JsonConverters.fromJson(json['EndDate'],'DateTime',context!);
        ActualStartDate = JsonConverters.fromJson(json['ActualStartDate'],'DateTime',context!);
        ActualEndDate = JsonConverters.fromJson(json['ActualEndDate'],'DateTime',context!);
        JobCount = json['JobCount'];
        CrewMemberCount = json['CrewMemberCount'];
        EquipmentCount = json['EquipmentCount'];
        MaterialCount = json['MaterialCount'];
        ProjectStatusID = json['ProjectStatusID'];
        ProjectStatusDescription = json['ProjectStatusDescription'];
        Budget = JsonConverters.toDouble(json['Budget']);
        CostToDate = JsonConverters.toDouble(json['CostToDate']);
        ProjectLocation = json['ProjectLocation'];
        ProjectType = json['ProjectType'];
        ProjectSponsor = json['ProjectSponsor'];
        CreatedBy = json['CreatedBy'];
        CreatedAt = JsonConverters.fromJson(json['CreatedAt'],'DateTime',context!);
        UpdatedAt = JsonConverters.fromJson(json['UpdatedAt'],'DateTime',context!);
        ProjectDescription = json['ProjectDescription'];
        Scope = json['Scope'];
        StatusId = json['StatusId'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'ProjectID': ProjectID,
        'ProjectUID': ProjectUID,
        'ProjectName': ProjectName,
        'ImageURL': ImageURL,
        'ImageKey': ImageKey,
        'ClientName': ClientName,
        'ClientPhone': ClientPhone,
        'ClientEmail': ClientEmail,
        'ProjectManagerID': ProjectManagerID,
        'ProjectManagerName': ProjectManagerName,
        'StartDate': JsonConverters.toJson(StartDate,'DateTime',context!),
        'EndDate': JsonConverters.toJson(EndDate,'DateTime',context!),
        'ActualStartDate': JsonConverters.toJson(ActualStartDate,'DateTime',context!),
        'ActualEndDate': JsonConverters.toJson(ActualEndDate,'DateTime',context!),
        'JobCount': JobCount,
        'CrewMemberCount': CrewMemberCount,
        'EquipmentCount': EquipmentCount,
        'MaterialCount': MaterialCount,
        'ProjectStatusID': ProjectStatusID,
        'ProjectStatusDescription': ProjectStatusDescription,
        'Budget': Budget,
        'CostToDate': CostToDate,
        'ProjectLocation': ProjectLocation,
        'ProjectType': ProjectType,
        'ProjectSponsor': ProjectSponsor,
        'CreatedBy': CreatedBy,
        'CreatedAt': JsonConverters.toJson(CreatedAt,'DateTime',context!),
        'UpdatedAt': JsonConverters.toJson(UpdatedAt,'DateTime',context!),
        'ProjectDescription': ProjectDescription,
        'Scope': Scope,
        'StatusId': StatusId
    };

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

class Material implements IConvertible
{
    int? MaterialID;
    String? MaterialName;
    int? MaterialTypeID;
    int? MaterialStatusID;
    int? Quantity;
    String? Supplier;
    DateTime? OrderDate;
    DateTime? DeliveryDate;
    DateTime? OnSiteDate;
    String? MaterialLocation;
    String? Manufacturer;
    String? SerialNumber;
    String? BarCode;
    String? TrackingInfo;
    String? MaterialDescription;
    String? Notes;
    String? ImageURL;
    String? DetailsURL;
    String? CreatedByUID;
    bool? Active;
    DateTime? RecordCreatedDate;
    int? StatusId;
    String? MaterialTypeName;
    double? Cost;
    List<Project>? Projects = [];

    Material({this.MaterialID,this.MaterialName,this.MaterialTypeID,this.MaterialStatusID,this.Quantity,this.Supplier,this.OrderDate,this.DeliveryDate,this.OnSiteDate,this.MaterialLocation,this.Manufacturer,this.SerialNumber,this.BarCode,this.TrackingInfo,this.MaterialDescription,this.Notes,this.ImageURL,this.DetailsURL,this.CreatedByUID,this.Active,this.RecordCreatedDate,this.StatusId,this.MaterialTypeName,this.Cost,this.Projects});
    Material.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        MaterialID = json['MaterialID'];
        MaterialName = json['MaterialName'];
        MaterialTypeID = json['MaterialTypeID'];
        MaterialStatusID = json['MaterialStatusID'];
        Quantity = json['Quantity'];
        Supplier = json['Supplier'];
        OrderDate = JsonConverters.fromJson(json['OrderDate'],'DateTime',context!);
        DeliveryDate = JsonConverters.fromJson(json['DeliveryDate'],'DateTime',context!);
        OnSiteDate = JsonConverters.fromJson(json['OnSiteDate'],'DateTime',context!);
        MaterialLocation = json['MaterialLocation'];
        Manufacturer = json['Manufacturer'];
        SerialNumber = json['SerialNumber'];
        BarCode = json['BarCode'];
        TrackingInfo = json['TrackingInfo'];
        MaterialDescription = json['MaterialDescription'];
        Notes = json['Notes'];
        ImageURL = json['ImageURL'];
        DetailsURL = json['DetailsURL'];
        CreatedByUID = json['CreatedByUID'];
        Active = json['Active'];
        RecordCreatedDate = JsonConverters.fromJson(json['RecordCreatedDate'],'DateTime',context!);
        StatusId = json['StatusId'];
        MaterialTypeName = json['MaterialTypeName'];
        Cost = JsonConverters.toDouble(json['Cost']);
        Projects = JsonConverters.fromJson(json['Projects'],'List<Project>',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'MaterialID': MaterialID,
        'MaterialName': MaterialName,
        'MaterialTypeID': MaterialTypeID,
        'MaterialStatusID': MaterialStatusID,
        'Quantity': Quantity,
        'Supplier': Supplier,
        'OrderDate': JsonConverters.toJson(OrderDate,'DateTime',context!),
        'DeliveryDate': JsonConverters.toJson(DeliveryDate,'DateTime',context!),
        'OnSiteDate': JsonConverters.toJson(OnSiteDate,'DateTime',context!),
        'MaterialLocation': MaterialLocation,
        'Manufacturer': Manufacturer,
        'SerialNumber': SerialNumber,
        'BarCode': BarCode,
        'TrackingInfo': TrackingInfo,
        'MaterialDescription': MaterialDescription,
        'Notes': Notes,
        'ImageURL': ImageURL,
        'DetailsURL': DetailsURL,
        'CreatedByUID': CreatedByUID,
        'Active': Active,
        'RecordCreatedDate': JsonConverters.toJson(RecordCreatedDate,'DateTime',context!),
        'StatusId': StatusId,
        'MaterialTypeName': MaterialTypeName,
        'Cost': Cost,
        'Projects': JsonConverters.toJson(Projects,'List<Project>',context!)
    };

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

class MaterialResponse implements IConvertible
{
    ResponseStatus? ResponseStatus;
    List<Material>? Material = [];

    MaterialResponse({this.ResponseStatus,this.Material});
    MaterialResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        ResponseStatus = JsonConverters.fromJson(json['ResponseStatus'],'ResponseStatus',context!);
        Material = JsonConverters.fromJson(json['Material'],'List<Material>',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'ResponseStatus': JsonConverters.toJson(ResponseStatus,'ResponseStatus',context!),
        'Material': JsonConverters.toJson(Material,'List<Material>',context!)
    };

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

class MaterialRequest implements IConvertible
{
    int? MaterialID;
    List<Material>? Material = [];

    MaterialRequest({this.MaterialID,this.Material});
    MaterialRequest.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        MaterialID = json['MaterialID'];
        Material = JsonConverters.fromJson(json['Material'],'List<Material>',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'MaterialID': MaterialID,
        'Material': JsonConverters.toJson(Material,'List<Material>',context!)
    };

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

TypeContext _ctx = TypeContext(library: 'api.dev.dynamics.trendsic.com', types: <String, TypeInfo> {
    'Project': TypeInfo(TypeOf.Class, create:() => Project()),
    'Material': TypeInfo(TypeOf.Class, create:() => Material()),
    'List<Project>': TypeInfo(TypeOf.Class, create:() => <Project>[]),
    'MaterialResponse': TypeInfo(TypeOf.Class, create:() => MaterialResponse()),
    'List<Material>': TypeInfo(TypeOf.Class, create:() => <Material>[]),
    'MaterialRequest': TypeInfo(TypeOf.Class, create:() => MaterialRequest()),
});

Dart MaterialRequest DTOs

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

HTTP + XML

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

POST /v1/Material/{MaterialID} HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<MaterialRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
  <Material>
    <Material>
      <Active>false</Active>
      <BarCode>String</BarCode>
      <Cost>0</Cost>
      <CreatedByUID>00000000-0000-0000-0000-000000000000</CreatedByUID>
      <DeliveryDate>0001-01-01T00:00:00</DeliveryDate>
      <DetailsURL>String</DetailsURL>
      <ImageURL>String</ImageURL>
      <Manufacturer>String</Manufacturer>
      <MaterialDescription>String</MaterialDescription>
      <MaterialID>0</MaterialID>
      <MaterialLocation>String</MaterialLocation>
      <MaterialName>String</MaterialName>
      <MaterialStatusID>0</MaterialStatusID>
      <MaterialTypeID>0</MaterialTypeID>
      <MaterialTypeName>String</MaterialTypeName>
      <Notes>String</Notes>
      <OnSiteDate>0001-01-01T00:00:00</OnSiteDate>
      <OrderDate>0001-01-01T00:00:00</OrderDate>
      <Projects>
        <Project>
          <ActualEndDate>0001-01-01T00:00:00</ActualEndDate>
          <ActualStartDate>0001-01-01T00:00:00</ActualStartDate>
          <Budget>0</Budget>
          <ClientEmail>String</ClientEmail>
          <ClientName>String</ClientName>
          <ClientPhone>String</ClientPhone>
          <CostToDate>0</CostToDate>
          <CreatedAt>0001-01-01T00:00:00</CreatedAt>
          <CreatedBy>String</CreatedBy>
          <CrewMemberCount>0</CrewMemberCount>
          <EndDate>0001-01-01T00:00:00</EndDate>
          <EquipmentCount>0</EquipmentCount>
          <ImageKey>String</ImageKey>
          <ImageURL>String</ImageURL>
          <JobCount>0</JobCount>
          <MaterialCount>0</MaterialCount>
          <ProjectDescription>String</ProjectDescription>
          <ProjectID>0</ProjectID>
          <ProjectLocation>String</ProjectLocation>
          <ProjectManagerID>0</ProjectManagerID>
          <ProjectManagerName>String</ProjectManagerName>
          <ProjectName>String</ProjectName>
          <ProjectSponsor>String</ProjectSponsor>
          <ProjectStatusDescription>String</ProjectStatusDescription>
          <ProjectStatusID>0</ProjectStatusID>
          <ProjectType>String</ProjectType>
          <ProjectUID>00000000-0000-0000-0000-000000000000</ProjectUID>
          <Scope>String</Scope>
          <StartDate>0001-01-01T00:00:00</StartDate>
          <StatusId>0</StatusId>
          <UpdatedAt>0001-01-01T00:00:00</UpdatedAt>
        </Project>
      </Projects>
      <Quantity>0</Quantity>
      <RecordCreatedDate>0001-01-01T00:00:00</RecordCreatedDate>
      <SerialNumber>String</SerialNumber>
      <StatusId>0</StatusId>
      <Supplier>String</Supplier>
      <TrackingInfo>String</TrackingInfo>
    </Material>
  </Material>
  <MaterialID>0</MaterialID>
</MaterialRequest>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<MaterialResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
  <Material>
    <Material>
      <Active>false</Active>
      <BarCode>String</BarCode>
      <Cost>0</Cost>
      <CreatedByUID>00000000-0000-0000-0000-000000000000</CreatedByUID>
      <DeliveryDate>0001-01-01T00:00:00</DeliveryDate>
      <DetailsURL>String</DetailsURL>
      <ImageURL>String</ImageURL>
      <Manufacturer>String</Manufacturer>
      <MaterialDescription>String</MaterialDescription>
      <MaterialID>0</MaterialID>
      <MaterialLocation>String</MaterialLocation>
      <MaterialName>String</MaterialName>
      <MaterialStatusID>0</MaterialStatusID>
      <MaterialTypeID>0</MaterialTypeID>
      <MaterialTypeName>String</MaterialTypeName>
      <Notes>String</Notes>
      <OnSiteDate>0001-01-01T00:00:00</OnSiteDate>
      <OrderDate>0001-01-01T00:00:00</OrderDate>
      <Projects>
        <Project>
          <ActualEndDate>0001-01-01T00:00:00</ActualEndDate>
          <ActualStartDate>0001-01-01T00:00:00</ActualStartDate>
          <Budget>0</Budget>
          <ClientEmail>String</ClientEmail>
          <ClientName>String</ClientName>
          <ClientPhone>String</ClientPhone>
          <CostToDate>0</CostToDate>
          <CreatedAt>0001-01-01T00:00:00</CreatedAt>
          <CreatedBy>String</CreatedBy>
          <CrewMemberCount>0</CrewMemberCount>
          <EndDate>0001-01-01T00:00:00</EndDate>
          <EquipmentCount>0</EquipmentCount>
          <ImageKey>String</ImageKey>
          <ImageURL>String</ImageURL>
          <JobCount>0</JobCount>
          <MaterialCount>0</MaterialCount>
          <ProjectDescription>String</ProjectDescription>
          <ProjectID>0</ProjectID>
          <ProjectLocation>String</ProjectLocation>
          <ProjectManagerID>0</ProjectManagerID>
          <ProjectManagerName>String</ProjectManagerName>
          <ProjectName>String</ProjectName>
          <ProjectSponsor>String</ProjectSponsor>
          <ProjectStatusDescription>String</ProjectStatusDescription>
          <ProjectStatusID>0</ProjectStatusID>
          <ProjectType>String</ProjectType>
          <ProjectUID>00000000-0000-0000-0000-000000000000</ProjectUID>
          <Scope>String</Scope>
          <StartDate>0001-01-01T00:00:00</StartDate>
          <StatusId>0</StatusId>
          <UpdatedAt>0001-01-01T00:00:00</UpdatedAt>
        </Project>
      </Projects>
      <Quantity>0</Quantity>
      <RecordCreatedDate>0001-01-01T00:00:00</RecordCreatedDate>
      <SerialNumber>String</SerialNumber>
      <StatusId>0</StatusId>
      <Supplier>String</Supplier>
      <TrackingInfo>String</TrackingInfo>
    </Material>
  </Material>
  <ResponseStatus xmlns:d2p1="http://schemas.servicestack.net/types">
    <d2p1:ErrorCode>String</d2p1:ErrorCode>
    <d2p1:Message>String</d2p1:Message>
    <d2p1:StackTrace>String</d2p1:StackTrace>
    <d2p1:Errors>
      <d2p1:ResponseError>
        <d2p1:ErrorCode>String</d2p1:ErrorCode>
        <d2p1:FieldName>String</d2p1:FieldName>
        <d2p1:Message>String</d2p1:Message>
        <d2p1:Meta xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
          <d5p1:KeyValueOfstringstring>
            <d5p1:Key>String</d5p1:Key>
            <d5p1:Value>String</d5p1:Value>
          </d5p1:KeyValueOfstringstring>
        </d2p1:Meta>
      </d2p1:ResponseError>
    </d2p1:Errors>
    <d2p1:Meta xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
      <d3p1:KeyValueOfstringstring>
        <d3p1:Key>String</d3p1:Key>
        <d3p1:Value>String</d3p1:Value>
      </d3p1:KeyValueOfstringstring>
    </d2p1:Meta>
  </ResponseStatus>
</MaterialResponse>