INTERNAL-Authorization

<back to all web services

GetAuthorizationPost

Requires Authentication
The following routes are available for this service:
POST/authorization
<?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 GetAuthorizationResponse implements JsonSerializable
{
    public function __construct(
        /** @var bool|null */
        public ?bool $isAuthorized=null,
        /** @var array<string,string>|null */
        public ?array $parameters=null,
        /** @var string|null */
        public ?string $userObjectId=null,
        /** @var string|null */
        public ?string $userTenant=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['isAuthorized'])) $this->isAuthorized = $o['isAuthorized'];
        if (isset($o['parameters'])) $this->parameters = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['string','string']), $o['parameters']);
        if (isset($o['userObjectId'])) $this->userObjectId = $o['userObjectId'];
        if (isset($o['userTenant'])) $this->userTenant = $o['userTenant'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->isAuthorized)) $o['isAuthorized'] = $this->isAuthorized;
        if (isset($this->parameters)) $o['parameters'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['string','string']), $this->parameters);
        if (isset($this->userObjectId)) $o['userObjectId'] = $this->userObjectId;
        if (isset($this->userTenant)) $o['userTenant'] = $this->userTenant;
        return empty($o) ? new class(){} : $o;
    }
}

class GetAuthorizationPost implements IGetAuthorization, JsonSerializable
{
    public function __construct(
        // @ApiMember()
        /** @var string|null */
        public ?string $serviceName=null,

        // @ApiMember()
        /** @var string|null */
        public ?string $tokenString=null,

        // @ApiMember()
        /** @var string|null */
        public ?string $userTokenString=null,

        // @ApiMember()
        /** @var string|null */
        public ?string $profile=null
    ) {
    }

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

PHP GetAuthorizationPost DTOs

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

HTTP + XML

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

POST /authorization HTTP/1.1 
Host: nkapi-sgepz3-auth-r1.azurewebsites.net 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<GetAuthorizationPost xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Norkart.Api.Authorization.ServiceModel">
  <Profile>String</Profile>
  <ServiceName>String</ServiceName>
  <TokenString>String</TokenString>
  <UserTokenString>String</UserTokenString>
</GetAuthorizationPost>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<GetAuthorizationResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Norkart.Api.Authorization.ServiceModel">
  <IsAuthorized>false</IsAuthorized>
  <Parameters xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
    <d2p1:KeyValueOfstringstring>
      <d2p1:Key>String</d2p1:Key>
      <d2p1:Value>String</d2p1:Value>
    </d2p1:KeyValueOfstringstring>
  </Parameters>
  <UserObjectId i:nil="true" />
  <UserTenant>String</UserTenant>
</GetAuthorizationResponse>