Platform API

<back to all web services

GetLists

Get specified lists and list items

Requires Authentication
The following routes are available for this service:
All Verbs/api/lists/
<?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 ListItemModel implements JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $ListItemId='',
        /** @var string|null */
        public ?string $Name=null,
        /** @var string|null */
        public ?string $Description=null,
        /** @var string|null */
        public ?string $ShortName=null,
        /** @var bool|null */
        public ?bool $IsDefault=null,
        /** @var int */
        public int $Order=0,
        /** @var string */
        public string $ListItemTrafficLightId='',
        /** @var string */
        public string $PrimaryListItemImageId='',
        /** @var string|null */
        public ?string $PrimaryListItemImageUrl=null,
        /** @var string|null */
        public ?string $PrimaryImageThumbnailUrl=null,
        /** @var string */
        public string $OwnerContactId='',
        /** @var string|null */
        public ?string $RecordStatus=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['ListItemId'])) $this->ListItemId = $o['ListItemId'];
        if (isset($o['Name'])) $this->Name = $o['Name'];
        if (isset($o['Description'])) $this->Description = $o['Description'];
        if (isset($o['ShortName'])) $this->ShortName = $o['ShortName'];
        if (isset($o['IsDefault'])) $this->IsDefault = $o['IsDefault'];
        if (isset($o['Order'])) $this->Order = $o['Order'];
        if (isset($o['ListItemTrafficLightId'])) $this->ListItemTrafficLightId = $o['ListItemTrafficLightId'];
        if (isset($o['PrimaryListItemImageId'])) $this->PrimaryListItemImageId = $o['PrimaryListItemImageId'];
        if (isset($o['PrimaryListItemImageUrl'])) $this->PrimaryListItemImageUrl = $o['PrimaryListItemImageUrl'];
        if (isset($o['PrimaryImageThumbnailUrl'])) $this->PrimaryImageThumbnailUrl = $o['PrimaryImageThumbnailUrl'];
        if (isset($o['OwnerContactId'])) $this->OwnerContactId = $o['OwnerContactId'];
        if (isset($o['RecordStatus'])) $this->RecordStatus = $o['RecordStatus'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->ListItemId)) $o['ListItemId'] = $this->ListItemId;
        if (isset($this->Name)) $o['Name'] = $this->Name;
        if (isset($this->Description)) $o['Description'] = $this->Description;
        if (isset($this->ShortName)) $o['ShortName'] = $this->ShortName;
        if (isset($this->IsDefault)) $o['IsDefault'] = $this->IsDefault;
        if (isset($this->Order)) $o['Order'] = $this->Order;
        if (isset($this->ListItemTrafficLightId)) $o['ListItemTrafficLightId'] = $this->ListItemTrafficLightId;
        if (isset($this->PrimaryListItemImageId)) $o['PrimaryListItemImageId'] = $this->PrimaryListItemImageId;
        if (isset($this->PrimaryListItemImageUrl)) $o['PrimaryListItemImageUrl'] = $this->PrimaryListItemImageUrl;
        if (isset($this->PrimaryImageThumbnailUrl)) $o['PrimaryImageThumbnailUrl'] = $this->PrimaryImageThumbnailUrl;
        if (isset($this->OwnerContactId)) $o['OwnerContactId'] = $this->OwnerContactId;
        if (isset($this->RecordStatus)) $o['RecordStatus'] = $this->RecordStatus;
        return empty($o) ? new class(){} : $o;
    }
}

