Server

<back to all web services

GetCustomerUsers

Users
Requires Authentication
The following routes are available for this service:
GET/api/v1/users/{CustomerGuid}
<?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};


// @DataContract
class User implements JsonSerializable
{
    public function __construct(
        // @DataMember
        // @ApiMember(IsRequired=true)
        /** @var string */
        public string $userName='',

        // @DataMember
        /** @var string|null */
        public ?string $password=null,

        // @DataMember
        /** @var string|null */
        public ?string $isConfirmed=null,

        // @DataMember
        /** @var string|null */
        public ?string $id=null,

        // @DataMember
        /** @var string|null */
        public ?string $role=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['userName'])) $this->userName = $o['userName'];
        if (isset($o['password'])) $this->password = $o['password'];
        if (isset($o['isConfirmed'])) $this->isConfirmed = $o['isConfirmed'];
        if (isset($o['id'])) $this->id = $o['id'];
        if (isset($o['role'])) $this->role = $o['role'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->userName)) $o['userName'] = $this->userName;
        if (isset($this->password)) $o['password'] = $this->password;
        if (isset($this->isConfirmed)) $o['isConfirmed'] = $this->isConfirmed;
        if (isset($this->id)) $o['id'] = $this->id;
        if (isset($this->role)) $o['role'] = $this->role;
        return empty($o) ? new class(){} : $o;
    }
}

class GetCustomerUsersResponse implements JsonSerializable
{
    public function __construct(
        /** @var ResponseStatus|null */
        public ?ResponseStatus $responseStatus=null,
        /** @var array<User>|null */
        public ?array $users=null
    ) {
    }

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

class GetCustomerUsers implements IHasBearerToken, JsonSerializable
{
    public function __construct(
        // @ApiMember(IsRequired=true, ParameterType="query")
        /** @var string */
        public string $bearerToken='',

        // @ApiMember(IsRequired=true, ParameterType="path")
        /** @var string */
        public string $customerGuid=''
    ) {
    }

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

PHP GetCustomerUsers 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.

GET /api/v1/users/{CustomerGuid} HTTP/1.1 
Host: heat-syke-servdesk.eras-online.de 
Accept: text/jsv
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
		}
	},
	users: 
	[
		{
			userName: String,
			password: String,
			isConfirmed: String,
			id: String,
			role: String
		}
	]
}