digitaluapi

<back to all web services

GetApiKeysRequest

Requires Authentication
Requires any of the roles:Client, Admin, Partner
The following routes are available for this service:
GET/auth/apikeys
GET/auth/apikeys/{Environment}
<?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 UserApiKey implements IMeta, JsonSerializable
{
    public function __construct(
        // @DataMember(Order=1)
        /** @var string|null */
        public ?string $Key=null,

        // @DataMember(Order=2)
        /** @var string|null */
        public ?string $KeyType=null,

        // @DataMember(Order=3)
        /** @var DateTime|null */
        public ?DateTime $ExpiryDate=null,

        // @DataMember(Order=4)
        /** @var array<string,string>|null */
        public ?array $Meta=null
    ) {
    }

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

// @DataContract
class GetApiKeysResponse implements IMeta, JsonSerializable
{
    public function __construct(
        // @DataMember(Order=1)
        /** @var array<UserApiKey>|null */
        public ?array $Results=null,

        // @DataMember(Order=2)
        /** @var array<string,string>|null */
        public ?array $Meta=null,

        // @DataMember(Order=3)
        /** @var ResponseStatus|null */
        public ?ResponseStatus $ResponseStatus=null
    ) {
    }

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

class GetApiKeysRequest implements JsonSerializable
{
    public function __construct(
        /** @description Environment type */
        // @ApiMember(Description="Environment type")
        /** @var string|null */
        public ?string $Environment=null
    ) {
    }

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

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

GET /auth/apikeys HTTP/1.1 
Host: duengageapi.uat.scadsoftware.com 
Accept: application/xml
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<GetApiKeysResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.servicestack.net/types">
  <Results>
    <UserApiKey>
      <Key>String</Key>
      <KeyType>String</KeyType>
      <ExpiryDate>0001-01-01T00:00:00</ExpiryDate>
      <Meta xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
        <d4p1:KeyValueOfstringstring>
          <d4p1:Key>String</d4p1:Key>
          <d4p1:Value>String</d4p1:Value>
        </d4p1:KeyValueOfstringstring>
      </Meta>
    </UserApiKey>
  </Results>
  <Meta xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
    <d2p1:KeyValueOfstringstring>
      <d2p1:Key>String</d2p1:Key>
      <d2p1:Value>String</d2p1:Value>
    </d2p1:KeyValueOfstringstring>
  </Meta>
  <ResponseStatus>
    <ErrorCode>String</ErrorCode>
    <Message>String</Message>
    <StackTrace>String</StackTrace>
    <Errors>
      <ResponseError>
        <ErrorCode>String</ErrorCode>
        <FieldName>String</FieldName>
        <Message>String</Message>
        <Meta xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
          <d5p1:KeyValueOfstringstring>
            <d5p1:Key>String</d5p1:Key>
            <d5p1:Value>String</d5p1:Value>
          </d5p1:KeyValueOfstringstring>
        </Meta>
      </ResponseError>
    </Errors>
    <Meta xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
      <d3p1:KeyValueOfstringstring>
        <d3p1:Key>String</d3p1:Key>
        <d3p1:Value>String</d3p1:Value>
      </d3p1:KeyValueOfstringstring>
    </Meta>
  </ResponseStatus>
</GetApiKeysResponse>