Requires any of the roles: | SystemAdministrator, Manager, Customer |
POST | /addresses |
---|
<?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 AddressInfo implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $id=null,
/** @var string|null */
public ?string $friendlyName=null,
/** @var bool|null */
public ?bool $emergencyEnabled=null,
/** @var string|null */
public ?string $customerName=null,
/** @var string|null */
public ?string $street=null,
/** @var string|null */
public ?string $city=null,
/** @var string|null */
public ?string $region=null,
/** @var string|null */
public ?string $postalCode=null,
/** @var string|null */
public ?string $isoCountry=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['id'])) $this->id = $o['id'];
if (isset($o['friendlyName'])) $this->friendlyName = $o['friendlyName'];
if (isset($o['emergencyEnabled'])) $this->emergencyEnabled = $o['emergencyEnabled'];
if (isset($o['customerName'])) $this->customerName = $o['customerName'];
if (isset($o['street'])) $this->street = $o['street'];
if (isset($o['city'])) $this->city = $o['city'];
if (isset($o['region'])) $this->region = $o['region'];
if (isset($o['postalCode'])) $this->postalCode = $o['postalCode'];
if (isset($o['isoCountry'])) $this->isoCountry = $o['isoCountry'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->id)) $o['id'] = $this->id;
if (isset($this->friendlyName)) $o['friendlyName'] = $this->friendlyName;
if (isset($this->emergencyEnabled)) $o['emergencyEnabled'] = $this->emergencyEnabled;
if (isset($this->customerName)) $o['customerName'] = $this->customerName;
if (isset($this->street)) $o['street'] = $this->street;
if (isset($this->city)) $o['city'] = $this->city;
if (isset($this->region)) $o['region'] = $this->region;
if (isset($this->postalCode)) $o['postalCode'] = $this->postalCode;
if (isset($this->isoCountry)) $o['isoCountry'] = $this->isoCountry;
return empty($o) ? new class(){} : $o;
}
}
/** @description Create a new business address to be used with e911 */
// @Api(Description="Create a new business address to be used with e911")
class NewAddress implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $accountId=null,
/** @var string|null */
public ?string $friendlyName=null,
/** @var bool|null */
public ?bool $emergencyEnabled=null,
/** @var string|null */
public ?string $customerName=null,
/** @var string|null */
public ?string $street=null,
/** @var string|null */
public ?string $city=null,
/** @var string|null */
public ?string $region=null,
/** @var string|null */
public ?string $postalCode=null,
/** @var string|null */
public ?string $isoCountry=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['accountId'])) $this->accountId = $o['accountId'];
if (isset($o['friendlyName'])) $this->friendlyName = $o['friendlyName'];
if (isset($o['emergencyEnabled'])) $this->emergencyEnabled = $o['emergencyEnabled'];
if (isset($o['customerName'])) $this->customerName = $o['customerName'];
if (isset($o['street'])) $this->street = $o['street'];
if (isset($o['city'])) $this->city = $o['city'];
if (isset($o['region'])) $this->region = $o['region'];
if (isset($o['postalCode'])) $this->postalCode = $o['postalCode'];
if (isset($o['isoCountry'])) $this->isoCountry = $o['isoCountry'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->accountId)) $o['accountId'] = $this->accountId;
if (isset($this->friendlyName)) $o['friendlyName'] = $this->friendlyName;
if (isset($this->emergencyEnabled)) $o['emergencyEnabled'] = $this->emergencyEnabled;
if (isset($this->customerName)) $o['customerName'] = $this->customerName;
if (isset($this->street)) $o['street'] = $this->street;
if (isset($this->city)) $o['city'] = $this->city;
if (isset($this->region)) $o['region'] = $this->region;
if (isset($this->postalCode)) $o['postalCode'] = $this->postalCode;
if (isset($this->isoCountry)) $o['isoCountry'] = $this->isoCountry;
return empty($o) ? new class(){} : $o;
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /addresses HTTP/1.1
Host: team.evovoice.io
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<NewAddress xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Voice.Api.Settings">
<AccountId>String</AccountId>
<City>String</City>
<CustomerName>String</CustomerName>
<EmergencyEnabled>false</EmergencyEnabled>
<FriendlyName>String</FriendlyName>
<ISOCountry>String</ISOCountry>
<PostalCode>String</PostalCode>
<Region>String</Region>
<Street>String</Street>
</NewAddress>
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <AddressInfo xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Voice.Api.Settings"> <City>String</City> <CustomerName>String</CustomerName> <EmergencyEnabled>false</EmergencyEnabled> <FriendlyName>String</FriendlyName> <ISOCountry>String</ISOCountry> <Id>String</Id> <PostalCode>String</PostalCode> <Region>String</Region> <Street>String</Street> </AddressInfo>