digitaluapi

<back to all web services

CompaniesAdd

Requires Authentication
Requires any of the roles:Client, Admin, Partner
The following routes are available for this service:
POST/companies
<?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 CompaniesAddResponse implements JsonSerializable
{
    public function __construct(
        // @DataMember(Order=2)
        /** @var string|null */
        public ?string $Name=null,

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

        // @DataMember(Order=4)
        /** @var int|null */
        public ?int $CountriesId=null,

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

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

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

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

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

        // @DataMember(Order=10)
        /** @var float|null */
        public ?float $SalesTaxPercentage=null,

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

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

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

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

        // @DataMember(Order=15)
        /** @var int */
        public int $CurrenciesId=0,

        // @DataMember(Order=16)
        /** @var int */
        public int $StatusCodesId=0,

        // @DataMember(Order=17)
        /** @var float|null */
        public ?float $Lat=null,

        // @DataMember(Order=18)
        /** @var float|null */
        public ?float $Lng=null,

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

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Name'])) $this->Name = $o['Name'];
        if (isset($o['RegNo'])) $this->RegNo = $o['RegNo'];
        if (isset($o['CountriesId'])) $this->CountriesId = $o['CountriesId'];
        if (isset($o['State'])) $this->State = $o['State'];
        if (isset($o['City'])) $this->City = $o['City'];
        if (isset($o['StreetAddress'])) $this->StreetAddress = $o['StreetAddress'];
        if (isset($o['Zip'])) $this->Zip = $o['Zip'];
        if (isset($o['TaxNo'])) $this->TaxNo = $o['TaxNo'];
        if (isset($o['SalesTaxPercentage'])) $this->SalesTaxPercentage = $o['SalesTaxPercentage'];
        if (isset($o['Email'])) $this->Email = $o['Email'];
        if (isset($o['Website'])) $this->Website = $o['Website'];
        if (isset($o['PhoneNumber'])) $this->PhoneNumber = $o['PhoneNumber'];
        if (isset($o['LogoUrl'])) $this->LogoUrl = $o['LogoUrl'];
        if (isset($o['CurrenciesId'])) $this->CurrenciesId = $o['CurrenciesId'];
        if (isset($o['StatusCodesId'])) $this->StatusCodesId = $o['StatusCodesId'];
        if (isset($o['Lat'])) $this->Lat = $o['Lat'];
        if (isset($o['Lng'])) $this->Lng = $o['Lng'];
        if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Name)) $o['Name'] = $this->Name;
        if (isset($this->RegNo)) $o['RegNo'] = $this->RegNo;
        if (isset($this->CountriesId)) $o['CountriesId'] = $this->CountriesId;
        if (isset($this->State)) $o['State'] = $this->State;
        if (isset($this->City)) $o['City'] = $this->City;
        if (isset($this->StreetAddress)) $o['StreetAddress'] = $this->StreetAddress;
        if (isset($this->Zip)) $o['Zip'] = $this->Zip;
        if (isset($this->TaxNo)) $o['TaxNo'] = $this->TaxNo;
        if (isset($this->SalesTaxPercentage)) $o['SalesTaxPercentage'] = $this->SalesTaxPercentage;
        if (isset($this->Email)) $o['Email'] = $this->Email;
        if (isset($this->Website)) $o['Website'] = $this->Website;
        if (isset($this->PhoneNumber)) $o['PhoneNumber'] = $this->PhoneNumber;
        if (isset($this->LogoUrl)) $o['LogoUrl'] = $this->LogoUrl;
        if (isset($this->CurrenciesId)) $o['CurrenciesId'] = $this->CurrenciesId;
        if (isset($this->StatusCodesId)) $o['StatusCodesId'] = $this->StatusCodesId;
        if (isset($this->Lat)) $o['Lat'] = $this->Lat;
        if (isset($this->Lng)) $o['Lng'] = $this->Lng;
        if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
        return empty($o) ? new class(){} : $o;
    }
}

