| Required role: | Backoffice |
| POST | /place/add |
|---|
<?php namespace BackofficeApi;
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 PlaceAddress implements JsonSerializable
{
public function __construct(
/** @var string */
public string $street='',
/** @var string */
public string $postalCode='',
/** @var string */
public string $region='',
/** @var string */
public string $countryCode=''
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['street'])) $this->street = $o['street'];
if (isset($o['postalCode'])) $this->postalCode = $o['postalCode'];
if (isset($o['region'])) $this->region = $o['region'];
if (isset($o['countryCode'])) $this->countryCode = $o['countryCode'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->street)) $o['street'] = $this->street;
if (isset($this->postalCode)) $o['postalCode'] = $this->postalCode;
if (isset($this->region)) $o['region'] = $this->region;
if (isset($this->countryCode)) $o['countryCode'] = $this->countryCode;
return empty($o) ? new class(){} : $o;
}
}
enum PlaceState : string
{
case Draft = 'Draft';
case Active = 'Active';
case Paused = 'Paused';
case Archived = 'Archived';
}
class TimeZoneDto implements JsonSerializable
{
public function __construct(
/** @var DateInterval|null */
public ?DateInterval $baseUtcOffset=null,
/** @var string */
public string $daylightName='',
/** @var string */
public string $displayName='',
/** @var string */
public string $id='',
/** @var string */
public string $standardName='',
/** @var bool|null */
public ?bool $supportsDaylightSavingTime=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['baseUtcOffset'])) $this->baseUtcOffset = JsonConverters::from('DateInterval', $o['baseUtcOffset']);
if (isset($o['daylightName'])) $this->daylightName = $o['daylightName'];
if (isset($o['displayName'])) $this->displayName = $o['displayName'];
if (isset($o['id'])) $this->id = $o['id'];
if (isset($o['standardName'])) $this->standardName = $o['standardName'];
if (isset($o['supportsDaylightSavingTime'])) $this->supportsDaylightSavingTime = $o['supportsDaylightSavingTime'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->baseUtcOffset)) $o['baseUtcOffset'] = JsonConverters::to('DateInterval', $this->baseUtcOffset);
if (isset($this->daylightName)) $o['daylightName'] = $this->daylightName;
if (isset($this->displayName)) $o['displayName'] = $this->displayName;
if (isset($this->id)) $o['id'] = $this->id;
if (isset($this->standardName)) $o['standardName'] = $this->standardName;
if (isset($this->supportsDaylightSavingTime)) $o['supportsDaylightSavingTime'] = $this->supportsDaylightSavingTime;
return empty($o) ? new class(){} : $o;
}
}
class PlaceContact implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $phone=null,
/** @var string|null */
public ?string $email=null,
/** @var string|null */
public ?string $website=null,
/** @var string|null */
public ?string $webShop=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['phone'])) $this->phone = $o['phone'];
if (isset($o['email'])) $this->email = $o['email'];
if (isset($o['website'])) $this->website = $o['website'];
if (isset($o['webShop'])) $this->webShop = $o['webShop'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->phone)) $o['phone'] = $this->phone;
if (isset($this->email)) $o['email'] = $this->email;
if (isset($this->website)) $o['website'] = $this->website;
if (isset($this->webShop)) $o['webShop'] = $this->webShop;
return empty($o) ? new class(){} : $o;
}
}
enum BusinessRole : string
{
case Owner = 'Owner';
case Manager = 'Manager';
case Sales = 'Sales';
case Marketing = 'Marketing';
case Other = 'Other';
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /place/add HTTP/1.1
Host: backoffice-api.brovs.com
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
name: String,
organizationNumber: String,
businessId: 0,
address:
{
street: String,
postalCode: String,
region: String,
countryCode: String
},
rootCategoryAbsoluteSlug: String
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
place:
{
id: 0,
name: String,
longitude: 0,
latitude: 0,
rootCategory:
{
id: 0,
name: String,
slug: String,
absoluteSlug: String,
parentId: 0,
state: String,
position: 0
},
claimed: False,
organizationNumber: String,
state: Draft,
countryCode: String,
overview: String,
timeZoneDto:
{
baseUtcOffset: PT0S,
daylightName: String,
displayName: String,
id: String,
standardName: String,
supportsDaylightSavingTime: False
},
businessId: 0,
contact:
{
phone: String,
email: String,
website: String,
webShop: String
},
address:
{
street: String,
postalCode: String,
region: String,
countryCode: String
},
backofficeGrantedStaffAccess:
[
{
id: 0,
firstName: String,
lastName: String,
email: String,
role: Owner,
placeId: 0,
businessId: 0,
userId: 0,
placeName: String,
businessName: String,
mobileNumber: String,
businessRole: Owner,
lastActiveOn: 0001-01-01T00:00:00.0000000+00:00
}
]
}
}