class ListModel implements JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $ListId='',
        /** @var string|null */
        public ?string $Name=null,
        /** @var string|null */
        public ?string $Description=null,
        /** @var string|null */
        public ?string $ShortName=null,
        /** @var string */
        public string $OwnerContactId='',
        /** @var bool|null */
        public ?bool $IsStandard=null,
        /** @var string|null */
        public ?string $RecordStatus=null,
        /** @var string */
        public string $DefaultListItemId='',
        /** @var string|null */
        public ?string $DefaultListItemName=null,
        /** @var bool|null */
        public ?bool $HasImageForListItem=null,
        /** @var bool|null */
        public ?bool $HasTrafficLightForListItem=null,
        /** @var array<ListItemModel>|null */
        public ?array $ListItems=null,
        /** @var bool|null */
        public ?bool $PermissionEdit=null,
        /** @var bool|null */
        public ?bool $PermissionAdd=null,
        /** @var bool|null */
        public ?bool $PermissionDelete=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['ListId'])) $this->ListId = $o['ListId'];
        if (isset($o['Name'])) $this->Name = $o['Name'];
        if (isset($o['Description'])) $this->Description = $o['Description'];
        if (isset($o['ShortName'])) $this->ShortName = $o['ShortName'];
        if (isset($o['OwnerContactId'])) $this->OwnerContactId = $o['OwnerContactId'];
        if (isset($o['IsStandard'])) $this->IsStandard = $o['IsStandard'];
        if (isset($o['RecordStatus'])) $this->RecordStatus = $o['RecordStatus'];
        if (isset($o['DefaultListItemId'])) $this->DefaultListItemId = $o['DefaultListItemId'];
        if (isset($o['DefaultListItemName'])) $this->DefaultListItemName = $o['DefaultListItemName'];
        if (isset($o['HasImageForListItem'])) $this->HasImageForListItem = $o['HasImageForListItem'];
        if (isset($o['HasTrafficLightForListItem'])) $this->HasTrafficLightForListItem = $o['HasTrafficLightForListItem'];
        if (isset($o['ListItems'])) $this->ListItems = JsonConverters::fromArray('ListItemModel', $o['ListItems']);
        if (isset($o['PermissionEdit'])) $this->PermissionEdit = $o['PermissionEdit'];
        if (isset($o['PermissionAdd'])) $this->PermissionAdd = $o['PermissionAdd'];
        if (isset($o['PermissionDelete'])) $this->PermissionDelete = $o['PermissionDelete'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->ListId)) $o['ListId'] = $this->ListId;
        if (isset($this->Name)) $o['Name'] = $this->Name;
        if (isset($this->Description)) $o['Description'] = $this->Description;
        if (isset($this->ShortName)) $o['ShortName'] = $this->ShortName;
        if (isset($this->OwnerContactId)) $o['OwnerContactId'] = $this->OwnerContactId;
        if (isset($this->IsStandard)) $o['IsStandard'] = $this->IsStandard;
        if (isset($this->RecordStatus)) $o['RecordStatus'] = $this->RecordStatus;
        if (isset($this->DefaultListItemId)) $o['DefaultListItemId'] = $this->DefaultListItemId;
        if (isset($this->DefaultListItemName)) $o['DefaultListItemName'] = $this->DefaultListItemName;
        if (isset($this->HasImageForListItem)) $o['HasImageForListItem'] = $this->HasImageForListItem;
        if (isset($this->HasTrafficLightForListItem)) $o['HasTrafficLightForListItem'] = $this->HasTrafficLightForListItem;
        if (isset($this->ListItems)) $o['ListItems'] = JsonConverters::toArray('ListItemModel', $this->ListItems);
        if (isset($this->PermissionEdit)) $o['PermissionEdit'] = $this->PermissionEdit;
        if (isset($this->PermissionAdd)) $o['PermissionAdd'] = $this->PermissionAdd;
        if (isset($this->PermissionDelete)) $o['PermissionDelete'] = $this->PermissionDelete;
        return empty($o) ? new class(){} : $o;
    }
}

// @ApiResponse(Description="List and list items")
class GetListResponse implements JsonSerializable
{
    public function __construct(
        /** @var ListModel|null */
        public ?ListModel $List=null,
        /** @var ResponseStatus|null */
        public ?ResponseStatus $ResponseStatus=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['List'])) $this->List = JsonConverters::from('ListModel', $o['List']);
        if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->List)) $o['List'] = JsonConverters::to('ListModel', $this->List);
        if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
        return empty($o) ? new class(){} : $o;
    }
}

/** @description Get specified lists and list items */
// @Api(Description="Get specified lists and list items")
class GetLists implements JsonSerializable
{
    public function __construct(
        /** @description Get list and list items for the specified list ids */
        // @ApiMember(Description="Get list and list items for the specified list ids", Name="ListIds")
        /** @var array<string>|null */
        public ?array $ListIds=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['ListIds'])) $this->ListIds = JsonConverters::fromArray('Guid', $o['ListIds']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->ListIds)) $o['ListIds'] = JsonConverters::toArray('Guid', $this->ListIds);
        return empty($o) ? new class(){} : $o;
    }
}

PHP GetLists DTOs

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

HTTP + JSV

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

POST /api/lists/ HTTP/1.1 
Host: pfapi.pstpf.com.au 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	ListIds: 
	[
		00000000-0000-0000-0000-000000000000
	]
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	List: 
	{
		Name: String,
		Description: String,
		ShortName: String,
		IsStandard: False,
		RecordStatus: String,
		DefaultListItemName: String,
		HasImageForListItem: False,
		HasTrafficLightForListItem: False,
		ListItems: 
		[
			{
				Name: String,
				Description: String,
				ShortName: String,
				IsDefault: False,
				Order: 0,
				PrimaryListItemImageUrl: String,
				PrimaryImageThumbnailUrl: String,
				RecordStatus: String
			}
		],
		PermissionEdit: False,
		PermissionAdd: False,
		PermissionDelete: False
	},
	ResponseStatus: 
	{
		ErrorCode: String,
		Message: String,
		StackTrace: String,
		Errors: 
		[
			{
				ErrorCode: String,
				FieldName: String,
				Message: String,
				Meta: 
				{
					String: String
				}
			}
		],
		Meta: 
		{
			String: String
		}
	}
}