Mercedes.Auth.API

<back to all web services

Authorisation

The following routes are available for this service:
POST/v1/authorisation
<?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 AuthorisationResponse implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $status=null,
        /** @var string|null */
        public ?string $GasUserId=null,
        /** @var string|null */
        public ?string $Application=null,
        /** @var array<string>|null */
        public ?array $Roles=null,
        /** @var array<string>|null */
        public ?array $GSSNRetailerIds=null,
        /** @var string|null */
        public ?string $DefaultGSSNRetailerId=null,
        /** @var string|null */
        public ?string $DefaultVehicleType=null,
        /** @var string|null */
        public ?string $DefaultRole=null,
        /** @var int */
        public int $DefaultRoleCount=0
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['status'])) $this->status = $o['status'];
        if (isset($o['GasUserId'])) $this->GasUserId = $o['GasUserId'];
        if (isset($o['Application'])) $this->Application = $o['Application'];
        if (isset($o['Roles'])) $this->Roles = JsonConverters::fromArray('string', $o['Roles']);
        if (isset($o['GSSNRetailerIds'])) $this->GSSNRetailerIds = JsonConverters::fromArray('string', $o['GSSNRetailerIds']);
        if (isset($o['DefaultGSSNRetailerId'])) $this->DefaultGSSNRetailerId = $o['DefaultGSSNRetailerId'];
        if (isset($o['DefaultVehicleType'])) $this->DefaultVehicleType = $o['DefaultVehicleType'];
        if (isset($o['DefaultRole'])) $this->DefaultRole = $o['DefaultRole'];
        if (isset($o['DefaultRoleCount'])) $this->DefaultRoleCount = $o['DefaultRoleCount'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->status)) $o['status'] = $this->status;
        if (isset($this->GasUserId)) $o['GasUserId'] = $this->GasUserId;
        if (isset($this->Application)) $o['Application'] = $this->Application;
        if (isset($this->Roles)) $o['Roles'] = JsonConverters::toArray('string', $this->Roles);
        if (isset($this->GSSNRetailerIds)) $o['GSSNRetailerIds'] = JsonConverters::toArray('string', $this->GSSNRetailerIds);
        if (isset($this->DefaultGSSNRetailerId)) $o['DefaultGSSNRetailerId'] = $this->DefaultGSSNRetailerId;
        if (isset($this->DefaultVehicleType)) $o['DefaultVehicleType'] = $this->DefaultVehicleType;
        if (isset($this->DefaultRole)) $o['DefaultRole'] = $this->DefaultRole;
        if (isset($this->DefaultRoleCount)) $o['DefaultRoleCount'] = $this->DefaultRoleCount;
        return empty($o) ? new class(){} : $o;
    }
}

class Authorisation implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $GasUserId=null,
        /** @var array<string>|null */
        public ?array $ApplicationDotRole=null,
        /** @var array<string>|null */
        public ?array $GEMSOutletId=null,
        /** @var string|null */
        public ?string $Application=null
    ) {
    }

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

PHP Authorisation DTOs

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

To embed the response in a jsonp callback, append ?callback=myCallback

HTTP + JSON

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

POST /v1/authorisation HTTP/1.1 
Host: prod-api-auth-mb-dhc.rapp-customers.co.uk 
Accept: application/json
Content-Type: application/json
Content-Length: length

{"GasUserId":"String","ApplicationDotRole":["String"],"GEMSOutletId":["String"],"Application":"String"}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"status":"String","GasUserId":"String","Application":"String","Roles":["String"],"GSSNRetailerIds":["String"],"DefaultGSSNRetailerId":"String","DefaultVehicleType":"String","DefaultRole":"String","DefaultRoleCount":0}