// @DataContract
class CompaniesAdd implements JsonSerializable
{
    public function __construct(
        // @DataMember(Order=2)
        /** @var string|null */
        public ?string $Name=null,

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

        // @DataMember(Order=4)
        /** @var int|null */
        public ?int $CountriesId=null,

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

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

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

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

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

        // @DataMember(Order=10)
        /** @var float|null */
        public ?float $SalesTaxPercentage=null,

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

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

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

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

        // @DataMember(Order=15)
        // @Validate(Validator="NotNull")
        /** @var int */
        public int $CurrenciesId=0,

        // @DataMember(Order=16)
        // @Validate(Validator="NotNull")
        /** @var int */
        public int $StatusCodesId=0,

        // @DataMember(Order=17)
        /** @var float|null */
        public ?float $Lat=null,

        // @DataMember(Order=18)
        /** @var float|null */
        public ?float $Lng=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Name'])) $this->Name = $o['Name'];
        if (isset($o['RegNo'])) $this->RegNo = $o['RegNo'];
        if (isset($o['CountriesId'])) $this->CountriesId = $o['CountriesId'];
        if (isset($o['State'])) $this->State = $o['State'];
        if (isset($o['City'])) $this->City = $o['City'];
        if (isset($o['StreetAddress'])) $this->StreetAddress = $o['StreetAddress'];
        if (isset($o['Zip'])) $this->Zip = $o['Zip'];
        if (isset($o['TaxNo'])) $this->TaxNo = $o['TaxNo'];
        if (isset($o['SalesTaxPercentage'])) $this->SalesTaxPercentage = $o['SalesTaxPercentage'];
        if (isset($o['Email'])) $this->Email = $o['Email'];
        if (isset($o['Website'])) $this->Website = $o['Website'];
        if (isset($o['PhoneNumber'])) $this->PhoneNumber = $o['PhoneNumber'];
        if (isset($o['LogoUrl'])) $this->LogoUrl = $o['LogoUrl'];
        if (isset($o['CurrenciesId'])) $this->CurrenciesId = $o['CurrenciesId'];
        if (isset($o['StatusCodesId'])) $this->StatusCodesId = $o['StatusCodesId'];
        if (isset($o['Lat'])) $this->Lat = $o['Lat'];
        if (isset($o['Lng'])) $this->Lng = $o['Lng'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Name)) $o['Name'] = $this->Name;
        if (isset($this->RegNo)) $o['RegNo'] = $this->RegNo;
        if (isset($this->CountriesId)) $o['CountriesId'] = $this->CountriesId;
        if (isset($this->State)) $o['State'] = $this->State;
        if (isset($this->City)) $o['City'] = $this->City;
        if (isset($this->StreetAddress)) $o['StreetAddress'] = $this->StreetAddress;
        if (isset($this->Zip)) $o['Zip'] = $this->Zip;
        if (isset($this->TaxNo)) $o['TaxNo'] = $this->TaxNo;
        if (isset($this->SalesTaxPercentage)) $o['SalesTaxPercentage'] = $this->SalesTaxPercentage;
        if (isset($this->Email)) $o['Email'] = $this->Email;
        if (isset($this->Website)) $o['Website'] = $this->Website;
        if (isset($this->PhoneNumber)) $o['PhoneNumber'] = $this->PhoneNumber;
        if (isset($this->LogoUrl)) $o['LogoUrl'] = $this->LogoUrl;
        if (isset($this->CurrenciesId)) $o['CurrenciesId'] = $this->CurrenciesId;
        if (isset($this->StatusCodesId)) $o['StatusCodesId'] = $this->StatusCodesId;
        if (isset($this->Lat)) $o['Lat'] = $this->Lat;
        if (isset($this->Lng)) $o['Lng'] = $this->Lng;
        return empty($o) ? new class(){} : $o;
    }
}

PHP CompaniesAdd 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 /companies HTTP/1.1 
Host: duengageapi.uat.scadsoftware.com 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<CompaniesAdd xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/digitaluapi.ServiceModel">
  <Name>String</Name>
  <RegNo>String</RegNo>
  <CountriesId>0</CountriesId>
  <State>String</State>
  <City>String</City>
  <StreetAddress>String</StreetAddress>
  <Zip>String</Zip>
  <TaxNo>String</TaxNo>
  <SalesTaxPercentage>0</SalesTaxPercentage>
  <Email>String</Email>
  <Website>String</Website>
  <PhoneNumber>String</PhoneNumber>
  <LogoUrl>String</LogoUrl>
  <CurrenciesId>0</CurrenciesId>
  <StatusCodesId>0</StatusCodesId>
  <Lat>0</Lat>
  <Lng>0</Lng>
</CompaniesAdd>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<CompaniesAddResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/digitaluapi.ServiceModel">
  <City>String</City>
  <CountriesId>0</CountriesId>
  <CurrenciesId>0</CurrenciesId>
  <Email>String</Email>
  <Lat>0</Lat>
  <Lng>0</Lng>
  <LogoUrl>String</LogoUrl>
  <Name>String</Name>
  <PhoneNumber>String</PhoneNumber>
  <RegNo>String</RegNo>
  <ResponseStatus xmlns:d2p1="http://schemas.servicestack.net/types">
    <d2p1:ErrorCode>String</d2p1:ErrorCode>
    <d2p1:Message>String</d2p1:Message>
    <d2p1:StackTrace>String</d2p1:StackTrace>
    <d2p1:Errors>
      <d2p1:ResponseError>
        <d2p1:ErrorCode>String</d2p1:ErrorCode>
        <d2p1:FieldName>String</d2p1:FieldName>
        <d2p1:Message>String</d2p1:Message>
        <d2p1: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>
        </d2p1:Meta>
      </d2p1:ResponseError>
    </d2p1:Errors>
    <d2p1: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>
    </d2p1:Meta>
  </ResponseStatus>
  <SalesTaxPercentage>0</SalesTaxPercentage>
  <State>String</State>
  <StatusCodesId>0</StatusCodesId>
  <StreetAddress>String</StreetAddress>
  <TaxNo>String</TaxNo>
  <Website>String</Website>
  <Zip>String</Zip>
</CompaniesAddResponse>