| Requires any of the roles: | Agent, Administrator, Agent, Administrator, Agent, Administrator, Agent, Administrator |
| GET | /v1/Products/{UserID} | ||
|---|---|---|---|
| GET,POST,PUT,DELETE,OPTIONS | /v1/Products/ |
<?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};
class Product implements JsonSerializable
{
public function __construct(
/** @var int */
public int $ID=0,
/** @var string|null */
public ?string $ProductName=null,
/** @var int */
public int $ProductTypeID=0,
/** @var float */
public float $UnitPrice=0.0,
/** @var string|null */
public ?string $Description=null,
/** @var string|null */
public ?string $ImageURL=null,
/** @var string|null */
public ?string $ImageKey=null,
/** @var string|null */
public ?string $SpecialSaleText=null,
/** @var float */
public float $ShipPrice=0.0,
/** @var float */
public float $SalePrice=0.0,
/** @var string */
public string $UID='',
/** @var int */
public int $ProductCategory=0,
/** @var int */
public int $ProductSubCategory=0,
/** @var float */
public float $ProductWeight=0.0,
/** @var float */
public float $FreightMarkupPercent=0.0,
/** @var float */
public float $FreightMarkUpAmount=0.0,
/** @var float */
public float $PointValue=0.0,
/** @var bool|null */
public ?bool $IsActive=null,
/** @var string|null */
public ?string $StripeProductId=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ID'])) $this->ID = $o['ID'];
if (isset($o['ProductName'])) $this->ProductName = $o['ProductName'];
if (isset($o['ProductTypeID'])) $this->ProductTypeID = $o['ProductTypeID'];
if (isset($o['UnitPrice'])) $this->UnitPrice = $o['UnitPrice'];
if (isset($o['Description'])) $this->Description = $o['Description'];
if (isset($o['ImageURL'])) $this->ImageURL = $o['ImageURL'];
if (isset($o['ImageKey'])) $this->ImageKey = $o['ImageKey'];
if (isset($o['SpecialSaleText'])) $this->SpecialSaleText = $o['SpecialSaleText'];
if (isset($o['ShipPrice'])) $this->ShipPrice = $o['ShipPrice'];
if (isset($o['SalePrice'])) $this->SalePrice = $o['SalePrice'];
if (isset($o['UID'])) $this->UID = $o['UID'];
if (isset($o['ProductCategory'])) $this->ProductCategory = $o['ProductCategory'];
if (isset($o['ProductSubCategory'])) $this->ProductSubCategory = $o['ProductSubCategory'];
if (isset($o['ProductWeight'])) $this->ProductWeight = $o['ProductWeight'];
if (isset($o['FreightMarkupPercent'])) $this->FreightMarkupPercent = $o['FreightMarkupPercent'];
if (isset($o['FreightMarkUpAmount'])) $this->FreightMarkUpAmount = $o['FreightMarkUpAmount'];
if (isset($o['PointValue'])) $this->PointValue = $o['PointValue'];
if (isset($o['IsActive'])) $this->IsActive = $o['IsActive'];
if (isset($o['StripeProductId'])) $this->StripeProductId = $o['StripeProductId'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ID)) $o['ID'] = $this->ID;
if (isset($this->ProductName)) $o['ProductName'] = $this->ProductName;
if (isset($this->ProductTypeID)) $o['ProductTypeID'] = $this->ProductTypeID;
if (isset($this->UnitPrice)) $o['UnitPrice'] = $this->UnitPrice;
if (isset($this->Description)) $o['Description'] = $this->Description;
if (isset($this->ImageURL)) $o['ImageURL'] = $this->ImageURL;
if (isset($this->ImageKey)) $o['ImageKey'] = $this->ImageKey;
if (isset($this->SpecialSaleText)) $o['SpecialSaleText'] = $this->SpecialSaleText;
if (isset($this->ShipPrice)) $o['ShipPrice'] = $this->ShipPrice;
if (isset($this->SalePrice)) $o['SalePrice'] = $this->SalePrice;
if (isset($this->UID)) $o['UID'] = $this->UID;
if (isset($this->ProductCategory)) $o['ProductCategory'] = $this->ProductCategory;
if (isset($this->ProductSubCategory)) $o['ProductSubCategory'] = $this->ProductSubCategory;
if (isset($this->ProductWeight)) $o['ProductWeight'] = $this->ProductWeight;
if (isset($this->FreightMarkupPercent)) $o['FreightMarkupPercent'] = $this->FreightMarkupPercent;
if (isset($this->FreightMarkUpAmount)) $o['FreightMarkUpAmount'] = $this->FreightMarkUpAmount;
if (isset($this->PointValue)) $o['PointValue'] = $this->PointValue;
if (isset($this->IsActive)) $o['IsActive'] = $this->IsActive;
if (isset($this->StripeProductId)) $o['StripeProductId'] = $this->StripeProductId;
return empty($o) ? new class(){} : $o;
}
}
class ProductsResponse implements JsonSerializable
{
public function __construct(
/** @var ResponseStatus|null */
public ?ResponseStatus $ResponseStatus=null,
/** @var array<Product>|null */
public ?array $Products=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
if (isset($o['Products'])) $this->Products = JsonConverters::fromArray('Product', $o['Products']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
if (isset($this->Products)) $o['Products'] = JsonConverters::toArray('Product', $this->Products);
return empty($o) ? new class(){} : $o;
}
}
class ProductsRequest implements JsonSerializable
{
public function __construct(
/** @var string */
public string $UserID='',
/** @var array<Product>|null */
public ?array $Products=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['UserID'])) $this->UserID = $o['UserID'];
if (isset($o['Products'])) $this->Products = JsonConverters::fromArray('Product', $o['Products']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->UserID)) $o['UserID'] = $this->UserID;
if (isset($this->Products)) $o['Products'] = JsonConverters::toArray('Product', $this->Products);
return empty($o) ? new class(){} : $o;
}
}
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 /v1/Products/ HTTP/1.1
Host: api.dev.dynamics.trendsic.com
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<ProductsRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
<Products>
<Product>
<Description>String</Description>
<FreightMarkUpAmount>0</FreightMarkUpAmount>
<FreightMarkupPercent>0</FreightMarkupPercent>
<ID>0</ID>
<ImageKey>String</ImageKey>
<ImageURL>String</ImageURL>
<IsActive>false</IsActive>
<PointValue>0</PointValue>
<ProductCategory>0</ProductCategory>
<ProductName>String</ProductName>
<ProductSubCategory>0</ProductSubCategory>
<ProductTypeID>0</ProductTypeID>
<ProductWeight>0</ProductWeight>
<SalePrice>0</SalePrice>
<ShipPrice>0</ShipPrice>
<SpecialSaleText>String</SpecialSaleText>
<StripeProductId>String</StripeProductId>
<UID>00000000-0000-0000-0000-000000000000</UID>
<UnitPrice>0</UnitPrice>
</Product>
</Products>
<UserID>00000000-0000-0000-0000-000000000000</UserID>
</ProductsRequest>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length
<ProductsResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
<Products>
<Product>
<Description>String</Description>
<FreightMarkUpAmount>0</FreightMarkUpAmount>
<FreightMarkupPercent>0</FreightMarkupPercent>
<ID>0</ID>
<ImageKey>String</ImageKey>
<ImageURL>String</ImageURL>
<IsActive>false</IsActive>
<PointValue>0</PointValue>
<ProductCategory>0</ProductCategory>
<ProductName>String</ProductName>
<ProductSubCategory>0</ProductSubCategory>
<ProductTypeID>0</ProductTypeID>
<ProductWeight>0</ProductWeight>
<SalePrice>0</SalePrice>
<ShipPrice>0</ShipPrice>
<SpecialSaleText>String</SpecialSaleText>
<StripeProductId>String</StripeProductId>
<UID>00000000-0000-0000-0000-000000000000</UID>
<UnitPrice>0</UnitPrice>
</Product>
</Products>
<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>
</ProductsResponse>