| Required roles: | Administrator, Administrator, Administrator | Requires any of the roles: | Worker, Agent, Administrator |
| GET,POST,PUT,DELETE,OPTIONS | /v1/Locations/{Id} | ||
|---|---|---|---|
| GET,POST,PUT,DELETE,OPTIONS | /v1/Locations |
<?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 Location implements JsonSerializable
{
public function __construct(
/** @var string */
public string $Id='',
/** @var string */
public string $ClientId='',
/** @var string|null */
public ?string $Name=null,
/** @var string|null */
public ?string $Address1=null,
/** @var string|null */
public ?string $Address2=null,
/** @var string|null */
public ?string $City=null,
/** @var string|null */
public ?string $State=null,
/** @var string|null */
public ?string $Zip=null,
/** @var string|null */
public ?string $Phone=null,
/** @var string|null */
public ?string $Fax=null,
/** @var string|null */
public ?string $TimeZone=null,
/** @var bool|null */
public ?bool $Active=null,
/** @var DateTime */
public DateTime $EntDate=new DateTime(),
/** @var DateTime */
public DateTime $ModDate=new DateTime()
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Id'])) $this->Id = $o['Id'];
if (isset($o['ClientId'])) $this->ClientId = $o['ClientId'];
if (isset($o['Name'])) $this->Name = $o['Name'];
if (isset($o['Address1'])) $this->Address1 = $o['Address1'];
if (isset($o['Address2'])) $this->Address2 = $o['Address2'];
if (isset($o['City'])) $this->City = $o['City'];
if (isset($o['State'])) $this->State = $o['State'];
if (isset($o['Zip'])) $this->Zip = $o['Zip'];
if (isset($o['Phone'])) $this->Phone = $o['Phone'];
if (isset($o['Fax'])) $this->Fax = $o['Fax'];
if (isset($o['TimeZone'])) $this->TimeZone = $o['TimeZone'];
if (isset($o['Active'])) $this->Active = $o['Active'];
if (isset($o['EntDate'])) $this->EntDate = JsonConverters::from('DateTime', $o['EntDate']);
if (isset($o['ModDate'])) $this->ModDate = JsonConverters::from('DateTime', $o['ModDate']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Id)) $o['Id'] = $this->Id;
if (isset($this->ClientId)) $o['ClientId'] = $this->ClientId;
if (isset($this->Name)) $o['Name'] = $this->Name;
if (isset($this->Address1)) $o['Address1'] = $this->Address1;
if (isset($this->Address2)) $o['Address2'] = $this->Address2;
if (isset($this->City)) $o['City'] = $this->City;
if (isset($this->State)) $o['State'] = $this->State;
if (isset($this->Zip)) $o['Zip'] = $this->Zip;
if (isset($this->Phone)) $o['Phone'] = $this->Phone;
if (isset($this->Fax)) $o['Fax'] = $this->Fax;
if (isset($this->TimeZone)) $o['TimeZone'] = $this->TimeZone;
if (isset($this->Active)) $o['Active'] = $this->Active;
if (isset($this->EntDate)) $o['EntDate'] = JsonConverters::to('DateTime', $this->EntDate);
if (isset($this->ModDate)) $o['ModDate'] = JsonConverters::to('DateTime', $this->ModDate);
return empty($o) ? new class(){} : $o;
}
}
class LocationsResponse implements JsonSerializable
{
public function __construct(
/** @var ResponseStatus|null */
public ?ResponseStatus $ResponseStatus=null,
/** @var array<Location>|null */
public ?array $Locations=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
if (isset($o['Locations'])) $this->Locations = JsonConverters::fromArray('Location', $o['Locations']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
if (isset($this->Locations)) $o['Locations'] = JsonConverters::toArray('Location', $this->Locations);
return empty($o) ? new class(){} : $o;
}
}
class LocationsRequest implements JsonSerializable
{
public function __construct(
/** @var string */
public string $Id='',
/** @var array<Location>|null */
public ?array $Locations=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Id'])) $this->Id = $o['Id'];
if (isset($o['Locations'])) $this->Locations = JsonConverters::fromArray('Location', $o['Locations']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Id)) $o['Id'] = $this->Id;
if (isset($this->Locations)) $o['Locations'] = JsonConverters::toArray('Location', $this->Locations);
return empty($o) ? new class(){} : $o;
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /v1/Locations/{Id} HTTP/1.1
Host: api.dev.dynamics.trendsic.com
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
Id: 00000000000000000000000000000000,
Locations:
[
{
Id: 00000000000000000000000000000000,
ClientId: 00000000000000000000000000000000,
Name: String,
Address1: String,
Address2: String,
City: String,
State: String,
Zip: String,
Phone: String,
Fax: String,
TimeZone: String,
Active: False,
EntDate: 0001-01-01,
ModDate: 0001-01-01
}
]
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
ResponseStatus:
{
ErrorCode: String,
Message: String,
StackTrace: String,
Errors:
[
{
ErrorCode: String,
FieldName: String,
Message: String,
Meta:
{
String: String
}
}
],
Meta:
{
String: String
}
},
Locations:
[
{
Id: 00000000000000000000000000000000,
ClientId: 00000000000000000000000000000000,
Name: String,
Address1: String,
Address2: String,
City: String,
State: String,
Zip: String,
Phone: String,
Fax: String,
TimeZone: String,
Active: False,
EntDate: 0001-01-01,
ModDate: 0001-01-01
}
]
}