| Requires any of the roles: | bookingsupplier-administrator-write, superadmin |
| GET | /voss/customers | Search voss customers by organization number, customer number or external id | Raw passthrough to the Voss customer search. Returns all matching customers with their full fields (externalId, customerNumber, expiryDate, ...). |
|---|
<?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};
enum CountryCodeEnum : string
{
case AD = 'AD';
case AE = 'AE';
case AF = 'AF';
case AG = 'AG';
case AI = 'AI';
case AL = 'AL';
case AM = 'AM';
case AO = 'AO';
case AQ = 'AQ';
case AR = 'AR';
case AS = 'AS';
case AT = 'AT';
case AU = 'AU';
case AW = 'AW';
case AX = 'AX';
case AZ = 'AZ';
case BA = 'BA';
case BB = 'BB';
case BD = 'BD';
case BE = 'BE';
case BF = 'BF';
case BG = 'BG';
case BH = 'BH';
case BI = 'BI';
case BJ = 'BJ';
case BL = 'BL';
case BM = 'BM';
case BN = 'BN';
case BO = 'BO';
case BQ = 'BQ';
case BR = 'BR';
case BS = 'BS';
case BT = 'BT';
case BV = 'BV';
case BW = 'BW';
case BY = 'BY';
case BZ = 'BZ';
case CA = 'CA';
case CC = 'CC';
case CD = 'CD';
case CF = 'CF';
case CG = 'CG';
case CH = 'CH';
case CI = 'CI';
case CK = 'CK';
case CL = 'CL';
case CM = 'CM';
case CN = 'CN';
case CO = 'CO';
case CR = 'CR';
case CU = 'CU';
case CV = 'CV';
case CW = 'CW';
case CX = 'CX';
case CY = 'CY';
case CZ = 'CZ';
case DE = 'DE';
case DJ = 'DJ';
case DK = 'DK';
case DM = 'DM';
case DO = 'DO';
case DZ = 'DZ';
case EC = 'EC';
case EE = 'EE';
case EG = 'EG';
case EH = 'EH';
case ER = 'ER';
case ES = 'ES';
case ET = 'ET';
case FI = 'FI';
case FJ = 'FJ';
case FK = 'FK';
case FM = 'FM';
case FO = 'FO';
case FR = 'FR';
case GA = 'GA';
case GB = 'GB';
case GD = 'GD';
case GE = 'GE';
case GF = 'GF';
case GG = 'GG';
case GH = 'GH';
case GI = 'GI';
case GL = 'GL';
case GM = 'GM';
case GN = 'GN';
case GP = 'GP';
case GQ = 'GQ';
case GR = 'GR';
case GS = 'GS';
case GT = 'GT';
case GU = 'GU';
case GW = 'GW';
case GY = 'GY';
case HK = 'HK';
case HM = 'HM';
case HN = 'HN';
case HR = 'HR';
case HT = 'HT';
case HU = 'HU';
case ID = 'ID';
case IE = 'IE';
case IL = 'IL';
case IM = 'IM';
case IN = 'IN';
case IO = 'IO';
case IQ = 'IQ';
case IR = 'IR';
case IS = 'IS';
case IT = 'IT';
case JE = 'JE';
case JM = 'JM';
case JO = 'JO';
case JP = 'JP';
case KE = 'KE';
case KG = 'KG';
case KH = 'KH';
case KI = 'KI';
case KM = 'KM';
case KN = 'KN';
case KP = 'KP';
case KR = 'KR';
case KW = 'KW';
case KY = 'KY';
case KZ = 'KZ';
case LA = 'LA';
case LB = 'LB';
case LC = 'LC';
case LI = 'LI';
case LK = 'LK';
case LR = 'LR';
case LS = 'LS';
case LT = 'LT';
case LU = 'LU';
case LV = 'LV';
case LY = 'LY';
case MA = 'MA';
case MC = 'MC';
case MD = 'MD';
case ME = 'ME';
case MF = 'MF';
case MG = 'MG';
case MH = 'MH';
case MK = 'MK';
case ML = 'ML';
case MM = 'MM';
case MN = 'MN';
case MO = 'MO';
case MP = 'MP';
case MQ = 'MQ';
case MR = 'MR';
case MS = 'MS';
case MT = 'MT';
case MU = 'MU';
case MV = 'MV';
case MW = 'MW';
case MX = 'MX';
case MY = 'MY';
case MZ = 'MZ';
case NA = 'NA';
case NC = 'NC';
case NE = 'NE';
case NF = 'NF';
case NG = 'NG';
case NI = 'NI';
case NL = 'NL';
case NO = 'NO';
case NP = 'NP';
case NR = 'NR';
case NU = 'NU';
case NZ = 'NZ';
case OM = 'OM';
case PA = 'PA';
case PE = 'PE';
case PF = 'PF';
case PG = 'PG';
case PH = 'PH';
case PK = 'PK';
case PL = 'PL';
case PM = 'PM';
case PN = 'PN';
case PR = 'PR';
case PS = 'PS';
case PT = 'PT';
case PW = 'PW';
case PY = 'PY';
case QA = 'QA';
case RE = 'RE';
case RO = 'RO';
case RS = 'RS';
case RU = 'RU';
case RW = 'RW';
case SA = 'SA';
case SB = 'SB';
case SC = 'SC';
case SD = 'SD';
case SE = 'SE';
case SG = 'SG';
case SH = 'SH';
case SI = 'SI';
case SJ = 'SJ';
case SK = 'SK';
case SL = 'SL';
case SM = 'SM';
case SN = 'SN';
case SO = 'SO';
case SR = 'SR';
case SS = 'SS';
case ST = 'ST';
case SV = 'SV';
case SX = 'SX';
case SY = 'SY';
case SZ = 'SZ';
case TC = 'TC';
case TD = 'TD';
case TF = 'TF';
case TG = 'TG';
case TH = 'TH';
case TJ = 'TJ';
case TK = 'TK';
case TL = 'TL';
case TM = 'TM';
case TN = 'TN';
case TO = 'TO';
case TR = 'TR';
case TT = 'TT';
case TV = 'TV';
case TW = 'TW';
case TZ = 'TZ';
case UA = 'UA';
case UG = 'UG';
case UM = 'UM';
case US = 'US';
case UY = 'UY';
case UZ = 'UZ';
case VA = 'VA';
case VC = 'VC';
case VE = 'VE';
case VG = 'VG';
case VI = 'VI';
case VN = 'VN';
case VU = 'VU';
case WF = 'WF';
case WS = 'WS';
case YE = 'YE';
case YT = 'YT';
case ZA = 'ZA';
case ZM = 'ZM';
case ZW = 'ZW';
}
// @DataContract(Name="CustomerContactPersonDto")
class CustomerContactPersonDto implements JsonSerializable
{
public function __construct(
// @DataMember(Name="email", IsRequired=true)
/** @var string */
public string $email='',
// @DataMember(Name="firstName", IsRequired=true)
/** @var string */
public string $firstName='',
// @DataMember(Name="lastName", IsRequired=true)
/** @var string */
public string $lastName='',
// @DataMember(Name="phoneNumber")
/** @var string */
public string $phoneNumber=''
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['email'])) $this->email = $o['email'];
if (isset($o['firstName'])) $this->firstName = $o['firstName'];
if (isset($o['lastName'])) $this->lastName = $o['lastName'];
if (isset($o['phoneNumber'])) $this->phoneNumber = $o['phoneNumber'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->email)) $o['email'] = $this->email;
if (isset($this->firstName)) $o['firstName'] = $this->firstName;
if (isset($this->lastName)) $o['lastName'] = $this->lastName;
if (isset($this->phoneNumber)) $o['phoneNumber'] = $this->phoneNumber;
return empty($o) ? new class(){} : $o;
}
}
// @DataContract(Name="CustomerTargetGroupDto")
class CustomerTargetGroupDto implements JsonSerializable
{
public function __construct(
// @DataMember(Name="id", IsRequired=true)
/** @var string */
public string $id='',
// @DataMember(Name="name", IsRequired=true)
/** @var string */
public string $name='',
// @DataMember(Name="isDefault")
/** @var bool|null */
public ?bool $isDefault=null,
// @DataMember(Name="externalId")
/** @var string */
public string $externalId=''
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['id'])) $this->id = $o['id'];
if (isset($o['name'])) $this->name = $o['name'];
if (isset($o['isDefault'])) $this->isDefault = $o['isDefault'];
if (isset($o['externalId'])) $this->externalId = $o['externalId'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->id)) $o['id'] = $this->id;
if (isset($this->name)) $o['name'] = $this->name;
if (isset($this->isDefault)) $o['isDefault'] = $this->isDefault;
if (isset($this->externalId)) $o['externalId'] = $this->externalId;
return empty($o) ? new class(){} : $o;
}
}
// @DataContract(Name="CustomerResult")
class CustomerResult implements JsonSerializable
{
public function __construct(
// @DataMember(Name="countryCode")
/** @var CountryCodeEnum|null */
public ?CountryCodeEnum $countryCode=null,
// @DataMember(Name="id", IsRequired=true)
/** @var string */
public string $id='',
// @DataMember(Name="name", IsRequired=true)
/** @var string */
public string $name='',
// @DataMember(Name="customerNumber")
/** @var int|null */
public ?int $customerNumber=null,
// @DataMember(Name="organizationNumber")
/** @var string */
public string $organizationNumber='',
// @DataMember(Name="email")
/** @var string */
public string $email='',
// @DataMember(Name="careOf")
/** @var string */
public string $careOf='',
// @DataMember(Name="address")
/** @var string */
public string $address='',
// @DataMember(Name="postalCode")
/** @var string */
public string $postalCode='',
// @DataMember(Name="city")
/** @var string */
public string $city='',
// @DataMember(Name="electronicInvoiceOperatorCode")
/** @var string */
public string $electronicInvoiceOperatorCode='',
// @DataMember(Name="electronicInvoiceAddress")
/** @var string */
public string $electronicInvoiceAddress='',
// @DataMember(Name="customerGroup")
/** @var int|null */
public ?int $customerGroup=null,
// @DataMember(Name="contactPerson")
/** @var CustomerContactPersonDto|null */
public ?CustomerContactPersonDto $contactPerson=null,
// @DataMember(Name="targetGroups", EmitDefaultValue=false)
/** @var array<CustomerTargetGroupDto>|null */
public ?array $targetGroups=null,
// @DataMember(Name="expiryDate")
/** @var DateTime|null */
public ?DateTime $expiryDate=null,
// @DataMember(Name="created", IsRequired=true)
/** @var DateTime */
public DateTime $created=new DateTime(),
// @DataMember(Name="externalId")
/** @var string */
public string $externalId=''
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['countryCode'])) $this->countryCode = JsonConverters::from('CountryCodeEnum', $o['countryCode']);
if (isset($o['id'])) $this->id = $o['id'];
if (isset($o['name'])) $this->name = $o['name'];
if (isset($o['customerNumber'])) $this->customerNumber = $o['customerNumber'];
if (isset($o['organizationNumber'])) $this->organizationNumber = $o['organizationNumber'];
if (isset($o['email'])) $this->email = $o['email'];
if (isset($o['careOf'])) $this->careOf = $o['careOf'];
if (isset($o['address'])) $this->address = $o['address'];
if (isset($o['postalCode'])) $this->postalCode = $o['postalCode'];
if (isset($o['city'])) $this->city = $o['city'];
if (isset($o['electronicInvoiceOperatorCode'])) $this->electronicInvoiceOperatorCode = $o['electronicInvoiceOperatorCode'];
if (isset($o['electronicInvoiceAddress'])) $this->electronicInvoiceAddress = $o['electronicInvoiceAddress'];
if (isset($o['customerGroup'])) $this->customerGroup = $o['customerGroup'];
if (isset($o['contactPerson'])) $this->contactPerson = JsonConverters::from('CustomerContactPersonDto', $o['contactPerson']);
if (isset($o['targetGroups'])) $this->targetGroups = JsonConverters::fromArray('CustomerTargetGroupDto', $o['targetGroups']);
if (isset($o['expiryDate'])) $this->expiryDate = JsonConverters::from('DateTime', $o['expiryDate']);
if (isset($o['created'])) $this->created = JsonConverters::from('DateTime', $o['created']);
if (isset($o['externalId'])) $this->externalId = $o['externalId'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->countryCode)) $o['countryCode'] = JsonConverters::to('CountryCodeEnum', $this->countryCode);
if (isset($this->id)) $o['id'] = $this->id;
if (isset($this->name)) $o['name'] = $this->name;
if (isset($this->customerNumber)) $o['customerNumber'] = $this->customerNumber;
if (isset($this->organizationNumber)) $o['organizationNumber'] = $this->organizationNumber;
if (isset($this->email)) $o['email'] = $this->email;
if (isset($this->careOf)) $o['careOf'] = $this->careOf;
if (isset($this->address)) $o['address'] = $this->address;
if (isset($this->postalCode)) $o['postalCode'] = $this->postalCode;
if (isset($this->city)) $o['city'] = $this->city;
if (isset($this->electronicInvoiceOperatorCode)) $o['electronicInvoiceOperatorCode'] = $this->electronicInvoiceOperatorCode;
if (isset($this->electronicInvoiceAddress)) $o['electronicInvoiceAddress'] = $this->electronicInvoiceAddress;
if (isset($this->customerGroup)) $o['customerGroup'] = $this->customerGroup;
if (isset($this->contactPerson)) $o['contactPerson'] = JsonConverters::to('CustomerContactPersonDto', $this->contactPerson);
if (isset($this->targetGroups)) $o['targetGroups'] = JsonConverters::toArray('CustomerTargetGroupDto', $this->targetGroups);
if (isset($this->expiryDate)) $o['expiryDate'] = JsonConverters::to('DateTime', $this->expiryDate);
if (isset($this->created)) $o['created'] = JsonConverters::to('DateTime', $this->created);
if (isset($this->externalId)) $o['externalId'] = $this->externalId;
return empty($o) ? new class(){} : $o;
}
}
class SearchVossCustomersResponse implements JsonSerializable
{
public function __construct(
/** @var int */
public int $TotalCount=0,
/** @var array<CustomerResult>|null */
public ?array $Items=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['TotalCount'])) $this->TotalCount = $o['TotalCount'];
if (isset($o['Items'])) $this->Items = JsonConverters::fromArray('CustomerResult', $o['Items']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->TotalCount)) $o['TotalCount'] = $this->TotalCount;
if (isset($this->Items)) $o['Items'] = JsonConverters::toArray('CustomerResult', $this->Items);
return empty($o) ? new class(){} : $o;
}
}
// @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
class SearchVossCustomers implements JsonSerializable
{
public function __construct(
/** @description Organization number to search for. */
// @ApiMember(Description="Organization number to search for.")
/** @var string */
public string $OrganizationNumber='',
/** @description Voss customer number to search for. */
// @ApiMember(Description="Voss customer number to search for.")
/** @var int|null */
public ?int $CustomerNumber=null,
/** @description External id to search for. */
// @ApiMember(Description="External id to search for.")
/** @var string */
public string $ExternalId=''
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['OrganizationNumber'])) $this->OrganizationNumber = $o['OrganizationNumber'];
if (isset($o['CustomerNumber'])) $this->CustomerNumber = $o['CustomerNumber'];
if (isset($o['ExternalId'])) $this->ExternalId = $o['ExternalId'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->OrganizationNumber)) $o['OrganizationNumber'] = $this->OrganizationNumber;
if (isset($this->CustomerNumber)) $o['CustomerNumber'] = $this->CustomerNumber;
if (isset($this->ExternalId)) $o['ExternalId'] = $this->ExternalId;
return empty($o) ? new class(){} : $o;
}
}
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.
GET /voss/customers HTTP/1.1 Host: testapi.bokamera.se Accept: text/jsv
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
TotalCount: 0,
Items:
[
{
}
]
}