GET, POST | /configuration/objects/{ObjectIds}/devices |
---|
<?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 DeviceInfoEntity implements JsonSerializable
{
public function __construct(
/** @var int */
public int $id=0,
/** @var string|null */
public ?string $description=null,
/** @var string|null */
public ?string $name=null,
/** @var int */
public int $loadOrder=0,
/** @var string */
public string $nodeId='',
/** @var string|null */
public ?string $nodeName=null,
/** @var int */
public int $protocolId=0,
/** @var string|null */
public ?string $protocolName=null,
/** @var string|null */
public ?string $connectionString=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['id'])) $this->id = $o['id'];
if (isset($o['description'])) $this->description = $o['description'];
if (isset($o['name'])) $this->name = $o['name'];
if (isset($o['loadOrder'])) $this->loadOrder = $o['loadOrder'];
if (isset($o['nodeId'])) $this->nodeId = $o['nodeId'];
if (isset($o['nodeName'])) $this->nodeName = $o['nodeName'];
if (isset($o['protocolId'])) $this->protocolId = $o['protocolId'];
if (isset($o['protocolName'])) $this->protocolName = $o['protocolName'];
if (isset($o['connectionString'])) $this->connectionString = $o['connectionString'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->id)) $o['id'] = $this->id;
if (isset($this->description)) $o['description'] = $this->description;
if (isset($this->name)) $o['name'] = $this->name;
if (isset($this->loadOrder)) $o['loadOrder'] = $this->loadOrder;
if (isset($this->nodeId)) $o['nodeId'] = $this->nodeId;
if (isset($this->nodeName)) $o['nodeName'] = $this->nodeName;
if (isset($this->protocolId)) $o['protocolId'] = $this->protocolId;
if (isset($this->protocolName)) $o['protocolName'] = $this->protocolName;
if (isset($this->connectionString)) $o['connectionString'] = $this->connectionString;
return empty($o) ? new class(){} : $o;
}
}
class DeviceInfoGetResponse implements JsonSerializable
{
public function __construct(
/** @var array<string,DeviceInfoEntity>|null */
public ?array $devices=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['devices'])) $this->devices = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['int','DeviceInfoEntity']), $o['devices']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->devices)) $o['devices'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['int','DeviceInfoEntity']), $this->devices);
return empty($o) ? new class(){} : $o;
}
}
class DeviceInfoGetRequest implements JsonSerializable
{
public function __construct(
/** @var array<string>|null */
public ?array $objectIds=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['objectIds'])) $this->objectIds = JsonConverters::fromArray('string', $o['objectIds']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->objectIds)) $o['objectIds'] = JsonConverters::toArray('string', $this->objectIds);
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 /configuration/objects/{ObjectIds}/devices HTTP/1.1
Host: monitoring.ox2.com
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
objectIds:
[
String
]
}
HTTP/1.1 200 OK Content-Type: text/jsv Content-Length: length { devices: { 0: { id: 0, description: String, name: String, loadOrder: 0, nodeName: String, protocolId: 0, protocolName: String, connectionString: String } } }